---
title: "POST /tokens"
method: POST
path: "/tokens"
tags: ["tokens"]
---

# POST /tokens

`POST /tokens`

## Request

- Base URL: `https://api.axiom.co/v2`
- URL: `https://api.axiom.co/v2/tokens`
- Auth: OAuth 2
  - Authorization code: `https://accounts.google.com/o/oauth2/v2/auth`
  - Token URL: `https://www.googleapis.com/oauth2/v4/token` scopes: `apiTokens|create`
- TypeScript: <https://skmtc.dev/axiom/apis/axiom-public-api/docs/tokens/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates an API token and returns its secret `token` value, which you can't retrieve again. You can only grant capabilities you have yourself. If you omit `expiresAt`, the token doesn't expire.

## Request body

- CreateAPIToken
  - `datasetCapabilities` DatasetCapabilities
  - `description` string: Description of the token
  - `expiresAt` string, date-time, nullable: Expiration date of the token (ISO 8601 format)
  - `name` string, required: Name of the token
  - `orgCapabilities` OrgCapabilities
    - `annotations` string[]: Annotations capability
    - `apiTokens` string[]: API tokens capability
    - `auditLog` string[]: Audit Log capability
    - `billing` string[]: Billing capability
    - `dashboards` string[]: Dashboards capability
    - `datasets` string[]: Datasets capability
    - `endpoints` string[]: Endpoints capability
    - `integrations` string[]: Integrations capability
    - `labels` string[]: Labels capability
    - `monitors` string[]: Monitors capability
    - `notifiers` string[]: Notifiers capability
    - `rbac` string[]: Access control capability
    - `sharedAccessKeys` string[]: Shared access keys capability
    - `users` string[]: Users capability
    - `views` string[]: Views capability
  - `viewCapabilities` ViewCapabilities

## Response `200`

Created API token, including its secret `token` value.

- CreateAPITokenResponse
  - `apiLastUsed` string, date-time, nullable: When the token was last used on an API other than ingest
  - `auditIdentity` string: Audit identity of the token
  - `datasetCapabilities` DatasetCapabilities, required
  - `description` string: Description of the token
  - `expiresAt` string, date-time, nullable: Expiration date of the token (ISO 8601 format)
  - `id` string, required: ID of the token
  - `ingestLastUsed` string, date-time, nullable: When the token was last used to ingest
  - `name` string, required: Name of the token
  - `orgCapabilities` OrgCapabilities, required
    - `annotations` string[]: Annotations capability
    - `apiTokens` string[]: API tokens capability
    - `auditLog` string[]: Audit Log capability
    - `billing` string[]: Billing capability
    - `dashboards` string[]: Dashboards capability
    - `datasets` string[]: Datasets capability
    - `endpoints` string[]: Endpoints capability
    - `integrations` string[]: Integrations capability
    - `labels` string[]: Labels capability
    - `monitors` string[]: Monitors capability
    - `notifiers` string[]: Notifiers capability
    - `rbac` string[]: Access control capability
    - `sharedAccessKeys` string[]: Shared access keys capability
    - `users` string[]: Users capability
    - `views` string[]: Views capability
  - `samlAuthenticated` boolean
  - `viewCapabilities` ViewCapabilities
  - `token` string

## Other responses

- `400`: No capability set, an invalid capability, or a capability the caller doesn't have.

## Changes

- **2026-10-16** (v2) `fbc1b8430feb`: 1 info
  - added the non-success response with the status `400`
- **2026-10-14** (v2) `8920e1697284`: 4 warning, 5 info
  - removed the request property `datasetCapabilities/additionalProperties/data`
  - removed the request property `orgCapabilities/flows`
  - removed the optional property `allOf[#/components/schemas/APIToken]/datasetCapabilities/additionalProperties/data` from the response with the `200` status
  - removed the optional property `allOf[#/components/schemas/APIToken]/orgCapabilities/flows` from the response with the `200` status
  - …5 more

[Operation history](https://skmtc.dev/axiom/apis/axiom-public-api/changes/tokens/post.md)

---

[API](https://skmtc.dev/axiom/apis/axiom-public-api.md) - [All operations](https://skmtc.dev/axiom/apis/axiom-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/axiom/apis/axiom-public-api/revisions/7e39a295e3ba?raw)
