Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > API token

Delete an API token

Query parameters

destination_user_type enum

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

Example: "user"
account
user
access_token
sso_user
destination_user_id string

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

Example: "7865"

Returns

Returns a resource object of type access_token

Examples

1
import { buildClient } from "@datocms/cma-client-node";
2
3
async function run() {
4
const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
5
6
const accessTokenId = "312";
7
8
const accessToken = await client.accessTokens.destroy(accessTokenId);
9
10
// Check the 'Returned output' tab for the result ☝️
11
console.log(accessToken);
12
}
13
14
run();
1
{
2
id: "312",
3
name: "Read-only API token",
4
hardcoded_type: "",
5
can_access_cda: true,
6
can_access_cda_preview: true,
7
can_access_cma: true,
8
role: { type: "role", id: "34" },
9
}