Content Management API > API token
List all API tokens
Lists every API token defined on the project, including the built-in factory tokens (read-only, full-access, …) seeded by DatoCMS.
Each entry's attributes.token is included for callers whose role has can_manage_access_tokens (and is null otherwise). Use attributes.last_cma_access / attributes.last_cda_access to spot tokens that haven't been used recently and may be safe to revoke.
Returns
Returns an array of resource objects of type access_token
Examples
import { buildClient } from "@datocms/cma-client-node";
async function run() { const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
const accessTokens = await client.accessTokens.list();
for (const accessToken of accessTokens) { // Check the 'Returned output' tab for the result ☝️ console.log(accessToken); }}
run();{ id: "312", name: "Read-only API token", hardcoded_type: "", can_access_cda: true, can_access_cda_preview: true, can_access_cma: true, last_cma_access: "never", last_cda_access: "never", role: { type: "role", id: "34" },}