API
v2 Current
6 min readCreate a Website session grant
Exchange server-side Website integration credentials for a short-lived text or voice session grant.
UpdatedByTalkIt Docs team
Introduced in v2
On this page
Use this endpoint from a trusted backend configured for Website server relay. Return only the short-lived grant to the browser; never expose the integration client secret.
Contract source
Generated from content/docs/sources/openapi/website-session-grants/v2.openapi.yaml.
Download the OpenAPI specification
POST /website/v2/server/session-grants
Create a one-use grant for a text chat or voice call.
Authentication
Send the Website integration client ID and client secret using HTTP Basic authentication.
cURL example
BASH
curl --request POST \
--url https://your-dedicated-domain.example/website/v2/server/session-grants \
--user "$TALKIT_CLIENT_ID:$TALKIT_CLIENT_SECRET" \
--header "Content-Type: application/json" \
--data '{"channel":"text","externalSubjectId":"customer:9e6f0f63","externalSessionId":"session:3c2f38bd","profileClaims":{"displayName":"Alex Morgan","email":"alex@example.com"}}'
Request body
Request example
JSON
{
"channel": "text",
"externalSubjectId": "customer:9e6f0f63",
"externalSessionId": "session:3c2f38bd",
"profileClaims": {
"displayName": "Alex Morgan",
"email": "alex@example.com"
}
}
Responses
| Status | Description |
|---|---|
200 | The session grant was created. |
400 | The request contains an invalid channel, identifier, or profile claim. |
401 | The HTTP Basic credentials are missing or invalid. |
403 | The integration, linked agent, or requested channel is unavailable. |
404 | The configured Website integration or linked resource does not exist. |
429 | Session-grant capacity is temporarily unavailable. |
500 | TalkIt could not create the grant. |
Response example
JSON
{
"success": true,
"data": {
"sessionToken": "short-lived-one-use-token",
"websocketUrl": "wss://your-dedicated-domain.example/website/v2/text/_ws",
"expiresAt": "2026-08-11T12:00:00.000Z"
}
}
Schemas
WebsiteServerSessionGrantInput
| Field | Type | Required | Description |
|---|---|---|---|
channel | text, voice | Yes | Transport that will consume the grant. |
externalSubjectId | string (8–200) | Yes | Stable customer identifier derived from authenticated server-side state. |
externalSessionId | string (8–200) | Yes | Stable identifier for one logical client conversation session. |
profileClaims | WebsiteProfileClaims | No | Optional customer profile data trusted by your backend. |
WebsiteProfileClaims
| Field | Type | Required | Description |
|---|---|---|---|
displayName | string (1–200) | No | Customer-facing display name. |
phone | string (1–80) | No | Verified, normalized phone number. |
email | string (email, 1–320) | No | Verified email address. |
WebsiteSessionGrant
| Field | Type | Required | Description |
|---|---|---|---|
sessionToken | string (32–512) | Yes | Short-lived, one-use bearer token for the WebSocket connection. |
websocketUrl | string (uri) | Yes | WebSocket URL for the selected text or voice channel. |
expiresAt | string (date-time) | Yes | ISO 8601 expiration time for the grant. |
SuccessEnvelope
| Field | Type | Required | Description |
|---|---|---|---|
success | true | Yes | Indicates that the request succeeded. |
data | WebsiteSessionGrant | Yes | The newly issued session grant. |