Choose your language:
    Delete an API token
    Query parameters
    destinationUserType  enum  Optional

    New owner for resources previously owned by the deleted access token. This argument specifies the new owner type.

    destinationUserId  string  Optional

    New owner for resources previously owned by the deleted access token. This argument specifies the new owner ID.

    Returns
    Returns a access_token object.

    Examples

    Example code:
    const { SiteClient } = require('datocms-client');
    async function run() {
    const client = new SiteClient('YOUR-API-TOKEN');
    const accessTokenId = '312';
    const accessToken = await client.accessToken.destroy(accessTokenId, {
    destination_user_type: 'user',
    destination_user_id: '7865'
    });
    console.log(accessToken);
    }
    run();
    Returned output:
    > node example.js
    {
    "id": "312",
    "name": "Read-only API token",
    "token": "XXXXXXXXXXXXXXX",
    "canAccessCda": true,
    "canAccessCdaPreview": true,
    "canAccessCma": true,
    "hardcodedType": "",
    "role": "34"
    }