Skip to navigation

Issue a presence user token

Issues a short-lived token for one person, bound to your scoped publishable key, so your app can call address presence for that person only. Call it from your server, for the person signed in to your own session. The answer is never cached. Needs the user_tokens.presence.write scope.

A presence token lets a scoped publishable key read GET /api/v1/address/presence/{externalUserId} and send presence reports for the person. A report made with a user token alone never links a phone to the watch and counts as unverified; the SDK’s own device token keeps its full weight.

Limits. 24 tokens per person an hour, and an hourly limit for the organisation.

Error codes

errorStatusMeaning
invalid_request400The body failed validation.
secret_key_required403A publishable key was used. This endpoint accepts secret keys only.
environment_mismatch403The key belongs to an environment this deployment does not serve.
ip_not_allowed403The key has an IP allowlist and the calling address is not on it.
organization_suspended403The organisation is suspended. The response carries reason and suspendedAt.
business_not_approved403A live key was used before the business was approved for production.
insufficient_scope403The key does not hold user_tokens.presence.write.
invalid_ttl422ttlSeconds is outside the range for this purpose. It is refused, never shortened.
invalid_publishable_key422publishableKeyId is not a live scoped publishable key of this organisation and environment.
user_token_mint_limited429Too many tokens for this person in the last hour.
rate_limited429Too many tokens for the organisation in the last hour.
rate_limit_store_unavailable503The limit cannot be checked right now. Retry shortly.

A missing or unknown key answers 401, where error is a short sentence rather than a code.

Requires a secret (sk_) key. A publishable key receives 403 secret_key_required.

Authentication

AuthorizationBearer

Send the API key as a Bearer token. Each operation states whether a publishable key is enough or a secret key is required. A scoped publishable key has Verification flow access, the fixed set flow.run, flow.config.read and verifications.status.read; a scoped secret key reaches what its scopes allow.

Request

This endpoint expects an object.
externalUserIdstringRequired1-200 characters
Your reference for the person signed in to your own session. The token works only for this person.
publishableKeyIdstringRequired1-100 characters
The id of the scoped publishable key your app uses. The token works only with that key and its replacements.
ttlSecondsintegerOptional>=60

How long the token lasts, from 60 seconds. Presence: default 86400 (24 hours), at most 604800 (7 days). Biometric: default 600 (10 minutes), at most 900 (15 minutes). Never beyond the minting key’s own expiry.

Response

The token, shown once.
object"user_token"

Always user_token.

idstring

The token’s public id (utk_), for revoking it and for your records. Not a credential.

tokenstring

The token itself. Shown once and never stored by Toden: pass it to your app and do not log it.

purposeenum

presence or biometric.

Allowed values:
externalUserIdstring
The person the token works for.
expiresAtdatetime
When the token stops working.
maxUsesinteger or null

Biometric: 5 face checks. Presence: null, any number of calls until it expires.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
422
Unprocessable Entity Error
429
Too Many Requests Error
503
Service Unavailable Error