Home
Content Management API⁡𝅶‍‍𝅺⁡‍𝅴⁡𝅴𝅹‍‍⁢𝅵‍‍⁣⁣‌⁡⁣𝅺⁣⁢⁣𝅸⁠⁢‍‍‍𝅷‍‍𝅳⁡‍⁠‍‍⁢𝅵‍‍𝅳⁡⁣⁡⁣⁡​⁡⁢⁢𝅵‍𝅺‍𝅺⁢𝅸⁡⁢‍𝅹⁣‌⁡⁣𝅺⁢𝅸⁡⁢‍𝅹⁢𝅺𝅸‍𝅺⁠⁣𝅴⁡⁣𝅺⁡‍‍𝅺𝅴⁡⁣⁠𝅸⁠𝅺⁡⁣⁡𝅴⁡​⁠⁡⁢‍𝅺⁢𝅳⁢‌⁢​⁢𝅴⁢‍⁢⁠‍𝅺𝅴⁡⁣⁠𝅸⁡⁢‍𝅺⁢⁢⁢𝅴⁢𝅳⁢⁢⁢‌⁢⁡⁢𝅳⁢‌‍‍⁡𝅸
Main resources
Upload-related
Site Search
Environments
UI
Workflows
Async jobs
Roles & permissions
Webhooks
Hosting & CI integrations
Subscription
Enterprise
    Show examples in:
    Update an API token

    Parameters

    name  string  Required

    Name of API token

    can_access_cda  boolean  Required

    Whether this API token can access the Content Delivery API published content endpoint

    can_access_cda_preview  boolean  Required

    Whether this API token can access the Content Delivery API draft content endpoint

    can_access_cma  boolean  Required

    Whether this API token can access the Content Management API

    role  { type: "role", id: role.id }, null  Required

    Role

    Returns

    Returns a access_token resource object.

    Examples

    Example code:
    import { buildClient } from '@datocms/cma-client-node';
    async function run() {
    const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });
    const accessTokenId = '312';
    const accessToken = await client.accessTokens.update(accessTokenId, {
    name: 'Read-only API token',
    can_access_cda: true,
    can_access_cda_preview: true,
    can_access_cma: true,
    role: {
    type: 'role',
    id: '34'
    }
    });
    console.log(accessToken);
    }
    run();
    Returned output:
    {
    id: '312',
    name: 'Read-only API token',
    token: 'XXXXXXXXXXXXXXX',
    can_access_cda: true,
    can_access_cda_preview: true,
    can_access_cma: true,
    hardcoded_type: '',
    role: {
    type: 'role',
    id: '34'
    }
    }