Skip to main content
Contents

API tokens

API tokens let your scripts and integrations use the API v2 on behalf of your organization. Each token has a name, a list of scopes and an optional expiry date.

Create a token

  1. Open the API tokens page of the customer portal. Creating a token needs a verified e-mail address and a recent sign-in: the portal asks you to confirm your identity if needed.
  2. Give the token a name that says where it is used, choose its scopes and, if you want, an expiry date.
  3. Copy the secret. It is shown only once: keep it in a secret manager or in the protected variables of your CI system, never in source code.

Choose scopes

Scopes are the permissions shown on each operation of the API reference, such as sites.read, domains.manage or cache.purge. sites.* grants every permission of a resource, and * grants every permission.

Give each token only what it needs: a deployment script that purges content needs cache.purge, not sites.delete.

Use a token

Send the token in the Authorization header as a bearer token. A missing or invalid token answers 401 with unauthenticated, and a token without the needed scope answers 403.

Request: List sites
curl 'https://api.cdnify.lat/api/v2/sites' \
  -H "Authorization: Bearer $CDNIFY_API_TOKEN"

API reference: List sites

Rotate and revoke

To rotate a token, create a new one, update your integration, then revoke the old one. Revoking takes effect at once.

Each token records when it was last used (last_used_at), which helps to find tokens that are no longer needed.

Asynchronous operations

Purges and certificate requests are asynchronous: the API answers 202 with a resource that you can read again until its status is final. Poll it at a reasonable interval.

Next steps