Create Clerk M2M token

Create a machine-to-machine token in a connected Clerk instance.

← All Clerk endpoints · Capability overview

POST/v1/clerk/m2m-tokens

https://api.vee3.io/v1/clerk/m2m-tokens

15 tokens

Create a machine-to-machine token in a connected Clerk instance.

Authorization

Send your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

MCP

The same capability is available as an MCP tool on Vee3 hosted MCP.

Tool name

clerk.create_m2m_token
Parameters6 fields
clerk_instance_idstringOptional

Clerk instance id (ins_...) from clerk.get_connected_accounts. Omit to use the default connected account.

machine_secret_keystringRequired

Machine secret key (msk_...) used to authenticate the create request.

token_formatstringOptional

Token format: "opaque" (default) or "jwt".

seconds_until_expirationnumberOptional

Token lifetime in seconds.

min 0

claimsobjectOptional

Optional custom claims embedded in the token.

min_remaining_ttl_secondsintegerOptional

For opaque tokens, reuse an existing token with at least this TTL remaining.

min 0

Response9 fields
m2m_tokenobject
8 fields

Created M2M token from the Backend API.

idstring

M2M token id (mt_...).

subjectstring

Machine id (mch_...) that created or owns the token.

tokenstring

M2M token secret when returned on creation. Treat as high-privilege — do not log.

revokedboolean

Whether the token has been revoked.

expiredboolean

Whether the token has expired.

expirationinteger

Unix timestamp in milliseconds when the token expires.

created_atinteger

Unix timestamp in milliseconds when the token was created.

updated_atinteger

Unix timestamp in milliseconds when the token was last updated.

HTTP errors: clerk_connection_required, clerk_connection_not_found, clerk_connection_invalid, validation_error, unauthorized, payment_required