Widget Endpoints
Public API endpoints used by the embedded widget. Authenticated via site key, not JWT.
Overview
These endpoints are called by the widget JavaScript running on your customer's browser. They use the public site key for authentication instead of a JWT, since the widget operates in an unauthenticated (visitor) context.
The site key is passed via the x-site-key header on every request. This identifies the workspace and allows the backend to resolve the tenant.
x-site-key: zt_pub_abc123def456Endpoints
Get Widget Config
/widget/configFetch the widget configuration for rendering — colors, greeting, position, branding.
Auth: Site key (x-site-key header)
{
"workspaceName": "Acme Inc",
"greeting": "Hey! How can we help you today?",
"position": "bottom-right",
"primaryColor": "#6366f1",
"showBranding": true,
"requireEmail": false,
"offlineMode": "ticket",
"logo": "https://cdn.zapticket.app/logos/ws_abc123.png"
}This endpoint is called once when the widget initializes. The response is cached on the client for the duration of the page session.
Get Availability
/widget/availabilityCheck whether any agents are currently online for live chat.
Auth: Site key (x-site-key header)
{
"available": true,
"onlineAgentCount": 3,
"estimatedWaitTime": null
}{
"available": false,
"onlineAgentCount": 0,
"estimatedWaitTime": null
}When available is false and the widget is configured with offlineMode: "ticket", the widget shows a "Leave a message" form instead of the live chat interface.
Verify Identity
/widget/verify-identityVerify a signed identity payload for authenticated visitors (HMAC validation).
Auth: Site key (x-site-key header)
{
"userId": "user_12345",
"email": "[email protected]",
"name": "Alice Customer",
"hash": "a1b2c3d4e5f6..."
}The hash is an HMAC-SHA256 signature of userId using the workspace's HMAC secret key. This ensures the identity hasn't been tampered with.
{
"verified": true,
"visitorToken": "vis_abc123xyz",
"identity": {
"userId": "user_12345",
"email": "[email protected]",
"name": "Alice Customer"
}
}{
"error": "Identity verification failed: invalid signature"
}Create Offline Ticket
/widget/offline-ticketSubmit a support request when no agents are online. Creates a ticket in the workspace.
Auth: Site key (x-site-key header)
{
"name": "Alice Customer",
"email": "[email protected]",
"subject": "Can't reset my password",
"message": "I've tried the reset flow 3 times but never receive the email. I've checked spam."
}{
"ticketId": "tkt_offline123",
"reference": "ZT-1045",
"message": "Your message has been received. We'll get back to you at [email protected]."
}All fields are required. The ticket is created with priority: "medium" and status: "open". Agents see it in their ticket queue when they come online.