DocsReference
HTTP API reference
View as MarkdownEvery call your server can make to Zigbongo, with its fields, limits and error codes. The Node.js and PHP SDKs make these same calls for you; use this page when you call the API directly or want to know exactly what goes over the wire.
Conventions
Base URL
The API lives at https://zigbongo.com/v1, and every path on this page starts with /v1. A dedicated deployment
has its own address: your project's quickstart in the app shows it, and the API is under its /v1.
Call the API from your server only, never from a browser or a mobile app. Anyone holding a key can make every call on this page.
Authentication
Send an API key with every call:
Authorization: Bearer $ZIGBONGO_KEY
Keys start with zb_. Each key belongs to one environment of one project, test or live, and everything a call reads
or writes belongs to that environment: flows, sessions, outcomes and reports are never shared between environments or
projects. You create and revoke keys on your project's page in the app (see
environments and keys). A missing, unknown or revoked key answers 401 unauthorized.
Requests
- Bodies are JSON, sent with
Content-Type: application/json. A body without that header is refused with400 invalid_input. - Field names are camelCase. A field a call doesn't know is refused with
400 invalid_input, so a typo never passes unnoticed. The one exception is the erasure call, which ignores fields it doesn't know. - Optional fields can be left out.
- A request body is at most 2 MiB (2,097,152 bytes); a larger one is
413 body_too_large. Within that, there's no limit on the number of options, nodes, items, inputs or outcomes, or on the length of keys and values, except where this page names one. - Flow keys, node keys and input names travel in paths, so percent-encode them there. A flow key is 1 to 128
characters of
A-Z,a-z,0-9,-,_and.. Node keys, input names and subject ids are any non-empty string. None of them may be.or..: browsers, Node.js and curl drop those from paths....,.aandv2.1are fine.
Answers and errors
A call that works answers 200 (201 where this page says so) with a JSON body. A call that fails answers with this
body:
{ "error": { "code": "invalid_input", "message": "options must not be empty" } }
Act on code; message explains the problem in words. These are the codes, and each call below lists the ones it
can give for its own reasons:
| Status | code |
When |
|---|---|---|
| 400 | invalid_input |
The body, a header or a query parameter is malformed or breaks a rule on this page |
| 400 | invalid_flow |
A flow definition can't be used |
| 401 | unauthorized |
A missing, unknown or revoked key |
| 404 | not_found |
An unknown flow, session, decision, version or node |
| 409 | decision_already_reported |
A decision reported again, differently |
| 409 | session_done |
A registered flow's session has ended |
| 413 | body_too_large |
A body over 2 MiB |
| 429 | rate_limited |
Over a rate limit; see Retry-After |
| 500 | internal |
An unexpected error on our side |
| 503 | starting |
Zigbongo has just restarted and hasn't loaded your keys and flows yet: "Zigbongo is starting; try again shortly"; Retry-After: 1 |
| 503 | overloaded |
Zigbongo is too far behind in storing what it has been sent, such as during a brief outage on our side, so it turns away decide, session, outcome and fallback calls until it catches up: "Zigbongo is overloaded; try again shortly". Nothing of the call is kept; Retry-After: 1 |
| 503 | timeout |
Zigbongo is too busy to answer in time: "Zigbongo is busy; try again shortly"; Retry-After: 1. Never on a decide, session, outcome or fallback call |
| 503 | unavailable |
Zigbongo couldn't take the call for a moment, such as during a restart, or couldn't store it: "Zigbongo couldn't take this call just now; try again shortly", or "Zigbongo is restarting; send this call again"; Retry-After: 1 |
| 503 | report_timeout |
A report took too long to compute; try again shortly |
On a decision call, don't wait for a retry: show your default and report the fallback (see fallbacks).
Every answer carries an X-Request-Id header, which names the call in Zigbongo's logs. Include it when you report a
problem.
Rate limits
Each environment has three allowances, counted per second, so one kind of traffic never holds up another:
| Allowance | Calls | Default limit |
|---|---|---|
decide |
Decide, session start, steps, session events | 1,000 calls a second |
outcomes |
Outcomes (each outcome in a batch counts), fallbacks | 1,000 a second |
other |
Everything else: flows, settings, pause and resume, versions, reports, inputs, erasure; and each new flow, whether a decide makes it or a new definition is registered | 20 a second |
Each allowance holds one second's worth of calls, so a burst up to the limit passes at once, and it refills at the
limit. A call over it answers 429 rate_limited with a Retry-After header in whole seconds (at least 1), and nothing
about it is stored. A batch of outcomes needs one call left, then counts all its outcomes, so the calls after a large
batch may wait. Registering a definition Zigbongo doesn't have yet counts once more against other, whether with
PUT or inline at a session start, and so does a
decide for a flow key Zigbongo hasn't seen, which makes the flow: over other it answers
429, and your default shows. These are the defaults: if your traffic needs more, ask and we can raise an environment's limits. See retries and rate limits.
Idempotency
Every write can be repeated safely, each in its own way:
- Decisions. Send an
Idempotency-Keyheader with each decide, session start and step: 1 to 200 visible ASCII characters, new for each call (a UUID works well). A call repeated with the same key within 30 seconds answers what it answered the first time, with no new effect, whatever the body says: the decision it made, the session it started, the step it gave. A key already used by another call within those 30 seconds answers400 invalid_input. A repeat that reaches another of Zigbongo's servers is decided again; Zigbongo then learns from neither call and counts the session once. The key is also what you name when you report a fallback. - Outcomes.
outcomeIdis unique in the environment. The first report with an id is kept, and a repeat changes nothing, even with another value. A repeat usually answersduplicate, but may answeracceptedwhen it reaches another of Zigbongo's servers or comes more than 10 minutes later; either way it counts once. - Fallbacks. A repeated
requestIdis kept once, and may answerduplicate. - Steps. A step reported again, with the same report, answers what it answered the first time.
- Registration. Registering the same definition again gives the same version.
- Erasure. Erasing a subject again finds nothing and answers zeros.
Ids are kept with the records they belong to, which are deleted 180 days after their last activity. After that, an
old outcomeId counts as new and an old sessionId is unknown.
A person's calls
Each decide, session start, step and session event about a person can carry a Zigbongo-Affinity header: the first
16 hex digits of the SHA-256 of their subjectId in UTF-8, so 7593cd8a644e7f9b for user_8172. It lets Zigbongo
send all of a person's calls to the same server. It's optional and not used yet; the SDKs send it for you.
Timestamps, durations and ids
- Timestamps in answers are RFC 3339 in UTC, with as many fractional-second digits as needed:
2026-10-11T09:30:00.123456Z. Days are UTC days, written2026-10-11. - A timestamp you send (an outcome's
at) is RFC 3339 with a time-zone offset:2026-10-11T11:30:00+02:00or2026-10-11T09:30:00Z. - Durations are ISO 8601, in weeks, days, hours, minutes and seconds:
P1D,P30D,PT6H,P1DT12H,P2W. Years and months are refused, since their length varies, and a duration must be above zero. Answers write days and time only (P14DforP2W). - The ids Zigbongo makes,
sessionIdanddecisionId, are UUIDs. Version numbers are integers from 1.
All endpoints
| Method and path | What it does | Allowance |
|---|---|---|
POST /v1/flows/{flowKey}/decide |
Chooses an option at a decision point | decide |
POST /v1/outcomes |
Reports an outcome | outcomes |
POST /v1/outcomes:batch |
Reports many outcomes | outcomes |
POST /v1/fallbacks |
Reports that you showed your default | outcomes |
PUT /v1/flows/{flowKey} |
Registers a flow definition | other |
GET /v1/flows/{flowKey}/versions |
Lists a registered flow's versions | other |
GET /v1/flows/{flowKey}/versions/{version} |
Reads one version | other |
POST /v1/flows/{flowKey}/sessions |
Starts a session on a registered flow | decide |
POST /v1/sessions/{sessionId}/steps |
Reports a step and gets the next | decide |
POST /v1/sessions/{sessionId}/events |
Ends a session as abandoned | decide |
GET /v1/flows |
Lists your flows | other |
GET /v1/flows/{flowKey} |
Reads a flow's settings and state | other |
PATCH /v1/flows/{flowKey} |
Changes a flow's settings | other |
POST /v1/flows/{flowKey}:pause |
Pauses a flow: everyone sees your default choices | other |
POST /v1/flows/{flowKey}:resume |
Resumes a paused flow | other |
PATCH /v1/flows/{flowKey}/inputs/{input} |
Switches an input off or on | other |
GET /v1/flows/{flowKey}/report |
The flow's lift, both sides (Zigbongo's choices and the holdout), traffic and fallbacks | other |
GET /v1/flows/{flowKey}/report/nodes/{node} |
One decision point in detail | other |
GET /v1/flows/{flowKey}/report/rules |
Learned rules and input types | other |
GET /v1/flows/{flowKey}/report/timeseries |
Both sides per day, per hour or per minute, with the lift to date | other |
POST /v1/subjects:erase |
Erases everything about one person | other |
Decisions
POST /v1/flows/{flowKey}/decide
Asks which option to show at one decision point (a node) of a flow. The first call for a person starts a session: one
run of the flow for that person, however many decision points it has. Later calls in the same run send its
sessionId. The flow is created by its first call, with the default settings (see
PATCH /v1/flows/{flowKey}); creating it counts against the other
rate limit, so a flow key made per person or per order is refused once past it.
Headers: Authorization: Bearer <key>, Content-Type: application/json, and Idempotency-Key (optional, and
recommended: it's how a retry stays one decision, and how a fallback finds its decision).
| Field | Type | Description |
|---|---|---|
subjectId |
string | Your stable id for the person. Required to start a session (without sessionId). On a later call it may be left out; if sent, it must be the session's. |
sessionId |
string | The session to continue, from an earlier answer. Leave it out to start a session. |
node |
string | Required. The decision point's key, the same at every call for it. |
options |
array of objects | Required, at least one. Each is { "key": "..." }: keys non-empty and unique in the call. An option may carry a payload (any JSON), which is accepted and not used. |
default |
string | Required. The key of the option you'd show today. It must be one of options. |
holdoutPercent |
number | Optional, 0 to 100. The share of people who get your default at this node. Remembered for the node until you send another; 5 until you send one. |
inputs |
object | Optional. Context about the person: a flat object of strings, numbers, booleans and nulls (null means unknown). Nested objects and arrays are refused. Inputs add up over a session: a later call's value replaces an earlier one of the same name. See inputs. |
result |
object | Optional, on a call that continues a session: what happened at one of the session's decisions. decisionId is required in it; any other fields (such as answer) are stored as you send them. |
The answer is 200:
| Field | Type | Description |
|---|---|---|
sessionId |
string | The session: send it with the run's later calls and its outcome. |
decisionId |
string | This decision: send it as result.decisionId to report what happened. |
option |
string | The key of the option to show. |
arm |
string | optimised: Zigbongo chose. holdout: the person is in the flow's holdout or this node's, and gets your default. paused: the flow, or the whole environment, is paused, and everyone gets your default. |
Who gets your default:
- The flow's holdout. When a session starts, its person lands in the flow's holdout or not, by the flow's
holdoutPercent(5 by default). A person in it gets your default at every node of the session. The draw is a hash of the subject id, so the same person lands on the same side while the share stays the same. The lift is the outcomes of the customers Zigbongo chooses for against the holdout's (see holdout and lift). - A node's holdout. A further share of people, the node's
holdoutPercent, get your default at that node. - A pause. While the flow is paused, or Zigbongo has stopped choosing for the whole environment (see
terms), every call answers your default with
arm: "paused".
Ordered sets: to let Zigbongo choose the order of a set of items, ask at the same node again within the session,
offering only the items not picked yet. Each pick is learned at its own position: the first at the node, the second at
{node}:2, the third at {node}:3, and the reports list those as decision points of their own.
Each session started counts once towards your monthly sessions (see pricing).
| Status | code |
When |
|---|---|---|
| 400 | invalid_input |
The flow key isn't valid; node is empty, . or ..; options is empty, or a key is empty or repeated; default isn't one of the options; holdoutPercent is outside 0 to 100; an input is nested or its name is empty, . or ..; subjectId is missing or empty when starting a session, is . or .., or isn't the session's; Idempotency-Key isn't 1 to 200 visible ASCII characters; the session belongs to a registered flow (continue it with its steps) |
| 404 | not_found |
sessionId is unknown or belongs to another flow; result.decisionId isn't a decision of this session (a call that starts a session has none yet) |
| 409 | decision_already_reported |
result reports a decision that already has a different result. The same result again changes nothing. |
| 429 | rate_limited |
Over the decide allowance; for a flow key Zigbongo hasn't seen, over other |
The first call of a session:
curl https://zigbongo.com/v1/flows/checkout/decide \
-H "Authorization: Bearer $ZIGBONGO_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 9f164011-c7a2-4f1f-801a-a8397535f96e" \
-d '{
"subjectId": "user_8172",
"node": "upsell",
"options": [{ "key": "none" }, { "key": "annual" }, { "key": "bundle" }],
"default": "none",
"inputs": { "plan": "monthly", "country": "LT" }
}'
{
"sessionId": "2f488bbe-3503-4f46-9191-7bd56e7d8fbc",
"decisionId": "835485ee-cae0-455e-8c3d-4864b6764ced",
"option": "annual",
"arm": "optimised"
}
A later call in the same session, reporting what the person did at the previous decision:
{
"sessionId": "2f488bbe-3503-4f46-9191-7bd56e7d8fbc",
"node": "trial_length",
"options": [{ "key": "7_days" }, { "key": "14_days" }],
"default": "7_days",
"result": { "decisionId": "835485ee-cae0-455e-8c3d-4864b6764ced", "answer": "accepted" }
}
Outcomes
Outcomes are what Zigbongo optimizes: revenue, margin, a renewal, a cancellation, any number. Each flow has one
objective, which says whether higher or lower is better and how a session's outcomes add up (see
PATCH /v1/flows/{flowKey} and sessions and outcomes).
POST /v1/outcomes
Reports one outcome, for a session or for a person.
Headers: Authorization: Bearer <key> and Content-Type: application/json.
| Field | Type | Description |
|---|---|---|
outcomeId |
string | Required, non-empty. Your id for this outcome, such as an invoice id, unique in the environment. |
flowKey |
string | Required. The flow it's for. |
sessionId |
string | The session it belongs to, a session of this flow. Send sessionId or subjectId, not both. |
subjectId |
string | The person it belongs to: it counts for each of their sessions of this flow whose attribution window holds at. Not empty, . or ... |
value |
number | Required. Any finite number: money, a count, 1 for a yes. |
at |
string | Optional. When it happened, as an RFC 3339 timestamp with an offset, from 400 days before Zigbongo receives it to a day after. By default, when Zigbongo receives it. |
An outcome counts for a session when at falls between the session's first decision and the end of its attribution
window: the flow's objective.window (one day by default) after that first decision. Up to a minute before the first
decision still counts, for clocks that differ. Within a session, outcomes add up by the flow's aggregate: sum (the
default), max or last. A session with no outcome by the end of its window counts as 0. An outcome outside every
window is stored and changes nothing.
Outcomes aren't checked against your flows and sessions as they arrive: one for a flow or session Zigbongo doesn't
know is accepted and stored, and changes nothing. So a typo in flowKey isn't refused; the flow's report shows
whether its sessions get their outcomes.
The answer is 200:
{ "outcomeId": "inv_2041", "status": "accepted" }
status is accepted, or duplicate when this outcomeId was reported before. A repeat may also read accepted
(see idempotency); either way it counts once.
| Status | code |
When |
|---|---|---|
| 400 | invalid_input |
outcomeId is empty; flowKey isn't a valid flow key; value isn't a finite number; neither or both of sessionId and subjectId are sent, or subjectId is empty; subjectId is . or ..; at isn't a timestamp with an offset, or is more than 400 days before now or more than a day after |
| 404 | not_found |
sessionId isn't a UUID, so names no session |
curl https://zigbongo.com/v1/outcomes \
-H "Authorization: Bearer $ZIGBONGO_KEY" \
-H "Content-Type: application/json" \
-d '{
"outcomeId": "inv_2041",
"flowKey": "checkout",
"subjectId": "user_8172",
"value": 119.0,
"at": "2026-10-11T09:30:00Z"
}'
POST /v1/outcomes:batch
Reports many outcomes in one call, such as a nightly backfill of renewals.
Headers: Authorization: Bearer <key> and Content-Type: application/json.
| Field | Type | Description |
|---|---|---|
outcomes |
array of objects | Required. Each as POST /v1/outcomes takes it. As many as fit in 2 MiB: about 25,000. |
Each outcome is stored on its own, so one that fails doesn't stop the others. The answer is 200, with one result per
outcome in the order sent:
{
"results": [
{ "outcomeId": "inv_2041", "status": "accepted" },
{ "outcomeId": "inv_2042", "status": "duplicate" },
{ "outcomeId": "inv_2043", "error": { "code": "invalid_input", "message": "at must be within 400 days before now and a day after" } }
]
}
A result has status (accepted or duplicate) or error, with the code and message a single report would have
answered. An outcome that isn't the right shape (a missing or unknown field, a wrong type) fails the whole batch with
400 invalid_input. The batch counts each of its outcomes against the outcomes allowance.
Fallbacks
POST /v1/fallbacks
Reports that you showed your default because a decide, session start or step call timed out or failed. The decisions that call made, if it reached Zigbongo, are never learned from, and the reports count the fallback against the node. A fallback that arrives before its decision is matched when the decision lands. The SDKs send these for you (see fallbacks and timeouts).
Headers: Authorization: Bearer <key> and Content-Type: application/json.
| Field | Type | Description |
|---|---|---|
flowKey |
string | Required, non-empty. The flow of the call. |
requestId |
string | Required, 1 to 200 characters. The Idempotency-Key the call sent. Without one, there's nothing to match. |
node |
string | Optional. The node you asked about, for the reports when the call never reached Zigbongo. |
reason |
string | Optional. Why, in a word, such as timeout, network or http_503, as the SDKs send it. |
The answer is 200:
{ "status": "recorded" }
A requestId reported before is kept once, and may answer { "status": "duplicate" }.
| Status | code |
When |
|---|---|---|
| 400 | invalid_input |
flowKey is empty, or requestId is empty or over 200 characters |
Registered flows
Registering a flow is optional. A registered flow is a definition of its nodes, their options and defaults, and the routes between them. You start a session on it, and each step is one call that reports the step and gets the next, with Zigbongo following the routes. See registered flows.
PUT /v1/flows/{flowKey}
Registers a definition and makes it the flow's current version. The flow is created if it's new. New content becomes
the next version and answers 201; content registered before (once its defaults are filled in) is that version
again and answers 200. Either way, the flow's objective, holdoutPercent and explorationFloor become the
definition's, defaults included, replacing what a PATCH set; retentionDays is kept. Sessions already running stay
on the version they started on. New content counts once more against the other allowance.
Headers: Authorization: Bearer <key> and Content-Type: application/json.
| Field | Type | Description |
|---|---|---|
key |
string | Required. The flow key, the same as in the path. |
objective.direction |
string | Required. maximize or minimize. |
objective.window |
string | Optional. The attribution window, an ISO 8601 duration. P1D by default. |
objective.aggregate |
string | Optional. How a session's outcomes add up: sum (the default), max or last. |
holdoutPercent |
number | Optional, 0 to 100, 5 by default. The flow's holdout. |
explorationFloor |
number | Optional, at least 0 and below 1, 0.02 by default. The smallest share of traffic an option keeps until it's confidently beaten. |
start |
string | Required. The key of the first node. |
nodes |
array of objects | Required, at least one. The nodes, as below. |
Every node has a key (required: non-empty, unique in the flow, not . or ..) and a type, and may have
holdoutPercent (0 to 100: its own holdout, as a decide call's) and optional (below). Each type has fields of its
own:
type |
Decides | Its fields |
|---|---|---|
variant |
Which version of a step to show | options (required), next (required), defaultRules |
branch |
Which node comes next | options (required), each with to (required); defaultRules. No next. |
sequence |
Which item from a set to show next, until all are shown | items (required), defaultOrder (required), next (required). No defaultRules. |
options:[{ "key": "...", "default": true, "payload": ... }]. Keys are non-empty and unique in the node, and exactly one option has"default": true.payloadis any JSON, returned with the step. A branch's options each haveto: the key of the node they lead to, or null to end the flow.itemsanddefaultOrder: a sequence's items are[{ "key": "...", "payload": ... }], anddefaultOrderlists every item's key exactly once. Each step offers the items not shown yet, indefaultOrder, the first of them being the default. The first pick is decided at the node and thek-th at{node}:{k}.next: a node key; null to end the flow; or routing by the step's answer, which Zigbongo follows and never optimizes:{ "byAnswer": { "yes": "injury", "no": null }, "else": "goal" }. The answer isresult.answerat the step: a string as is, a number or boolean as its JSON text ("3","true").elseis required, and takes any other answer, or none.optional:{ "default": "include" }or{ "default": "skip" }. Zigbongo decides whether to show the node, at the decision point{node}:optional, starting from your default. A skipped node costs no round trip: a variant or sequence goes on tonextas with no answer (itselse, when it routes by answer), a branch to where its default option leads.defaultRules: your current rules, as the node's starting point:[{ "when": { "country": "DE", "age": [30, null] }, "option": "14_days" }]. Top to bottom, the first rule whose every condition matches the session's inputs names the default; when none matches, the option marked default is. A condition is a string (an exact text value), a boolean, or[min, max](numbers, both ends included, null for an open end). A missing or null input matches no condition.
An example:
{
"key": "onboarding",
"objective": { "direction": "maximize", "window": "P30D" },
"start": "welcome",
"nodes": [
{
"key": "welcome",
"type": "variant",
"options": [
{ "key": "short", "default": true },
{ "key": "story", "payload": { "slides": 3 } }
],
"next": "plan"
},
{
"key": "plan",
"type": "branch",
"options": [
{ "key": "monthly_first", "to": "trial", "default": true },
{ "key": "annual_first", "to": null }
]
},
{
"key": "trial",
"type": "variant",
"optional": { "default": "include" },
"options": [
{ "key": "7_days", "default": true },
{ "key": "14_days" }
],
"defaultRules": [{ "when": { "country": "DE" }, "option": "14_days" }],
"next": null
}
]
}
The answer, 201 or 200:
| Field | Type | Description |
|---|---|---|
version |
integer | The version number, from 1. |
hash |
string | The SHA-256 of the definition, defaults filled in, in hex. |
createdAt |
timestamp | When this content was first registered. |
registeredAt |
timestamp | When it was last registered. |
current |
boolean | Whether it's the flow's current version: always true here. |
definition |
object | The definition as stored: every setting filled in, the window in normal form. |
| Status | code |
When |
|---|---|---|
| 400 | invalid_input |
The flow key in the path isn't valid; the body isn't JSON |
| 400 | invalid_flow |
The definition can't be used. The message lists every problem found, each naming where it is: key differs from the path's; objective.window isn't a duration; holdoutPercent or explorationFloor is out of range; a node has a missing, unknown or repeated field, or a wrong type; nodes, options or items is empty; a key is empty or repeated; a node hasn't exactly one default option; defaultOrder doesn't list each item once; a rule names an option the node hasn't, tests no input, tests an input named "", . or .., has [null, null], or a minimum above its maximum; start, a next, a to or an answer route names a key that isn't a node; a node can't be reached from start; the nodes form a cycle (a flow is a directed acyclic graph); a node key is . or ..; a node key is another node's decision point ({node}:optional of an optional node, or {node}:2 up to {node}:{n} of a sequence of n items) |
GET /v1/flows/{flowKey}/versions
Headers: Authorization: Bearer <key>.
Lists the flow's versions, oldest first, without their definitions:
{
"current": 2,
"versions": [
{ "version": 1, "hash": "3bfc269594ef649228e9a74bab00f042efc91d5acc6fbee31a382e80d42388fe", "createdAt": "2026-10-01T08:12:44.512830Z", "registeredAt": "2026-10-01T08:12:44.512830Z" },
{ "version": 2, "hash": "9f785dc763e5bbe60963fc4e7ba26152f17de39c5be86eb69dd42e1fbeab3925", "createdAt": "2026-10-09T14:03:10.020114Z", "registeredAt": "2026-10-11T07:55:31.877406Z" }
]
}
current is null when the flow was never registered. 404 not_found for an unknown flow.
GET /v1/flows/{flowKey}/versions/{version}
Reads one version, with its definition. {version} is a version number.
Headers: Authorization: Bearer <key>.
The answer is 200, in the shape PUT answers, where current says whether it's the flow's
current version. 404 not_found for an unknown flow or version.
POST /v1/flows/{flowKey}/sessions
Starts a session on a version of a registered flow, and decides its first step.
Headers: Authorization: Bearer <key>, Content-Type: application/json, and Idempotency-Key (optional: the same
key again within 30 seconds answers the session it started, with no new session; see idempotency).
| Field | Type | Description |
|---|---|---|
subjectId |
string | Required. Your stable id for the person: non-empty, not . or ... |
version |
integer or string | Optional. A version number, or "latest" (the default): the current version. |
flow |
object | Optional. A definition, and the session runs on it. Content Zigbongo already has runs as that version, and nothing is written: it doesn't become the current version or set the flow's settings again, so you can send it with every session. New content is registered as PUT registers it, as the current version, and counts against the other allowance; that start answers once the version is stored, which can take longer than your SDK waits, so the first session with new content may follow the definition's defaults. Not together with version. |
inputs |
object | Optional. As in decide. |
segment |
string | Optional. Short for the input segment; send it one way, not both. |
The answer is 201:
{
"sessionId": "64ead2e3-8890-4ddc-8e93-4339f7ff22e6",
"version": 2,
"arm": "optimised",
"step": {
"decisionId": "10fcadbd-feed-4a71-a0b7-87a4067751aa",
"node": "welcome",
"option": "story",
"arm": "optimised",
"payload": { "slides": 3 }
},
"done": false
}
| Field | Type | Description |
|---|---|---|
sessionId |
string | The session. |
version |
integer | The version it runs on, to its end. |
arm |
string | paused when the flow (or the environment) was paused at the start, holdout when the person is in the flow's holdout (every step gets your default), otherwise optimised. |
step |
object or null | The first step: decisionId, node (the node's key; a sequence's for each of its items), option, arm (each step has its own, since a node can have its own holdout) and payload (the option's, or null). Null when Zigbongo skipped every node to the end. |
done |
boolean | True when the flow has ended. |
| Status | code |
When |
|---|---|---|
| 400 | invalid_input |
subjectId is missing, empty, . or ..; version isn't a number or "latest"; version and flow are both sent; segment is sent both ways; an input is nested or badly named; the flow key isn't valid; Idempotency-Key is malformed, or was used by another call |
| 400 | invalid_flow |
The inline flow can't be used (as for PUT); the version can't run, because a node key is another node's decision point |
| 404 | not_found |
The flow is unknown, has never been registered, or has no such version |
| 429 | rate_limited |
Over the decide allowance; with new flow content, over other |
| 503 | unavailable |
New flow content couldn't be registered within 2 seconds; a later start with it tries again |
POST /v1/sessions/{sessionId}/steps
Reports the session's open step and decides the next one, or ends the session where the flow ends.
Headers: Authorization: Bearer <key>, Content-Type: application/json, and Idempotency-Key (optional, for
fallbacks).
| Field | Type | Description |
|---|---|---|
decisionId |
string | Required. The step you're reporting: the last step's decisionId. |
shown |
boolean | Optional, true by default. False when you didn't show the step's option, such as after a fallback: the decision isn't learned from, nor is the node's inclusion when Zigbongo decided it with this step. The session still routes by Zigbongo's choice. |
result |
object | Optional, {} by default. What happened, stored as you send it. Its answer drives byAnswer routing. |
inputs |
object | Optional. As in decide; added to the session's. |
state |
object | Optional. The run at the step you're reporting, as you keep it: flowKey, version (the session's), subjectId, node and option (the step's), shown (the items of a sequence shown so far at this node, this step's included) and inputs (the session's so far, this call's included). Every field is required in it. The SDKs send it with every step. Zigbongo checks it and doesn't use it yet; a later release will continue the session from it on whichever server takes the call, and require it. |
The answer is 200: { "step": ..., "done": false }, with step as the session start's. At the end of the flow, step
is null and done is true.
A decision reported again with the same shown and result answers what it answered the first time, with no further
effect. A step that reports a decision made more than 30 minutes before finds the session abandoned: it answers
409 session_done, the session ends then, at that step, and you carry on with your defaults or start a new session.
| Status | code |
When |
|---|---|---|
| 400 | invalid_input |
The session runs step by step (continue it with decide); an input is nested or badly named; state is malformed; Idempotency-Key is malformed, or was used by another call |
| 404 | not_found |
The session is unknown; decisionId isn't a step of this session |
| 409 | decision_already_reported |
The step was reported before, with a different shown or result |
| 409 | session_done |
The session has ended, or the step reports a decision made more than 30 minutes before |
POST /v1/sessions/{sessionId}/events
Tells Zigbongo the person left: the session ends, abandoned at its last step.
Headers: Authorization: Bearer <key> and Content-Type: application/json.
| Field | Type | Description |
|---|---|---|
type |
string | Required. abandoned, the only type. |
state |
object | Optional. The run at the step the person left, as for a step. |
The answer is 200:
{
"sessionId": "64ead2e3-8890-4ddc-8e93-4339f7ff22e6",
"status": "abandoned",
"node": "plan",
"endedAt": "2026-10-11T09:41:07.204551Z"
}
node is the step it ended at. endedAt is now, or when the session ended before, such as when a step found it
quiet. Abandoning it again answers the same.
| Status | code |
When |
|---|---|---|
| 400 | invalid_input |
type isn't abandoned; state is malformed; the session runs step by step |
| 404 | not_found |
The session is unknown |
| 409 | session_done |
The session has already finished: it reached the end of the flow |
Flows
GET /v1/flows
Headers: Authorization: Bearer <key>.
Lists the environment's flows, by key:
{
"flows": [
{ "key": "checkout", "status": "learning", "createdAt": "2026-09-14T10:02:31.118204Z", "lastDecisionAt": "2026-10-11T09:29:58.903117Z" },
{ "key": "onboarding", "status": "paused", "createdAt": "2026-10-01T08:12:44.512830Z", "lastDecisionAt": null }
]
}
status is learning or paused. lastDecisionAt is when the flow last made a decision, accurate to about a
minute; null before the first.
GET /v1/flows/{flowKey}
Headers: Authorization: Bearer <key>.
Reads a flow's settings and state:
| Field | Type | Description |
|---|---|---|
key |
string | The flow key. |
status |
string | learning: Zigbongo chooses (the dashboard's "optimizing"). paused: everyone sees your default choices. |
direction |
string | maximize or minimize. |
attributionWindow |
string | The attribution window, an ISO 8601 duration. |
aggregate |
string | sum, max or last. |
holdoutPercent |
number | The flow's holdout. |
explorationFloor |
number | The exploration floor. |
excludedInputs |
array of strings | The inputs switched off, sorted. |
retentionDays |
integer | Days after which inputs and step results are forgotten. |
currentVersion |
integer or null | The version registered last; null for a flow never registered. |
createdAt |
timestamp | When the flow was created. |
lastDecisionAt |
timestamp or null | As in GET /v1/flows. |
snapshot |
object or null | What Zigbongo currently decides from: its version, and createdAt, when Zigbongo last updated it. Null until Zigbongo first updates it. |
nodes |
array of objects | Every decision point seen, by key: key, holdoutPercent (5 when none was set) and createdAt. Includes the points of optional nodes ({node}:optional) and of ordered sets ({node}:2 and on). |
404 not_found for an unknown flow.
PATCH /v1/flows/{flowKey}
Changes a flow's settings. Only the fields you send change. The flow is created if it's new, with these defaults:
maximize, a window of P1D, sum, a 5% holdout, an exploration floor of 0.02 and a retention period of 90 days.
Headers: Authorization: Bearer <key> and Content-Type: application/json.
| Field | Type | Description |
|---|---|---|
objective.direction |
string | maximize or minimize. |
objective.window |
string | The attribution window: an ISO 8601 duration above zero, such as P30D for renewals. |
objective.aggregate |
string | How a session's outcomes add up: sum, max or last. |
holdoutPercent |
number | 0 to 100. The share of people who get your defaults at every node, to measure the lift. |
explorationFloor |
number | At least 0 and below 1. The smallest share of traffic an option keeps until it's confidently beaten. |
retentionDays |
integer | 1 to 36,500. Days after which a session's inputs (from its last call) and step results (from when they were reported) are forgotten. |
The answer is 200, with the flow's settings:
{
"key": "checkout",
"status": "learning",
"direction": "maximize",
"attributionWindow": "P30D",
"aggregate": "sum",
"holdoutPercent": 5.0,
"explorationFloor": 0.02,
"excludedInputs": [],
"retentionDays": 90
}
The fields are as GET answers them. A change applies on every server within a few seconds,
usually about one.
A new window applies to the sessions already open, not only to new ones: with a shorter one, those whose new window
has passed close within seconds; with a longer one, they stay open longer. A session whose window had closed stays
closed. Registering a definition sets the objective, holdoutPercent and explorationFloor back to the definition's.
| Status | code |
When |
|---|---|---|
| 400 | invalid_input |
The flow key isn't valid; a value is outside what the table allows; the window isn't a duration |
POST /v1/flows/{flowKey}:pause
Pauses the flow: within a few seconds, usually about one, every decision in it answers your default, on every server,
with arm: "paused", and those decisions aren't learned from. Sessions that see the flow paused are left out of the lift comparison. See
pausing flows.
Headers: Authorization: Bearer <key>. No body.
The answer is 200, with the flow's settings as PATCH answers them, status paused.
Pausing a paused flow changes nothing. 404 not_found for an unknown flow: pausing doesn't create one.
POST /v1/flows/{flowKey}:resume
Resumes a paused flow: Zigbongo starts choosing again.
Headers: Authorization: Bearer <key>. No body.
The answer is 200, with the flow's settings, status learning. 404 not_found for an unknown flow.
PATCH /v1/flows/{flowKey}/inputs/{input}
Switches an input off, or back on, for the flow, on every server within a few seconds. A switched-off input is left out of every decision from then on, so nothing learns from it; its values are still stored, and counted in the rules report. Any input name works, sent yet or not. The flow is created if it's new.
Headers: Authorization: Bearer <key> and Content-Type: application/json.
| Field | Type | Description |
|---|---|---|
use |
boolean | Required. false switches the input off, true back on. |
The answer is 200:
{ "input": "age", "use": false }
| Status | code |
When |
|---|---|---|
| 400 | invalid_input |
The input name is . or ..; the flow key isn't valid; use is missing or not a boolean |
Reports
Some of a report's numbers are counts Zigbongo keeps, so they trail the calls a little: covers.countedThrough in
the flow report says up to when. "Recent" means today (UTC) and the six days before. Every report answers 404 not_found for an
unknown flow, and may answer 503 report_timeout when it takes too long; try again shortly. See
holdout and lift.
GET /v1/flows/{flowKey}/report
The flow's lift against its holdout, both sides' sessions, traffic per node and option, and fallback rates.
Headers: Authorization: Bearer <key>.
| Field | Type | Description |
|---|---|---|
flowKey |
string | The flow. |
computedAt |
timestamp | When the report was computed. |
direction, aggregate, attributionWindow, holdoutPercent |
The flow's settings. | |
outcome |
string or null | binary when every closed session's outcome is 0 or 1, numeric otherwise; null before any session has closed. |
outcomeOutage |
object or null | Set while the flow's outcomes have stopped arriving, as when a purchase webhook fails: since (timestamp), when it began; usualShare, the share of sessions that usually have an outcome; recentShare, the share since. Zigbongo doesn't learn from the sessions that end meanwhile, so the missing outcomes don't count against the options shown, and keeps choosing from what it had learned. Null otherwise. |
arms.optimised, arms.holdout |
object | Each side's sessions, below. |
lift |
object | The comparison, below. |
fallbacks, recentFallbacks |
object | count: the fallbacks reported; rate: over the decide calls (decisions, plus calls that never reached Zigbongo), null without any. |
nodes |
array of objects | Each decision point, below. |
covers |
object | What the report covers, below. |
Each side, arms.optimised and arms.holdout:
| Field | Type | Description |
|---|---|---|
sessions |
integer | Sessions in the comparison. |
closed |
integer | Sessions whose attribution window has ended: their outcome is final, and no outcome counts as 0. |
pending |
integer | Sessions still in their window, counted neither as 0 nor in the comparison. |
pendingWithOutcome |
integer | Pending sessions with an outcome so far. |
withOutcome |
integer | Closed sessions with an outcome other than 0. |
outcomeRate |
number or null | withOutcome over closed; null while none has closed. |
outcomeSum |
number | The closed sessions' outcomes, added up. |
outcomeMean |
object or null | The mean outcome per closed session, { "estimate", "low", "high" }, with a 95% interval (Wilson for 0 or 1 outcomes, t otherwise). low and high are null until there's an interval; the whole is null while none has closed. |
lift:
| Field | Type | Description |
|---|---|---|
status |
string | collecting (the dashboard's "Gathering data") until each side has 20 closed sessions with an outcome other than 0; then significant ("Clearly better" or "Clearly worse") when the difference's interval excludes zero, not_significant ("No clear difference yet") when it doesn't. |
minimumOutcomes |
number | 20. |
test |
string or null | two_proportions for 0 or 1 outcomes, welch otherwise; null while collecting. |
sequential |
boolean | Always true: the intervals hold however often you read the report, so acting the moment status is significant is sound. |
difference |
object or null | The mean of the customers Zigbongo chooses for (arms.optimised) minus the holdout's, in the outcome's units (for 0 or 1 outcomes, a difference of rates), as { "estimate", "low", "high" }. While collecting, an estimate without an interval, once both sides have closed sessions. |
relative |
object or null | Their mean over the holdout's, minus one, the same way. Its interval comes from the same test as status, so it excludes zero exactly when status is significant. high is null while the holdout's mean is too uncertain to bound the ratio, as with revenue just past 20 outcomes: every value above low is then possible. Null when it can't be computed, such as when the holdout's mean is 0. |
better |
string or null | optimised or holdout, by the flow's direction, once status is significant; null until then. |
Each of nodes:
| Field | Type | Description |
|---|---|---|
node |
string | The decision point. |
holdoutPercent |
number | Its holdout. |
decisions, recentDecisions |
object | Decisions by kind: optimised (Zigbongo chose), holdout, paused. |
fallbacks, recentFallbacks |
object | count and rate, as for the flow. |
inconsistencies |
array of strings | For decision points asked step by step: options_vary when recent sessions were offered different options, default_varies when they had different defaults. Notices, not errors. |
options |
array of objects | Each option's traffic: option, allTime and recent, each { "decisions": { "optimised", "holdout", "paused" }, "share" }, where share is the option's share of the decisions Zigbongo chose at the node (null when there are none). |
covers:
| Field | Type | Description |
|---|---|---|
sessions |
integer | Sessions in the comparison: those that never saw the flow paused. |
pausedSessions |
integer | Sessions left out because they saw it paused. |
firstSessionAt, lastSessionAt |
timestamp or null | The first and last session's start. |
recentFrom |
date | The first day counted as recent. |
countedThrough |
timestamp | The decision counts include everything logged before this instant. |
GET /v1/flows/{flowKey}/report/nodes/{node}
One decision point in detail: what Zigbongo believes about each option, what happened after it, and its traffic per
day. {node} is any decision point the flow lists, such as trial, trial:optional or quiz:2; 404 not_found for
another.
Headers: Authorization: Bearer <key>.
| Query parameter | Type | Description |
|---|---|---|
days |
integer | Optional, 1 to 90, 30 by default: how many days days covers. |
| Field | Type | Description |
|---|---|---|
flowKey, node, computedAt, holdoutPercent |
As in the flow report. | |
model |
string or null | cells for a node learned without inputs, probit for one learned from inputs; null before Zigbongo first updates what it decides from. |
snapshot |
object or null | What Zigbongo decided from, as in the flow's settings: version and createdAt. |
outcome |
string or null | binary or numeric, as in the flow report. |
sessions |
object | allTime and recent: sessions that asked at this point step by step, counted at their first call at it. |
inconsistencies |
array of strings | As in the flow report. |
options |
array of objects | Each option, below. |
days |
array of objects | Its traffic per day (UTC), for the last days days, every day present, today included: each { "date", "options" }, where options lists every option with decisions on any of those days, in key order, each { "option", "decisions": { "optimised", "holdout", "paused" }, "share" }, share being its share of the decisions Zigbongo chose that day (null on a day with none). |
Each option:
| Field | Type | Description |
|---|---|---|
option |
string | The option's key. |
allTime, recent |
object | Its traffic, as in the flow report. |
posterior |
object or null | For a cells node: Zigbongo's belief about the option's outcome, on a 0 to 1 scale (for 0 or 1 outcomes, the rate; otherwise, the outcome's rank among recent positive outcomes): mean, low and high (a 95% interval), trials (the evidence behind it, after older evidence fades, open sessions included) and pBest (the probability that it's the best option). |
predicted |
object or null | For a probit node: rate (the predicted success rate, averaged over the node's recent contexts), low and high (its 95% interval), trials, pBest (the probability that it's the best option on average over those contexts, as rate is) and bestFor (the probability that it's the best option for one of those contexts, picked at random: about the share of people it suits, once Zigbongo is sure). Where an input decides the answer, an option can be best for half the people and still be unlikely to be best on average. rate is over everyone, unlike observed, which counts only the people Zigbongo chose the option for. |
observed |
object or null | What happened after the decisions Zigbongo learned from, once their sessions closed: closed, withOutcome, outcomeRate, outcomeMean ({ "estimate", "low", "high" }, as in the flow report) and dropOff (the share of those sessions that ended at this decision without an outcome). |
offered |
object or null | For decision points asked step by step: allTime and recent, each { "sessions", "share", "asDefault" } (the sessions whose first call here offered the option, their share of the node's sessions, and those in which it was the default), and firstDay and lastDay it was offered. Null when it never was. |
400 invalid_input when days isn't a whole number from 1 to 90.
GET /v1/flows/{flowKey}/report/rules
What Zigbongo found about inputs: each input's type, and for each node learned from inputs, readable rules such as
"for country DE, 14_days is best". See inputs.
Headers: Authorization: Bearer <key>.
| Field | Type | Description |
|---|---|---|
flowKey, computedAt |
As in the flow report. | |
snapshot |
object or null | What Zigbongo decided from, as in the node report; null before Zigbongo first updates it, when nodes is empty. |
inputs |
array of objects | Every input seen or switched off, below. |
nodes |
array of objects | Each node learned from inputs, below. |
Each of inputs:
| Field | Type | Description |
|---|---|---|
input |
string | Its name. |
use |
boolean | False once switched off. |
type |
string or null | number, boolean or text, fixed by its first 1,000 values; null until then. |
observations |
integer | Decisions that carried it (a session's inputs count at each of its decisions). |
byType |
object | The same, by type: { "number": 980, "text": 20 }. |
ignored |
integer | Values of another type since its type was fixed, which learning leaves out. |
lastIgnoredAt |
timestamp or null | When the last of those arrived. |
Each of nodes:
| Field | Type | Description |
|---|---|---|
node |
string | The decision point. |
options |
array of objects | Each option's option, rate, low, high, trials, pBest and bestFor, as predicted in the node report. |
overall |
object or null | The option predicted best on average over everyone: best, and confidence, the probability that it beats the runner-up. |
rules |
array of objects | One per input value: input; equals for a text or boolean value (booleans as "true" and "false"), or from (included) and to (excluded) for a numeric bin learned from the input's values, null for an open end; best, the option predicted best for people with that value; confidence, the probability that it beats the runner-up; standsOut, true when that value changes the answer: best isn't overall's, and confidence is at least 95%, more for an input with many values (1 − 0.2 / values); and options, each with option, rate (the predicted success rate for those people) and support (the evidence behind it). |
combinations |
array of objects | Rules about two inputs together, listed where they point to another option than the single rules would: when (two conditions, each as in a rule; a number's bin here is two of its single bins together), best, confidence and options. |
Switched-off inputs have no rules or combinations.
GET /v1/flows/{flowKey}/report/timeseries
Both sides of the flow per day of the sessions' start (UTC), for the last days days, every day present, today
included; or per hour, for the last hours hours; or per minute, for the last minutes minutes. Each day, hour or
minute carries the lift to date: the comparison over the sessions started up to its end.
Headers: Authorization: Bearer <key>.
| Query parameter | Type | Description |
|---|---|---|
days |
integer | Optional, 1 to 90, 30 by default. |
hours |
integer | Optional, 1 to 72, instead of days: per clock hour (UTC), the current one last. |
minutes |
integer | Optional, 1 to 480, instead of days: per clock minute (UTC), the current one last. |
| Field | Type | Description |
|---|---|---|
flowKey, computedAt |
As in the flow report. | |
from |
date, or timestamp | The first day, or with hours or minutes the first hour's or minute's start. |
days |
array of objects | Each { "date", "optimised", "holdout", "liftToDate" }. Each side has sessions, closed, pending, pendingWithOutcome, withOutcome, outcomeSum, outcomeRate and outcomeMean (a number, without an interval), as in the flow report's two sides (arms). liftToDate is the flow report's lift over the sessions started up to the end of the day, since the flow's first: the last day's is the flow report's. Its interval holds however often you read it, so it holds at every day. |
hours |
array of objects | With hours, instead of days: each { "start", "optimised", "holdout", "liftToDate" }, as a day. |
minutes |
array of objects | With minutes, instead of days: each minute as an hour. |
400 invalid_input when days isn't a whole number from 1 to 90, hours from 1 to 72, minutes from 1 to 480, or
more than one of them is given.
Subjects
POST /v1/subjects:erase
Erases everything Zigbongo holds about one person, in every flow of the environment, at once: their sessions and decisions, the fallbacks reported for those, their outcomes (by session or by subject), every logged event that names them, and their sessions still open for learning, so they're never learned from. What Zigbongo already learned from closed sessions, and the daily counts, stay: they're statistics about no one. The id goes in the body, so no URL, and no log of URLs, ever holds it. See erasing customers.
Headers: Authorization: Bearer <key> and Content-Type: application/json.
| Field | Type | Description |
|---|---|---|
subjectId |
string | Required, non-empty. The person's id, as you sent it. |
The answer is 200, with the stored records it erased:
{ "subjectId": "user_8172", "sessions": 3, "decisions": 7, "outcomes": 2 }
An unknown subject answers zeros, so a repeat is harmless. A call about the person still on its way when the erasure runs isn't counted, and is discarded when it arrives.
Erasure waits for any learning in progress on the person's flows, so it can take up to a minute. Give your HTTP client a
timeout over 60 seconds (the SDKs wait 65). An erasure that gives up part way may have erased some of what it found, so
when the client gives up before the answer, or gets 503 timeout or any other error, erase again: that finishes it.
| Status | code |
When |
|---|---|---|
| 400 | invalid_input |
subjectId is missing or empty |
For AI assistants and agents: every docs page is plain Markdown at its address with .md (this one is /docs/api.md), and llms.txt lists them all.