Endpoints
| Method | Endpoint | Description |
|---|---|---|
POST | /form-submissions/submit | Submit a form |
POST | /form-submissions/client-result | Report client handler result |
GET | /form-submissions/analytics | Get form analytics |
Submit Form
Request Body
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
toolId | string | Yes | The form tool ID |
conversationId | string | No | Associated conversation ID |
formData | object | Yes | Key-value pairs of form field values |
fieldsCompleted | string[] | Yes | List of fields that were filled |
impressionAt | number | No | Timestamp when form was shown (ms) |
startedAt | number | No | Timestamp when user started filling (ms) |
Response
Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | Whether submission was recorded |
submissionId | string | Unique submission ID |
executionMode | string | webhook, client, or both |
webhookResult | object | Result of webhook delivery |
postActionResults | array | Results of post-submission actions |
clientHandler | string | Name of client handler (if applicable) |
Errors
| Status | Description |
|---|---|
| 400 | Invalid request body or file too large |
| 404 | Tool not found |
File Uploads
Files are submitted as base64-encoded data URLs:Report Client Result
Request Body
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
submissionId | string | Yes | The submission ID |
success | boolean | Yes | Whether client handler succeeded |
message | string | No | Status message |
data | object | No | Additional result data |
Response
Get Form Analytics
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
agentId | string | Yes | The agent ID |
Response
Analytics Fields
| Field | Description |
|---|---|
toolId | Form tool ID |
toolName | Form tool name |
impressions | Times form was shown |
started | Times user began filling |
submitted | Total submissions |
successful | Successful submissions |
failed | Failed submissions |
conversionRate | submitted / impressions × 100 |
completionRate | submitted / started × 100 |
fieldCompletionRates | Completion % per field |
Submission Status
Form submissions progress through these statuses:| Status | Description |
|---|---|
pending | Just created, processing |
submitted | Recorded (client-only mode) |
webhook_success | Webhook delivered successfully |
webhook_failed | Webhook delivery failed |
client_success | Client handler succeeded |
client_failed | Client handler failed |
success | All actions completed |
failed | One or more actions failed |
Execution Modes
| Mode | Behavior |
|---|---|
webhook | Send to configured webhook URL only |
client | Handle with client-side JavaScript only |
both | Send to webhook AND notify client handler |
Webhook Payload
When execution mode includes webhook, data is sent as:Retry Logic
Failed webhooks are automatically retried:| Attempt | Delay |
|---|---|
| 1 | Immediate |
| 2 | 1 minute |
| 3 | 5 minutes |
Post Actions
After the primary webhook, additional actions are processed:Slack Notification
Additional Webhook
Email Notification
Examples
Submit Contact Form
Report Client Handler Success
Get Analytics
Integration with Widget
The widget handles form submission automatically:- User fills out form in widget
- Widget calls
/form-submissions/submit - Server processes webhook/post-actions
- If
executionModeincludesclient, widget calls registered handler - Widget calls
/form-submissions/client-resultwith handler result