Skip to content
StatusSupportDashboard

Create short-lived access token

POST/v1/access_tokens

Exchange a long-lived API key for a short-lived access token. Authenticate with your long-lived API key as the Bearer token; the response contains a new token that authenticates the same team until it expires. Short-lived access tokens cannot be used to create additional access tokens.

Body ParametersJSONExpand Collapse
customer_session_id: optional string

Optional opaque session identifier to associate with the access token.

minLength1
expires_in: optional number

Lifetime of the access token in seconds. Defaults to 3600 (1 hour). Minimum 300 (5 minutes), maximum 86400 (24 hours).

minimum300
maximum86400
user_id: optional string

Optional user identifier to associate with the access token for attribution. Use the same canonical user ID string that you send in other SafetyKit API calls.

minLength1
ReturnsExpand Collapse
access_token: string

Short-lived bearer token. Use it in the Authorization header exactly like a long-lived API key. It cannot be used to create additional access tokens.

expires_at: string

ISO 8601 timestamp at which the access token expires.

formatdate-time
expires_in: number

Number of seconds until the access token expires.

token_type: "Bearer"

Token type. Always Bearer.

Create short-lived access token

curl https://api.safetykit.com/v1/access_tokens \
    -X POST \
    -H "Authorization: Bearer $SAFETYKIT_API_KEY"
{
  "access_token": "sk_live_abc123...",
  "expires_at": "2026-01-01T01:00:00.000Z",
  "expires_in": 3600,
  "token_type": "Bearer"
}
Returns Examples
{
  "access_token": "sk_live_abc123...",
  "expires_at": "2026-01-01T01:00:00.000Z",
  "expires_in": 3600,
  "token_type": "Bearer"
}