Responsibilities
Recommended loop
- Create a session once with
POST /v1/sessions. - Call
/nextwith the lateststate_version. - Use
candidates[0], or select another candidate if your product requires it. - After the answer, call
/nextagain withprevious_turn. - Send external information through
/events. Its response carries the pending decision recomputed on the updated state: when it has changed, ask its question instead of the earlier one. - Submit the final outcome through
/feedback.
If your backend restarts, read the session with
GET /v1/sessions/{session_id}. Do not rebuild state from a stale local copy.Choice answers
When your interface displays choices provided by Zelinqa, return theirchoice_id values in structured_answer.choice_ids. This avoids unnecessary semantic interpretation and preserves deterministic mapping.
Prefer structured answers
When your application already knows what an answer means, send that interpretation directly:previous_turn.outcomereports whether the question was answered, left unanswered, or explicitly refused;structured_answer.choice_idssends selections from a closed or semi-open question;client_updates.datasends business data already validated by your system.
client_updates value is applied as structured data. Here the question is open: even with a confirmed data value, the person’s actual answer in user_text is required and may be analyzed by the engine. For a closed or semi-open question, choice_ids alone suffice when the person adds no text; that path may avoid model analysis. Never invent an uncertain value.
outcome describes the result of the question, but does not replace user_text for an answered open question or create business data by itself. Also send structured_answer or client_updates when your system knows the information obtained.HTTP calls with curl
Follow the complete curl example.
API reference
Explore routes, schemas, and response codes.