Nuance LabsDocs
ReferenceAPI overviewServer

Create a session token

POST
/session-tokens

Mints a session token that your page or app can start one Nuance Live conversation with. Call it from your server with an API key, never from a browser. What you send here (the interface and its setup, the personality and your id for the person) is fixed for the conversation the token creates.

Authorization

apiKey
headerAuthorizationBearer <token>

An API key from your organization's API keys page on the platform, nk_…. Server only.

Request Body

application/json
  1. body

What the conversation the token creates will be, and who it is for. Send end_user_id with every token; leave the other fields out for the defaults.

personality?|

Who the persona is in the conversation, fixed for its whole life. Leave it out for the default personality.

end_user_id?|

Your own id for the person the conversation is for, such as a hash of your user id. Repeated policy violations then pause new conversations for this person only. Letters, digits and _ . : -, up to 128 characters; never an email address or a name.

interface?|

nuance_live, the default, so you can leave it out.

interface_setup?|

A Nuance Live session's own settings. See Set up a session.

expressiveness?|

How much the persona's face and head move, from 0 to 2: lower is calmer, higher more expressive. Leave it out for 1, the persona's own tuned level. A value outside 0 to 2 is refused with 422.

Response Body

Successful Response

application/json
  1. response

A session token to hand to your page.

token*string

The session token, st_…, for your page or app to create the conversation with.

expires_at*string

When the token stops being able to start a conversation (UTC). Once it has started one, it lasts as long as that conversation.

Formatdate-time
warnings*array<string>

What to change in how you mint tokens; empty when nothing. Without end_user_id, it says that policy pauses count against all your organization's conversations without one.

curl -X POST 'https://api.nuancelabs.ai/session-tokens' \  -H 'Content-Type: application/json' \  -d '{}'
{  "token": "string",  "expires_at": "2019-08-24T14:15:22Z",  "warnings": [    "string"  ]}