Choose your language:
    List all API tokens
    Returns
    Returns an array of access_token objects.

    Examples

    Example code:
    const SiteClient = require('datocms-client').SiteClient;
    const client = new SiteClient('YOUR-API-TOKEN');
    client.accessTokens.all()
    .then((accessTokens) => {
    accessTokens.forEach((accessToken) => {
    console.log(accessToken);
    });
    })
    .catch((error) => {
    console.error(error);
    });
    Returned output:
    > node example.js
    {
    "id": "312",
    "name": "Read-only API token",
    "token": "XXXXXXXXXXXXXXX",
    "canAccessCda": true,
    "canAccessCdaPreview": true,
    "canAccessCma": true,
    "hardcodedType": "",
    "role": "34"
    }