Create a client token
Mint a short-lived token for a browser, mobile, or desktop client. Call this endpoint only from a trusted server.
POST
/v1/enterprise/client-tokensAuthorization
X-API-KeyAPI key · headerrequiredLong-lived Enterprise API credential provisioned for trusted servers.
Request body
requiredapplication/jsonoriginstring<uri>Exact browser origin to bind to the token. Use this or client_app_id, not both.
client_app_idstringStable native client identifier. Use this or origin, not both.
max length 255
client_user_idstringOptional user correlation ID.
max length 255
client_session_idstringOptional session correlation ID.
max length 255
ttl_secondsintegerRequested lifetime. Values above 120 are capped at 120 seconds.
min 1 · default: 60
Responses
201Client token created.
client_tokenstringrequiredShort-lived bearer token beginning with mlg_ent_client_.
expires_atstring<date-time>required401The credential is missing, invalid, expired, or revoked.
errorstringcodestringrequest_idstringRequest
curl -X POST "https://go.monologue.to/v1/enterprise/client-tokens" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"origin": "https://app.example.com",
"client_user_id": "user_123",
"client_session_id": "session_456",
"ttl_seconds": 60
}'const response = await fetch("https://go.monologue.to/v1/enterprise/client-tokens", {
method: "POST",
headers: {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
"origin": "https://app.example.com",
"client_user_id": "user_123",
"client_session_id": "session_456",
"ttl_seconds": 60
})
});import requests
response = requests.post(
"https://go.monologue.to/v1/enterprise/client-tokens",
headers={
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"origin": "https://app.example.com",
"client_user_id": "user_123",
"client_session_id": "session_456",
"ttl_seconds": 60
},
)Response
{
"client_token": "string",
"expires_at": "2024-01-01T00:00:00Z"
}{
"error": "string",
"code": "string",
"request_id": "string"
}