Overview
This endpoint processes user decisions and forwards them to the originating AI service. The required payload structure varies based on the action’sresponse_type
as defined in the notification.
Request
Endpoint:POST /api/v1/client/respond
Authentication: Requires Bearer token using user credentials
Request Body
Field | Type | Required | Description |
---|---|---|---|
notification_id | string | Yes | UUID of the notification being answered |
action_id | string | Yes | Selected action identifier from the notification |
response_data | any | Conditional | Required for all response types except "simple" |
response_data
field must conform to the requirements of the action’s response_type
. For details on the format for each response type, see the Response Types documentation.
Response
Success Response
Status Code:200 OK
Field | Type | Description |
---|---|---|
notification_id | string | UUID of the notification that was answered |
action_id | string | Identifier of the selected action |
status | string | Updated notification status, typically “responded” |
responded_at | datetime | Timestamp when the response was recorded |
Error Responses
Status Code | Error Code | Description |
---|---|---|
400 Bad Request | MISSING_REQUIRED_FIELD | Required field is missing from request |
400 Bad Request | INVALID_ACTION_ID | The specified action_id doesn’t exist for this notification |
400 Bad Request | INVALID_RESPONSE_DATA | Response data doesn’t match expected format |
401 Unauthorized | AUTH_INVALID_TOKEN | User token is invalid |
403 Forbidden | NOTIFICATION_ACCESS_DENIED | User does not have access to this notification |
404 Not Found | NOTIFICATION_NOT_FOUND | Notification with specified ID does not exist |
409 Conflict | NOTIFICATION_EXPIRED | Notification deadline has passed |
409 Conflict | NOTIFICATION_INVALIDATED | Service marked notification as invalid |
409 Conflict | NOTIFICATION_ALREADY_RESPONDED | Notification has already been answered |
422 Unprocessable Entity | CONSTRAINT_VIOLATION | Response violates defined constraints |
Response Type Examples
Here are examples of valid request bodies for each response type:Simple Action
Binary Choice
Single Choice
Multiple Choice
Text Input
Numeric Input
Scale/Range
Examples
JavaScript Example
Python Example
Error Handling
When submitting responses, it’s important to handle errors gracefully. Here’s a more comprehensive error handling approach:Best Practices
- Validate Response Data: Verify that response data matches the expected format before submitting
- Handle Terminal States: Gracefully handle expired or invalidated notifications
- Implement Retries: Use exponential backoff for retrying transient failures
- Offline Support: Queue responses locally when offline and submit when connectivity is restored
- User Feedback: Provide immediate feedback to users while the response is being processed
- Security: Never log or expose sensitive response data