Skip to content

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 ​

  1. Send a message and declare that your client can draw question cards (Opt in).
  2. If the assistant decides a card helps, the run pauses and the stream emits clarification.required with the questions.
  3. Render the questions and let the user select.
  4. Submit the answers with POST /ai/clarifications/:clarificationId/answer, or decline them with POST /ai/clarifications/:clarificationId/skip.
  5. 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:

json
{
  "content": "Quiz me on twenty vocabulary words, one round at a time.",
  "renderCapability": { "surface": "api", "renders": ["question_form"] }
}
FieldTypeDescription
renderCapability.surfacestringOne of web, mobile, desktop, cli, api. Defaults to api.
renderCapability.rendersstring[]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).

json
{
  "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 }
      ]
    }
  ]
}
FieldTypeDescription
clarificationIdstringIdentifies the card. Use it in the answer request.
runIdstringThe paused run. Send it back with the answers.
messageIdstringThe assistant message the card belongs to.
statusstringAlways waiting_user_input on this event.
reasonstringOne short sentence from the assistant introducing the card (≤ 600 characters). Show it above the questions.
titlestringOptional heading, such as a round counter (≤ 120 characters).
schemaVersionnumberVersion of this card format. Currently 1. See Unknown versions.
questionsobject[]One to five questions.
expiresAtstringISO 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:

FieldTypeDescription
idstringStable identifier within the card (≤ 64 characters). Use it in the answer.
questionstringThe question text (≤ 400 characters). Plain text.
inputTypestringradio (choose one), checkbox (choose several) or text (a short written answer).
requiredbooleanWhether the question must be answered.
allowCustomAnswerbooleanWhether the user may write their own answer in customText. Always true for text.
optionsobject[]For radio and checkbox: two to twelve options, each with an id, a label (≤ 200 characters) and recommended. Absent for text.
minimumSelectionsnumberOptional lower bound for checkbox.
maximumSelectionsnumberOptional 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 ​
FieldTypeRequiredDescription
runIdstring (uuid)YesThe runId from the card.
answersobject[]YesOne to twenty entries.
answers[].questionIdstringYesThe question being answered.
answers[].selectedOptionIdsstring[]For choice questionsThe chosen option ids. Exactly one for radio.
answers[].customTextstringNoWritten 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 ​

json
{
  "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"
      }
    }
  }
}
FieldTypeDescription
answersobject[]The validated answers as stored.
resume.resumeRunIdstringThe run that continues the conversation.
resume.messageIdstringThe new assistant message. Attach to its stream to read the continuation.
resume.answerMessageobjectThe user message the answers became: one line per question, N. <question> → <answer>.

Errors ​

StatusCodeMeaning
400bad_requestThe body is malformed, for example an empty answers list.
400missing_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_questionAn answer does not match the card. The card stays pending.
401unauthorizedMissing or invalid token.
404clarification_not_foundNo such card for you. A card that belongs to someone else is indistinguishable from one that does not exist.
409clarification_already_answered, clarification_run_not_waitingThe card was already answered, skipped, stopped or replaced. Submitting again, even with a new Idempotency-Key, never creates a second continuation.
409idempotency_key_reused_with_different_payloadThe key was already used with different answers. Use a new key for the corrected submission.
410clarification_expiredThe card was not answered in time. Cards expire 24 hours after they are asked, at expiresAt.
428missing_idempotency_keyThe 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 ​
FieldTypeRequiredDescription
runIdstring (uuid)YesThe runId from the card.

A card is answered or skipped once. Retrying the identical request with the same key returns the original result.

Response ​

json
{
  "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"
      }
    }
  }
}
FieldTypeDescription
dispositionstringAlways skipped.
answersobject[]One empty entry per question.
resume.messageIdstringThe new assistant message. Attach to its stream to read the continuation.
resume.answerMessageobjectThe user message recorded in the conversation: one line per question, N. <question> → —.

Errors ​

StatusCodeMeaning
400bad_requestThe body is malformed, for example a missing or invalid runId.
401unauthorizedMissing or invalid token.
404clarification_not_foundNo such card for you.
409clarification_already_answered, clarification_run_not_waitingThe card was already answered, skipped, stopped or replaced. Skipping again, even with a new Idempotency-Key, never creates a second continuation.
409idempotency_key_reused_with_different_payloadThe key was already used with a different request. Use a new key.
410clarification_expiredThe card expired at expiresAt.
428missing_idempotency_keyThe 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:

json
{
  "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:

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.

FieldTypeDescription
clarifications[].statusstringpending, answered, resuming, resumed, resume_failed, expired or cancelled.
clarifications[].canAnswerbooleanWhether this card can be submitted now. Only true for a pending card that has not expired and belongs to the caller.
clarifications[].answersobject[]The recorded answers. Empty until answered.
clarifications[].resumeRunIdstringThe continuation's run, once answered or skipped.
clarifications[].dispositionstringskipped when the user skipped the card. Absent otherwise.
clarifications[].expiresAtstringISO 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 radio and several for checkbox.
  • Keep the submit action unavailable until every required question 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 expiresAt has passed, show the card as read-only.

Built with purpose. chainabit.com