Skip to content
Start here

Delete Token

client.accounts.tokens.delete(stringtokenId, TokenDeleteParams { account_id } params, RequestOptionsoptions?): TokenDeleteResponse { id } | null
DELETE/accounts/{account_id}/tokens/{token_id}

Destroy an Account Owned API token.

Security

API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
Accepted Permissions (at least one required)
Account API Tokens Write
ParametersExpand Collapse
tokenId: string

Token identifier tag.

maxLength32
params: TokenDeleteParams { account_id }
account_id: string

Account identifier tag.

maxLength32
minLength32
ReturnsExpand Collapse
TokenDeleteResponse { id }
id: string

Identifier

maxLength32
minLength32

Delete Token

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

const token = await client.accounts.tokens.delete('ed17574386854bf78a67040be0a770b0', {
  account_id: '023e105f4ecef8ad9ca31a8372d0c353',
});

console.log(token.id);
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "id": "023e105f4ecef8ad9ca31a8372d0c353"
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "id": "023e105f4ecef8ad9ca31a8372d0c353"
  }
}