Overview
Roadmap — not yet available. The embeddable widget is a future feature. Endpoints in this section describe the planned contract; they are not yet exposed in production.
Creates a short-lived session token for embedding the CauseFlow AI assistant widget in your own application. The session token scopes the widget to the specified user and tenant, and expires after 8 hours.
Required role: admin or member
JWT Bearer token. Format: Bearer <your-jwt>. The CREATE session endpoint itself requires user auth; the returned session token authenticates all subsequent widget calls.
Request body
The ID of the user who will interact with the widget. Must be a valid user in your tenant.
Optional incident ID to pre-load the widget with context for a specific incident.
Session lifetime in seconds. Default: 28800 (8 hours). Maximum: 86400 (24 hours).
Response
Returns 201 Created.
{
"sessionId": "wsess_01HX9VTPQR3KF8MZWBYD5N6JCE",
"sessionToken": "wst_live_EXAMPLE_TOKEN_REDACTED",
"expiresAt": "2024-04-01T22:00:00Z",
"widgetUrl": "https://widget.causeflow.ai/embed?session=wsess_01HX9VTPQR3KF8MZWBYD5N6JCE"
}
| Field | Type | Description |
|---|
sessionId | string | Unique session identifier |
sessionToken | string | Short-lived token to authenticate the widget. Pass to the frontend widget SDK. |
expiresAt | string | ISO 8601 expiry timestamp |
widgetUrl | string | Embeddable URL for iframe integration |
The sessionToken grants widget access for the specified user. Do not log it or expose it to other users. Treat it like a short-lived password.
Error responses
| Status | Error code | Description |
|---|
400 | validation_error | userId missing or invalid |
401 | unauthorized | Missing or invalid JWT |
403 | forbidden | Caller lacks required role |
404 | user_not_found | userId does not exist in this tenant |
Examples
curl https://api.causeflow.ai/v1/widget/sessions \
-X POST \
-H "Authorization: Bearer eyJhbGc..." \
-H "Content-Type: application/json" \
-d '{
"userId": "user_01HX9VTPQR3KF8MZWBYD5N6JCE",
"incidentId": "inc_EXAMPLE_01JX"
}'
Send message
Send a message to the widget session
Widget stream
Stream AI responses via SSE