Skills
Log in

Rotate a key on an API token

Creates a new key for an API token and sets all other keys to expire. The replacement key scope must be contained by the calling API token role, one of the session user roles, or the normalized workload role scope. Rotation outside that scope returns 403. The caller-expiry cap is deferred for rotation compatibility: non-delegated tokens can renew their configured lifetime, including six-month tokens, and replacement keys may outlive the caller. Delegated callers can rotate only their own token, regardless of role permissions. Delegated token expiry stays fixed: rotating its parent does not renew it. Delegated replacement keys remain bounded by that fixed token deadline.

Required permission

Account > Admin > ApiTokens > Update

Path parameters

    • tokenId

      string required
      ID of the API token

Request body

  • {object}
    • otherKeysExpiresAt

      string
      Expiry time for all existing keys. Defaults to immediate expiry.

Response body

  • {object}
    Response object.
    • data

      {object} required
      Result data.
      • key

        {object} required
        The newly created API key.
        • id

          string required
          UUID of the new API key.
        • issuedAt

          string required
          The time the key was issued.
      • token

        string required
        The API token for authentication.

POST /v1/tokens/{tokenId}/keys

POST /v1/teams/{teamId}/tokens/{tokenId}/keys

Example request

Request body
curl --header "Content-Type: application/json" \
  --header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
  --request POST \
  --data '{}' \
  https://api.northflank.com/v1/tokens/{tokenId}/keys

Example response

200 OK

The newly created API key and token.

JSON

{
  "data": {
    "key": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "issuedAt": "2021-01-20T11:19:53.175Z"
    },
    "token": "eyJhbGciOiJIUzI1NiIs..."
  }
}

© 2026 Northflank Ltd. All rights reserved.

northflank.com / Terms / Privacy / feedback@northflank.com