Child pages
  • UAPI Functions - Tokens::revoke
Skip to end of metadata
Go to start of metadata

Description

This function removes an API token from a cPanel account.

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Tokens/revoke?name=example


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Remove an API token from a cPanel account.
$result = $cpanel->uapi(
    'Tokens', 'revoke',
		array(
			'name'	=>	'example'
		)
);


Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Remove an API token from a cPanel account.
my $result = $cpliveapi->uapi(
    'Tokens', 'revoke',
		{
			'name'	=> 'example'
		}
);


Note:

For more information, read our Guide to the LiveAPI System.

 Command Line
uapi --user=username Tokens revoke name=example


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{
   "result":{
      "status":1,
      "metadata":{
      },
      "errors":null,
      "data":1,
      "warnings":null,
      "messages":null
   }
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
namestring

Required

The API token to remove.

A valid API token name.example

Returns

ReturnTypeDescriptionPossible valuesExample
dataBoolean

Whether the system removed the API token.

Note:

The system returns the data value in the function's metadata. This differs from our usual API return format.

For more information, read our Return Data documentation.

  • 1 — The system removed the API token or the API token doesn't exist.
  • 0 — The system did not remove the API token.
1