Skip to main content
POST
/
client-tokens
JavaScript
import Limitry from '@limitry/sdk';

const client = new Limitry({
  apiKey: process.env['LIMITRY_API_KEY'], // This is the default and can be omitted
});

const clientToken = await client.clientTokens.create({
  context: { customerId: 'cust_123', plan: 'pro' },
});

console.log(clientToken.id);
{
  "token": "limitry_ct_abc123def456...",
  "id": "ct_abc123",
  "expiresAt": "2024-01-15T11:30:00Z"
}

Authorizations

Authorization
string
header
required

API Key or Personal Access Token (PAT). When using PAT, include X-Project header.

Body

application/json
context
object
required

Public context accessible to the client via /client/context (e.g., { customerId: "...", plan: "..." })

serverContext
object

Private context only accessible to handlers, never exposed to client (e.g., { internalId: "..." })

ttlSeconds
integer

Time-to-live in seconds. Default: 3600 (1 hour). Max: 86400 (24 hours).

Required range: 0 < x <= 86400

Response

Client token created successfully

token
string
required

The client token. Store this securely - it will not be shown again.

id
string
required

Token ID for management purposes

expiresAt
string<date-time>
required

ISO 8601 timestamp when the token expires