Skip to main content
POST
/
tokens
JavaScript
import Smithery from '@smithery/api';

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

const createTokenResponse = await client.tokens.create();

console.log(createTokenResponse.token);
{
  "token": "<string>",
  "expiresAt": "2024-01-01T01:00:00.000Z"
}

Authorizations

Authorization
string
header
required

Smithery API key as Bearer token

Body

application/json
policy
object[]

Constraint objects to restrict the token. Cannot be combined with profileSlug. Each constraint may include a ttl field (max 24 hours). Default TTL is 1 hour. Maximum is 24 hours.

Minimum array length: 1
profileSlug
string

Profile slug for legacy token minting. Cannot be combined with policy.

Response

Token created successfully

token
string
required

The signed service token.

expiresAt
string
required

ISO 8601 timestamp when the token expires.

Example:

"2024-01-01T01:00:00.000Z"