Skip to content

Tokens ​

Minting and checking access tokens on the server, for tenants that would rather not mint locally.

Mint an access token on the server ​

POST /v1/tokens

For a tenant that would rather not mint locally. It costs a network round trip that local minting (@talkline/server-sdk, or any HS256 JWT library) does not, on the path to every connect. The grants are narrowed by the application's grant ceiling.

Credential: API key — Authorization: Bearer <api_key>.<api_secret>
Rate limit: write, 120 a minute

Request body application/json

FieldTypeDescription
identitystringBecomes the token's sub. 1–200 characters.
name?stringAt most 120 characters.
ref?stringAt most 120 characters.
metadata?objectThe tenant's own JSON, at most 4 096 bytes as UTF-8. The platform never reads it.
grants?object{ roomJoin: true, canSubscribe: true } unless given.
  grants.roomJoin?boolean
  grants.room?stringA room sid or name. At most 200 characters.
  grants.roomCreate?boolean
  grants.roomAdmin?booleanMute and evict others, end the room.
  grants.roomList?boolean
  grants.canPublish?boolean
  grants.canSubscribe?boolean
  grants.canPublishData?boolean
  grants.canPublishSources?string[]Each one of microphone, camera, screen, screen_audio.
  grants.hidden?booleanIn the room and invisible to the others — a supervisor.
  grants.recorder?boolean
  grants.canUpdateOwnMetadata?booleanDefault false.
ttlSec?integer1–600. Default 300.

Response 201 — The token, and the grants it carries.

FieldTypeDescription
tokenstring
grantsGrantsWhat a participant may do. Every name is one the model has; any other is refused rather than ignored.
notestring

Errors

StatusCode
400validation_failed, token_ttl_too_long
401unauthenticated, token_expired, token_replayed, token_not_yet_valid
403permission_denied, app_suspended, quota_exhausted
413payload_too_large
429rate_limited
500internal

Verify an access token exactly as signaling will — and spend it ​

POST /v1/tokens/introspect

Claims the token's jti, so introspecting a token consumes it: a check that did not would be a way to test a token without spending it.

Credential: API key — Authorization: Bearer <api_key>.<api_secret>
Rate limit: write, 120 a minute

Request body application/json

FieldTypeDescription
tokenstring1–8192 characters.

Response 200 — What the token says, and what the server grants it.

FieldTypeDescription
identitystring
name?string
ref?string
metadataobjectThe tenant's own JSON, at most 4 096 bytes as UTF-8. The platform never reads it.
expiresAtstring (date-time)
requestedGrantsobjectThe token's grants claim as it was minted.
grantsobjectWhat the server grants — never wider than asked.
  grants.roomJoin?boolean
  grants.room?stringA room sid or name. At most 200 characters.
  grants.roomCreate?boolean
  grants.roomAdmin?booleanMute and evict others, end the room.
  grants.roomList?boolean
  grants.canPublish?boolean
  grants.canSubscribe?boolean
  grants.canPublishData?boolean
  grants.canPublishSources?string[]Each one of microphone, camera, screen, screen_audio.
  grants.hidden?booleanIn the room and invisible to the others — a supervisor.
  grants.recorder?boolean
  grants.canUpdateOwnMetadata?booleanDefault false.

Errors

StatusCode
400validation_failed, token_ttl_too_long
401unauthenticated, token_expired, token_replayed, token_not_yet_valid
403permission_denied, app_suspended, quota_exhausted
413payload_too_large
429rate_limited
500internal

Talkline documentation