AI Question Cards
Sometimes the assistant needs a decision from the user before it can continue: which option to pick, which items apply, or a short value. Instead of asking in prose and waiting for the user to type, it can pause and send a question card: a small, validated set of questions your client renders as controls.
The card is data, never markup. The user's answers come back to you as structured input, become the user's next message in the conversation, and the assistant continues from them.
Lifecycle
- Send a message and declare that your client can draw question cards (Opt in).
- If the assistant decides a card helps, the run pauses and the stream emits
clarification.requiredwith the questions. - Render the questions and let the user select.
- Submit the answers with
POST /ai/clarifications/:clarificationId/answer, or decline them withPOST /ai/clarifications/:clarificationId/skip. - The answers appear as a user message, the stream of the paused reply ends with
clarification.superseded, and the assistant continues in a new reply that you attach to.
The assistant chooses a card only when selecting is easier than typing. Open-ended questions, explanations, and ordinary conversation stay plain text, so a client must handle both.
Opt in
Declare the capability on the message request with renderCapability:
{
"content": "Quiz me on twenty vocabulary words, one round at a time.",
"renderCapability": { "surface": "api", "renders": ["question_form"] }
}| Field | Type | Description |
|---|---|---|
renderCapability.surface | string | One of web, mobile, desktop, cli, api. Defaults to api. |
renderCapability.renders | string[] | What your client can draw. Add question_form to receive choice and checklist cards. Unknown values are ignored. |
Without question_form the assistant never creates a choice or checklist card for that conversation. It asks in plain text instead. Short free-text question cards (inputType: "text") can still arrive, so a client that does not declare the capability must still handle clarification.required, or let the user skip the card or stop the run.
The declaration is read for each message you send, and it carries over to the continuation that follows an answered card. Declare it on every message.
The card
This is the payload of the clarification.required event (see SSE Streaming). The entries of clarifications on an assistant message in message history carry the same clarificationId, runId, reason, title, schemaVersion and questions, so a reloaded page shows exactly what the live stream showed. History adds the card's current state (Reloading and history).
{
"runId": "00000000-0000-4000-8000-000000000001",
"messageId": "00000000-0000-4000-8000-000000000021",
"clarificationId": "00000000-0000-4000-8000-000000000022",
"status": "waiting_user_input",
"reason": "Round 1 of 3",
"title": "Vocabulary quiz",
"schemaVersion": 1,
"questions": [
{
"id": "q1",
"question": "What does “acquiesce” mean?",
"inputType": "radio",
"required": true,
"allowCustomAnswer": false,
"options": [
{ "id": "a", "label": "To refuse strongly", "recommended": false },
{ "id": "b", "label": "To accept reluctantly", "recommended": false },
{ "id": "c", "label": "To explain in detail", "recommended": false }
]
},
{
"id": "q2",
"question": "Which of these are adjectives?",
"inputType": "checkbox",
"required": true,
"allowCustomAnswer": false,
"minimumSelections": 1,
"options": [
{ "id": "x", "label": "cogent", "recommended": false },
{ "id": "y", "label": "deleterious", "recommended": false },
{ "id": "z", "label": "acquiesce", "recommended": false }
]
}
]
}| Field | Type | Description |
|---|---|---|
clarificationId | string | Identifies the card. Use it in the answer request. |
runId | string | The paused run. Send it back with the answers. |
messageId | string | The assistant message the card belongs to. |
status | string | Always waiting_user_input on this event. |
reason | string | One short sentence from the assistant introducing the card (≤ 600 characters). Show it above the questions. |
title | string | Optional heading, such as a round counter (≤ 120 characters). |
schemaVersion | number | Version of this card format. Currently 1. See Unknown versions. |
questions | object[] | One to five questions. |
expiresAt | string | ISO 8601 time after which the card can no longer be answered or skipped. Cards expire 24 hours after they are asked. See Leaving a card. |
Each question:
| Field | Type | Description |
|---|---|---|
id | string | Stable identifier within the card (≤ 64 characters). Use it in the answer. |
question | string | The question text (≤ 400 characters). Plain text. |
inputType | string | radio (choose one), checkbox (choose several) or text (a short written answer). |
required | boolean | Whether the question must be answered. |
allowCustomAnswer | boolean | Whether the user may write their own answer in customText. Always true for text. |
options | object[] | For radio and checkbox: two to twelve options, each with an id, a label (≤ 200 characters) and recommended. Absent for text. |
minimumSelections | number | Optional lower bound for checkbox. |
maximumSelections | number | Optional upper bound for checkbox. |
Every string is plain text. Render it as text, never as HTML or Markdown.
Answer a card
POST /ai/clarifications/:clarificationId/answer
Submits the answers and continues the conversation. The server validates every answer against the questions that were shown, never against anything your client sends, so a stale or tampered form cannot change what the assistant asked.
Authentication: JWT Bearer token + active AI entitlement required. Idempotency: Idempotency-Key header required (8–128 characters from A–Z a–z 0–9 : _ - .). Omitting it returns 428.
Request
- Headers:
Authorization: Bearer <token>,Content-Type: application/json,Idempotency-Key: <unique key> - Path params:
clarificationId
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
runId | string (uuid) | Yes | The runId from the card. |
answers | object[] | Yes | One to twenty entries. |
answers[].questionId | string | Yes | The question being answered. |
answers[].selectedOptionIds | string[] | For choice questions | The chosen option ids. Exactly one for radio. |
answers[].customText | string | No | Written answer, up to 2,000 characters. Required for text, accepted for choice questions only when allowCustomAnswer is true. |
Answer every required question once. An answer for an unknown question, a duplicate answer, an unknown option, or a selection outside minimumSelections and maximumSelections is rejected with 400 and the card stays pending, so the user can correct it.
Choosing an idempotency key
Use one key per distinct submission. Retrying the identical request with the same key returns the original result and creates nothing new, which makes it safe to retry after a timeout or a lost response. A rejected submission is remembered under its key too: sending corrected answers with the same key returns 409 idempotency_key_reused_with_different_payload. Send corrected answers with a new key. Deriving the key from the card id and the answers does both.
Response
{
"data": {
"answered": true,
"clarificationId": "00000000-0000-4000-8000-000000000022",
"runId": "00000000-0000-4000-8000-000000000001",
"answers": [
{ "questionId": "q1", "inputType": "radio", "selectedOptionIds": ["b"], "customText": null },
{ "questionId": "q2", "inputType": "checkbox", "selectedOptionIds": ["x", "y"], "customText": null }
],
"resume": {
"resumed": true,
"clarificationId": "00000000-0000-4000-8000-000000000022",
"originalRunId": "00000000-0000-4000-8000-000000000001",
"resumeRunId": "00000000-0000-4000-8000-000000000024",
"messageId": "00000000-0000-4000-8000-000000000023",
"status": "queued",
"answerMessage": {
"id": "00000000-0000-4000-8000-000000000025",
"content": "1. What does “acquiesce” mean? → To accept reluctantly\n2. Which of these are adjectives? → cogent, deleterious",
"createdAt": "2026-04-12T10:00:01.000Z"
}
}
}
}| Field | Type | Description |
|---|---|---|
answers | object[] | The validated answers as stored. |
resume.resumeRunId | string | The run that continues the conversation. |
resume.messageId | string | The new assistant message. Attach to its stream to read the continuation. |
resume.answerMessage | object | The user message the answers became: one line per question, N. <question> → <answer>. |
Errors
| Status | Code | Meaning |
|---|---|---|
| 400 | bad_request | The body is malformed, for example an empty answers list. |
| 400 | missing_required_answer, unknown_question, unknown_option, duplicate_question_answer, duplicate_option_selection, radio_multiple_selection, checkbox_below_minimum, checkbox_above_maximum, custom_answer_not_allowed, unexpected_options_for_text_question | An answer does not match the card. The card stays pending. |
| 401 | unauthorized | Missing or invalid token. |
| 404 | clarification_not_found | No such card for you. A card that belongs to someone else is indistinguishable from one that does not exist. |
| 409 | clarification_already_answered, clarification_run_not_waiting | The card was already answered, skipped, stopped or replaced. Submitting again, even with a new Idempotency-Key, never creates a second continuation. |
| 409 | idempotency_key_reused_with_different_payload | The key was already used with different answers. Use a new key for the corrected submission. |
| 410 | clarification_expired | The card was not answered in time. Cards expire 24 hours after they are asked, at expiresAt. |
| 428 | missing_idempotency_key | The Idempotency-Key header is missing. |
Code Examples
Use clarificationId and runId from the clarification.required event as $CLARIFICATION_ID and $RUN_ID, and the ids and option ids from the card in the body.
curl -X POST https://api.chainabit.com/api/v1/ai/clarifications/$CLARIFICATION_ID/answer \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: answer-$CLARIFICATION_ID-1" \
-d "{
\"runId\": \"$RUN_ID\",
\"answers\": [
{ \"questionId\": \"q1\", \"selectedOptionIds\": [\"b\"] },
{ \"questionId\": \"q2\", \"selectedOptionIds\": [\"x\", \"y\"] }
]
}"Skip a card
POST /ai/clarifications/:clarificationId/skip
Declines the card and continues the conversation. Skipping never cancels anything: the assistant continues in a new reply from the original message exactly as it was sent, and it does not ask another card in that reply. The response has the same shape as an answer, so a client attaches to the continuation the same way.
Authentication: JWT Bearer token + active AI entitlement required. Idempotency: Idempotency-Key header required (8–128 characters from A–Z a–z 0–9 : _ - .). Omitting it returns 428.
Request
- Headers:
Authorization: Bearer <token>,Content-Type: application/json,Idempotency-Key: <unique key> - Path params:
clarificationId
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
runId | string (uuid) | Yes | The runId from the card. |
A card is answered or skipped once. Retrying the identical request with the same key returns the original result.
Response
{
"data": {
"answered": true,
"clarificationId": "00000000-0000-4000-8000-000000000022",
"runId": "00000000-0000-4000-8000-000000000001",
"answers": [
{ "questionId": "q1", "inputType": "radio", "selectedOptionIds": [], "customText": null },
{ "questionId": "q2", "inputType": "checkbox", "selectedOptionIds": [], "customText": null }
],
"disposition": "skipped",
"resume": {
"resumed": true,
"clarificationId": "00000000-0000-4000-8000-000000000022",
"originalRunId": "00000000-0000-4000-8000-000000000001",
"resumeRunId": "00000000-0000-4000-8000-000000000024",
"messageId": "00000000-0000-4000-8000-000000000023",
"status": "queued",
"answerMessage": {
"id": "00000000-0000-4000-8000-000000000025",
"content": "1. What does “acquiesce” mean? → —\n2. Which of these are adjectives? → —",
"createdAt": "2026-04-12T10:00:01.000Z"
}
}
}
}| Field | Type | Description |
|---|---|---|
disposition | string | Always skipped. |
answers | object[] | One empty entry per question. |
resume.messageId | string | The new assistant message. Attach to its stream to read the continuation. |
resume.answerMessage | object | The user message recorded in the conversation: one line per question, N. <question> → —. |
Errors
| Status | Code | Meaning |
|---|---|---|
| 400 | bad_request | The body is malformed, for example a missing or invalid runId. |
| 401 | unauthorized | Missing or invalid token. |
| 404 | clarification_not_found | No such card for you. |
| 409 | clarification_already_answered, clarification_run_not_waiting | The card was already answered, skipped, stopped or replaced. Skipping again, even with a new Idempotency-Key, never creates a second continuation. |
| 409 | idempotency_key_reused_with_different_payload | The key was already used with a different request. Use a new key. |
| 410 | clarification_expired | The card expired at expiresAt. |
| 428 | missing_idempotency_key | The Idempotency-Key header is missing. |
Code Examples
Use clarificationId and runId from the clarification.required event as $CLARIFICATION_ID and $RUN_ID.
curl -X POST https://api.chainabit.com/api/v1/ai/clarifications/$CLARIFICATION_ID/skip \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: skip-$CLARIFICATION_ID" \
-d "{ \"runId\": \"$RUN_ID\" }"After the answer
The answers become a user message in the conversation, so every client that loads the history sees them, and the assistant reads them like any other reply. The paused reply stays in the history, its status changes from waiting_user to superseded, and its card reads resumed. A skip follows the same path: the recorded user message shows — for each question, and the card also carries disposition: "skipped". The assistant's continuation is a separate reply with its own messageId and runId, and it may ask the next card, so a multi-round activity is a chain of cards, one answer at a time.
While a card is pending the conversation is locked. Sending another message returns 409 with the card to answer:
{
"error": {
"code": "clarification_answer_required",
"message": "Answer the pending clarification before sending another message",
"details": {
"code": "clarification_answer_required",
"message": "Answer the pending clarification before sending another message",
"clarificationId": "00000000-0000-4000-8000-000000000022",
"runId": "00000000-0000-4000-8000-000000000001"
}
},
"meta": { "requestId": "<request-id>" }
}Leaving a card
A user who does not want to answer has two ways out:
- Skip with
POST /ai/clarifications/:clarificationId/skip. The conversation continues: the stream of the paused reply carriesclarification.skippedand thenclarification.superseded, and the assistant replies to the original message as it was written. - Stop the paused reply with
POST /ai/sessions/:sessionId/messages/:assistantMessageId/stop. The run ends with arun.cancelledevent, the card's historystatusbecomescancelled, and the conversation unlocks without a continuation.
A card nobody answers or skips expires at its expiresAt, 24 hours after it was asked. From then on canAnswer is false, answering or skipping returns 410 clarification_expired, and the conversation unlocks so the user can send a new message. Shortly afterwards the server ends the paused run as failed with the code clarification_expired: the stream of the paused reply ends with a run.failed event carrying that code, and the card's history status becomes expired. Decide whether a card can still be submitted from canAnswer, not from status.
Reloading and history
Assistant messages in message history carry their cards in clarifications. The array is durable: after a reload, a reconnect or a new device, a pending card is still there and still answerable.
| Field | Type | Description |
|---|---|---|
clarifications[].status | string | pending, answered, resuming, resumed, resume_failed, expired or cancelled. |
clarifications[].canAnswer | boolean | Whether this card can be submitted now. Only true for a pending card that has not expired and belongs to the caller. |
clarifications[].answers | object[] | The recorded answers. Empty until answered. |
clarifications[].resumeRunId | string | The continuation's run, once answered or skipped. |
clarifications[].disposition | string | skipped when the user skipped the card. Absent otherwise. |
clarifications[].expiresAt | string | ISO 8601 time the card expires. Absent once the card is answered, skipped or expired. |
Render a card from canAnswer, not from status alone, and keep answered cards visible as read-only so the history still shows what was chosen.
Unknown versions
schemaVersion is 1. A client that finds a version higher than it understands must not guess: show the title and reason as text, leave the controls out, and offer to skip the card or stop the run. New fields are added without changing the version, so ignore fields you do not know.
Billing
Showing a card, answering it and skipping it cost nothing by themselves. The continuation that follows an answer or a skip is a new run and is billed like any other turn.
Rendering guidance
- Group each question's options under its text, with one selection for
radioand several forcheckbox. - Keep the submit action unavailable until every
requiredquestion is answered. - Give option rows a comfortable touch target and make the whole card usable from a keyboard.
- Always offer a way to leave the card: Skip to continue without answering, or Stop to end the reply.
- Once
expiresAthas passed, show the card as read-only.