Tokens

Create a signed user token

Changed on

Provides a mechanism for having Surge create a signed token for embeds instead of signing with your own signing key.

post/users/{user_id}/tokens

Request

  • Base URL
    https://api.surge.app
  • URL
    https://api.surge.app/users/{user_id}/tokens
  • Auth
    HTTP bearer

Path parameters

user_idstring required

The user for which the token represents authentication.

Example:usr_01jymgdfrpec2asc5m0z3a6fr9

Request body

duration_secondsinteger

For how many seconds the token should be accepted. Defaults to 15 minutes.

read_onlyboolean

Restrict the token to viewing embedded conversations and unread counts. Sending messages, changing read state, editing contacts, and calling are disabled. Defaults to false. Preserve this value when refreshing the token; changing access mode requires reloading the embed.

Example request

{
  "duration_seconds": 900
}

Response

Created token

tokenstring

The created token.

Example response

{
  "token": "header.payload.signature"
}

Changes