Skip to main content

Client token handshake

The handshake gives a short-lived agent client token for one agent, plus the agent's widget settings. The token lets a mobile app or your own chat window talk to the agent without your API key.

Where your chat runsHow to get the token
The LUMA website widgetNothing to do: the widget runs the handshake itself
Your own chat design on a web pageYour server calls the handshake and gives the token to the page (browsers on other sites cannot call this address directly)
Your mobile appThe app or your server calls the handshake

POST https://api.itechintl.com/v1/widget/handshake

Plan: every plan. Credits: free. Authentication: none (the token is limited to one agent).

Request​

curl --request POST 'https://api.itechintl.com/v1/widget/handshake' \
--header 'Content-Type: application/json' \
--data '{
"project_id": "PROJECT_ID",
"chatbot_id": "AGENT_ID"
}'
FieldTypeRequiredDescription
project_idstringyesProject ID from the agent's Install page (data-pid in the embed code)
chatbot_idstringyesAgent ID from the Install page (data-cid in the embed code)
versionstringnodraft returns the unpublished widget settings, for previews

Response 200​

{
"message": "Success",
"data": {
"jwt": "AGENT_CLIENT_TOKEN",
"title": "Sales Assistant",
"welcome_message": "Hi, how can I help you today?",
"placeholder_text": "Type your question",
"widget_theme_color": "#0B2A4A",
"widget_position": "right",
"theme_mode": "light",
"enable_sources": true,
"enable_suggested_questions": true,
"show_registration_form": false,
"css_text": ""
}
}
FieldDescription
jwtThe agent client token. Send it as Authorization: Bearer <jwt> to the chat endpoints. Valid for 1 hour.
other fieldsThe agent's widget settings, as configured in the app (appearance, texts, options)

Token lifetime​

  • Valid for 1 hour. When a chat call answers 401, run the handshake again and retry once.
  • The token allows chatting with this agent only. It cannot send WhatsApp messages or read your data.

Errors​

Statuserror.codeWhen
400BAD REQUESTMissing or invalid project_id or chatbot_id
500INTERNAL SERVER ERRORUnexpected error; retry