Skip to main content
cURL
Returns an identity token for one user. Your app sends it with that user’s events in the x-tranthor-identity-token header, or in the identityTokens array of a /batch request. Tranthor checks it the same way as a token you sign yourself with your identity secret. The token is signed with your workspace’s newest active identity secret. Create a secret under Settings > Authentication. Without an active secret, this endpoint answers 409 with code: "no_identity_secret". Authenticate with an Admin API key. A write key or a dashboard session is refused with 401.
example response
  • ttlSeconds is 60 to 604800 (7 days). The default is 86400 (24 hours).
  • A userId or audience that would make the token longer than 2048 bytes is refused with 400: longer tokens are not accepted by Tranthor.
  • audience limits the token to one app ID or origin. It is accepted only from requests that send that x-tranthor-app-id header or Origin.
Call this endpoint from your backend. An Admin API key can change your whole workspace, so never put it in a browser or mobile app. A login service that only needs to vouch for users can sign tokens itself with the identity secret instead.

Authorizations

Authorization
string
header
required

An Admin API key, sent as Authorization: Bearer <key>. Create one in Settings.

Body

application/json
workspaceId
string<uuid>
required
userId
string
required

The user the token vouches for. It becomes the sub claim.

Required string length: 1 - 512
ttlSeconds
integer
default:86400

How long the token is valid, in seconds. Default 24 hours.

Required range: 60 <= x <= 604800
audience
string

Binds the token to one app ID or origin. Public ingestion accepts it only from a request that sends that x-tranthor-app-id or Origin.

Required string length: 1 - 256

Response

Default Response

token
string
required
expiresAt
string<date-time>
required