Skip to content

Issue tokens

In Api Key, create a key for your app and copy it. It’s shown once. Store it as a secret on your backend, like SNIPET_API_KEY.

API keys page

POST /api/apps/issue-token with the key in the X-API-Key header.

Field Required
externalUserId yes Your id for the user. The same id always gets the same conversations.
name The user’s name, carried in the token.
email The user’s email, carried in the token.
metadata Any JSON object you want carried in the token, like the user’s plan.
expiresInSeconds From 60 to 86400 (24 hours). Defaults to 3600.
appId When set, the request fails unless the key belongs to this app. A guard against mixing up keys.

The response:

{ "token": "eyJhbGciOi...", "expiresAt": "2026-10-22T15:04:05.000Z" }

Each example is a backend endpoint your frontend calls, like GET /snipet-token, after your own sign-in check.

Terminal window
curl -X POST https://snipet.example.com/api/apps/issue-token \
-H "X-API-Key: $SNIPET_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "externalUserId": "user-123", "name": "Ada Lovelace", "email": "ada@example.com" }'

Next: use the token in the widget or your own UI.