REST API: access tokens

Create a permanent API token

Create a token for server-to-server calls.

Purpose

Use this call to create a permanent API token from your own tooling instead of the dashboard. Keep the new token on your server only.

Request

POST <API_BASE_URL>/token/create. All calls are POST under your API address. Replace <API_BASE_URL> with the API address provided with your access.

Send a permanent API token in the token field of the body, or a user token in the token header. See authentication.

Content type: application/json.

FieldTypeRequiredDescription
tokenstring (uuid)if no headerYour current permanent API token. Required unless you send a user token in the token header.
expiresstringnoWhen the new token stops working, as a UTC timestamp that ends in Z, for example 2027-01-01T00:00:00.000Z. Leave it out for a token that does not expire.

Response

HTTP 201. The token was created and is usable immediately.

FieldTypeDescription
statusstringAlways ok on this body.
messagestringHuman-readable detail. Never branch on it.
token.idstring (uuid)The new token. Send it as token in later calls.
token.expiresstringThe expiry as a UTC timestamp, or never.

Errors

  • 400: The body failed validation. The answer has status of error and a details list with one entry per offending field (path, expected, actual).
  • 401: The token is missing, expired or unknown.

A refusal can also come before the operation runs: an address outside your IP allowlist, a token bound to another address, or a body that is not valid JSON. See response format and errors.

Example

Request:

curl -X POST "<API_BASE_URL>/token/create" \
  -H "Content-Type: application/json" \
  -d '{
    "token": "<your permanent API token>",
    "expires": "2027-01-01T00:00:00.000Z"
  }'

Response:

{
  "status": "ok",
  "message": "<detail>",
  "token": {
    "id": "<token id>",
    "expires": "2027-01-01T00:00:00.000Z"
  }
}

Questions about tokens?

Write to us and we will help.

Talk to us