HTTP API¶
Every route the service serves, on port 9000 by default. Bodies and replies are JSON. A time is
an ISO-8601 instant such as 2026-05-04T09:00:00Z. A hypothesis is named by its question and its
own identifier, <question>/<hypothesis>, wherever it appears in a body or a query. What a refusal
looks like, and the name of every rule, is on Refusals.
What holds for every route¶
A write is a POST, and nothing else changes anything. There is no PUT, PATCH or DELETE: a
record is never changed or removed, and the one exception, withdrawing text,
is a POST of its own.
- A new record answers
201; the same record sent again answers200. Both bodies are the record as held. A different record under an identifier already held is refused with409. - A record in a reply has what it was sent with, plus
dated,recordedAtandwriter.recordedAtis the service's clock when it accepted the record.writeris who sent it, decided by the service from the connection and never from the request. datedmay be left out, and is then the time recorded. For evidence and for a price observation the field isobservedAt. It is never later than the service's clock.- A field with no value is left out of a reply. A first revision has no
follows; withdrawn evidence has noexcerpt. Nothing is sent asnull. - An identifier is 1 to 64 characters of
[A-Za-z0-9._-], starting with a letter or a digit. A market's is at most 32 and an outcome name at most 16. - Who the caller is decides the writer. Another ankka service is
service:<project>/<name>, a registered machinemachine:<organization>/<name>, and a person through the gateway with a token from an accepted issuerperson:<subject>@<issuer name>. Outside a cluster every caller islocal. A caller through the gateway with no token, or one no accepted issuer signed, is answered401.
curl -s localhost:9000/sources -d '{"id":"regulator","name":"the regulator"}'
{"id":"regulator","name":"the regulator","dated":"2026-10-06T12:11:18.441Z","recordedAt":"2026-10-06T12:11:18.441Z","writer":"local"}
Reading as of a time¶
Every route marked "graph" on this page takes two optional query parameters, each an instant:
| Parameter | The answer holds only records |
|---|---|
asOf |
dated at or before it |
asRecordedBy |
recorded at or before it |
They may be given together. With asOf, a claim is a revised claim only when a claim that revises
it is itself dated by then, and a belief's revision is the last in its line dated by then. An
answer as recorded by a time never changes afterwards, whatever is recorded later with an earlier
date. A source or a holder is registered and not stated, so it is shown beside a record that counts
whenever it was registered itself. Two times on every record explains
both.
A graph route reads the graph database and answers 503 with graph.unavailable when none is
configured or it cannot be reached. Every other route works without it.
Questions¶
| Route | Body | Reply |
|---|---|---|
POST /questions |
{id, statement, hypotheses: [{id, statement}], dated?} |
the question |
POST /questions/{question}/hypotheses |
{id, statement, dated?} |
the question, with the hypothesis added |
GET /questions/{question} |
the question |
A question is opened with at least two hypotheses. A statement is 1 to 500 characters. A hypothesis
can be added later and is never removed; each carries its own dated, recordedAt and writer.
{
"id": "launch",
"statement": "Will Company X launch Product Y this year?",
"hypotheses": [
{"id": "yes", "statement": "it launches this year", "dated": "2026-05-01T09:00:00Z", "recordedAt": "2026-10-06T12:11:18.282Z", "writer": "local"},
{"id": "no", "statement": "it does not launch this year", "dated": "2026-05-01T09:00:00Z", "recordedAt": "2026-10-06T12:11:18.282Z", "writer": "local"}
],
"dated": "2026-05-01T09:00:00Z",
"recordedAt": "2026-10-06T12:11:18.282Z",
"writer": "local"
}
Holders and sources¶
| Route | Body | Reply |
|---|---|---|
POST /holders |
{id, kind, name} |
the holder, with writers: [writer]; the caller is the first |
POST /holders/{holder}/writers |
{writer} |
the holder |
GET /holders/{holder} |
the holder | |
POST /sources |
{id, name} |
the source |
GET /sources/{source} |
the source |
kind is a holder kind the vocabulary names: agent, person, model,
and market for the holder a market speaks as. A name is 1 to 200 characters. Only a writer who
already speaks for a holder may add another, and none is ever removed. A holder and a source take
no dated: each is dated when it is registered.
Evidence¶
| Route | Body | Reply |
|---|---|---|
POST /evidence |
{source, locator, excerpt, author?, publishedAt?, observedAt?} |
the evidence, with its id |
GET /evidence/{evidence} |
the evidence | |
POST /evidence/{evidence}/withdrawal |
{note} |
the evidence, withdrawn; always 200 |
The writer does not choose the id. It is the SHA-256 digest, as 64 hexadecimal characters, of the
source's identifier, the locator and the excerpt, so the same passage from the same place is one
record whoever records it and however often. A locator is 1 to 2,000 characters, an excerpt 1 to
REASONING_EXCERPT_LIMIT (2,000 by default) and an author up to 200. publishedAt is not later
than observedAt. Evidence belongs to no question and no holder.
Withdrawn evidence has no locator, excerpt or author, and carries
withdrawal: {note, writer, at}.
Claims¶
| Route | Body | Reply |
|---|---|---|
POST /claims |
{id, holder, statement, derivesFrom: [evidence], stances: [{hypothesis, stance}], revises?, dated?} |
the claim |
GET /claims/{claim} |
{claim, revisedBy: [claim]} |
|
POST /claims/{claim}/withdrawal |
{note} |
the claim, withdrawn; always 200 |
stance is supports or contradicts. A claim names at least one piece of evidence and takes at
least one stance, at most one on any hypothesis; the hypotheses may belong to different questions.
A statement is 1 to 1,000 characters. revises names one earlier claim. The writer must speak for
the holder.
GET /claims/{claim} wraps the claim: revisedBy lists the claims that revise it, oldest first,
and comes from a view that may lag a write by a moment. Nothing is decided from it.
{
"claim": {
"id": "launch.pending",
"holder": "agent-a",
"statement": "approval is pending and the launch date is uncertain",
"derivesFrom": ["4478a133ed11105e0434c1973dd5511ffe0885dff7b1abf41f9d5c9bf74facdc"],
"stances": [{"hypothesis": "launch/yes", "stance": "contradicts"}],
"dated": "2026-05-04T09:00:00Z",
"recordedAt": "2026-10-06T12:11:18.460Z",
"writer": "local"
},
"revisedBy": ["launch.barrier-gone"]
}
Beliefs¶
| Route | Body | Reply |
|---|---|---|
POST /beliefs/revisions |
{id, holder, hypothesis, probability, restsOn: [{claim, weight?}], follows?, dated?} |
the revision |
GET /beliefs/revisions/{revision} |
the revision | |
GET /beliefs/current?holder=&hypothesis= |
{holder, hypothesis, count, current?} |
|
GET /beliefs/line?holder=&hypothesis=&before=&limit= |
{revisions: [revision], more} |
A belief is one holder's probability for one hypothesis, and is not created by a route of its own:
its first revision creates it. probability and each weight are from 0 to 1. restsOn may be
empty. follows names the belief's current revision and is left out only for the first; a revision
that follows anything else is refused with 409, and the refusal names the current one. A reply
adds n, the revision's place in the line from 1, and sequence, the version the revision is
published at in the graph.
/beliefs/current answers 200 with count: 0 and no current for a belief nobody has stated.
/beliefs/line returns revisions newest first, starting at the current one or at the one before
before (a revision's identifier, exclusive). limit is from 1 to 100 and 50 when left out; more
says whether older revisions remain.
{"id":"agent-a.launch.2","holder":"agent-a","hypothesis":"launch/yes","n":2,"probability":0.61,"restsOn":[{"claim":"launch.barrier-gone"}],"follows":"agent-a.launch.1","dated":"2026-05-11T09:00:00Z","recordedAt":"2026-10-06T12:11:18.567Z","writer":"local","sequence":2}
Answers¶
Every answer is read from the graph, takes asOf and asRecordedBy, and is made of records and
identifiers only: no text in it was generated.
| Route (graph) | Answer |
|---|---|
GET /answers/belief-change?from=&to= |
{from, to, newlyRestedOn: [support], noLongerRestedOn: [support], stillRestedOn: [{support, weightFrom?, weightTo?}], observedBetween: [evidence]} |
GET /answers/belief?holder=&hypothesis= |
{revision?, restsOn: [support]} |
GET /answers/case?hypothesis=&stance= |
{claims: [support], revisedClaims: [support]} |
GET /answers/learned?question=&after= |
{evidence: [evidence], claims: [claim], revisions: [revision]} |
GET /answers/comparison?hypothesis=&a=&b= |
{a: side, b: side, difference?, both: [{support, weightA?, weightB?}], onlyA: [support], onlyB: [support]} |
GET /answers/resting-on-revised?question= |
{beliefs: [{holder, hypothesis, revision, revisedClaims: [support]}]} |
belief-changeexplains why a belief changed.fromandtoare two revisions of one belief, named in either order; revisions of two beliefs are refused, and so is a revision dated or recorded later than the time asked about.observedBetweenis the evidence behind the later revision's claims that was observed after the earlier revision and no later than the later one.beliefis the current revision and what it rests on, or the one current at the time asked about. With no revision by then,revisionis absent,restsOnis empty and the reply is200.caseis the claims taking one stance on a hypothesis, oldest first.stanceissupportsorcontradicts. Claims a later claim revises are inrevisedClaims, apart from the rest.learnedis what is dated later thanafter, which is required, about one question: the claims taking a stance on its hypotheses, the evidence they derive from, and the belief revisions in its hypotheses, each oldest first.comparisonsets two holders' beliefs in one hypothesis side by side.differenceis the gap between the two probabilities, never negative, and absent when either holder has no revision. A market is compared by naming the holder it speaks as. AhypothesisOfBthat differs fromhypothesisis refused: beliefs in two hypotheses are not compared.resting-on-revisedlists the beliefs about a question whose current revision rests on a claim that has since been revised, with those claims.
The shapes in an answer¶
| Shape | Fields |
|---|---|
revision |
id, holder, hypothesis, n, probability, follows?, dated, recordedAt |
claim |
id, holder, statement?, dated, recordedAt, withdrawn, withdrawnAt? |
evidence |
id, source, locator?, excerpt?, author?, publishedAt?, dated, recordedAt, withdrawn, withdrawnAt? |
source |
id, name, dated, recordedAt |
support |
claim, weight?, evidence: [evidence], revisedBy: [claim id], heldBy: [holder id] |
side |
holder, revision?, statesNoReasons |
A support is a claim as a reason: the claim, the weight the revision gave it where it gave one,
each piece of evidence the claim derives from with its source inside it, the claims that revise it,
and the holders whose current revisions rest on it. statesNoReasons is true for a side whose
revision rests on no claims, as a market's always does, and for a side with no revision.
A record in an answer is the record as the graph holds it, so it has no writer, and a withdrawn
claim or piece of evidence has withdrawn: true, withdrawnAt and no text.
curl -s 'localhost:9000/answers/belief?holder=agent-a&hypothesis=launch/yes'
{
"revision": {"id": "agent-a.launch.2", "holder": "agent-a", "hypothesis": "launch/yes", "n": 2, "probability": 0.61, "follows": "agent-a.launch.1", "dated": "2026-05-11T09:00:00Z", "recordedAt": "2026-10-06T12:11:18.567Z"},
"restsOn": [
{
"claim": {"id": "launch.barrier-gone", "holder": "agent-a", "statement": "the approval barrier has gone", "dated": "2026-05-11T09:00:00Z", "recordedAt": "2026-10-06T12:11:18.555Z", "withdrawn": false},
"evidence": [
{
"id": "fcc1d4a2479250e20568ecdf842752940e6927dfca110d39ac7d0585ea2f9b5f",
"source": {"id": "regulator", "name": "the regulator", "dated": "2026-10-06T12:11:18.441Z", "recordedAt": "2026-10-06T12:11:18.441Z"},
"locator": "https://regulator.example/notices/1187",
"excerpt": "Notice 1187: Product Y is approved for sale.",
"publishedAt": "2026-05-11T08:00:00Z",
"dated": "2026-05-11T09:00:00Z",
"recordedAt": "2026-10-06T12:11:18.542Z",
"withdrawn": false
}
],
"revisedBy": [],
"heldBy": ["agent-a"]
}
]
}
Markets¶
| Route | Body | Reply |
|---|---|---|
POST /markets |
{id, question, venue, outcomes: [{outcome, hypothesis}], resolutionCriteria, closesAt, dated?} |
the market, with the holder it speaks as and resolutions: [] |
GET /markets/{market} |
the market, with its resolutions | |
POST /markets/{market}/price-observations |
{outcome, price, observedAt?} |
{revision, added} |
POST /markets/{market}/resolutions |
{id, outcome?, evidence: [evidence], authority, revises?, dated?} |
the market |
GET /markets/{market}/resolution (graph) |
{resolution, hypothesis?, evidence: [evidence]} |
|
GET /markets/{market}/beliefs-at-resolution (graph) |
{resolution, hypothesis?, beliefs: [{holder, hypothesis, revision, resolvedTo}]} |
Opening a market registers the holder it speaks as, market.<market>, of kind market, spoken for
by the writer who opened it. A market offers at least one outcome, each for one hypothesis of its
own question. A venue and an authority are 1 to 200 characters and the resolution criteria 1 to
2,000.
A price observation is a revision of the belief of the market's holder in that outcome's
hypothesis, resting on no claims. Its identifier is <market>.<outcome>.<observedAt in
milliseconds>, so the same observation sent twice is one revision. added is false, and the
status 200, when the observation was already held or the price had not moved from the current
one; revision is then the current revision. An observation later than closesAt is refused.
A resolution names at least one piece of evidence. With no outcome it is void. revises names
the market's current resolution and is left out only for the first.
The two graph reads take asOf and asRecordedBy. resolution answers with the market's current
resolution, the hypothesis it came to, and its evidence with sources; a market with no resolution
is answered 404 with market.not-resolved. beliefs-at-resolution gives, for each hypothesis
the market offers, each holder's last revision dated no later than the resolution, the market's own
among them, and resolvedTo says whether that hypothesis is the one the market came to. A
resolution in a reply is {id, outcome?, void, authority, dated, recordedAt}.
For the market launch-market on the launch example's question, as
Markets and resolutions records it:
curl -s localhost:9000/markets/launch-market/beliefs-at-resolution
{
"resolution": {"id": "second", "outcome": "YES", "void": false, "authority": "the Lantern exchange", "dated": "2026-10-01T12:00:00Z", "recordedAt": "2026-10-06T12:13:55.416Z"},
"hypothesis": "launch/yes",
"beliefs": [
{
"holder": "agent-a",
"hypothesis": "launch/yes",
"revision": {"id": "agent-a.launch.2", "holder": "agent-a", "hypothesis": "launch/yes", "n": 2, "probability": 0.61, "follows": "agent-a.launch.1", "dated": "2026-05-11T09:00:00Z", "recordedAt": "2026-10-06T12:11:18.567Z"},
"resolvedTo": true
},
{
"holder": "agent-b",
"hypothesis": "launch/yes",
"revision": {"id": "agent-b.launch.1", "holder": "agent-b", "hypothesis": "launch/yes", "n": 1, "probability": 0.43, "dated": "2026-05-12T09:00:00Z", "recordedAt": "2026-10-06T12:12:44.625Z"},
"resolvedTo": true
},
{
"holder": "market.launch-market",
"hypothesis": "launch/yes",
"revision": {"id": "launch-market.YES.1778601600000", "holder": "market.launch-market", "hypothesis": "launch/yes", "n": 2, "probability": 0.55, "follows": "launch-market.YES.1778083200000", "dated": "2026-05-12T16:00:00Z", "recordedAt": "2026-10-06T12:13:40.743Z"},
"resolvedTo": true
}
]
}
Runs and versions¶
| Route | Body | Reply |
|---|---|---|
POST /process/runs |
{blueprint, runId, input} |
the run: {id, blueprint, version, startedBy, dated, recordedAt, writer}; 200 when the same run is held |
GET /process/runs/{run} |
{run, ending?, acts: [act]} |
|
GET /process/runs/{run}/acts |
{acts: [act]} |
|
GET /process/acts/{act} |
the act | |
GET /process/acts?record=<kind>:<id> |
{act?}: the act of a piece of evidence, a claim or a revision; {} for a record no run wrote |
|
POST /process/appraiser/versions |
{instructions} |
{blueprint, version, dated}; 201 for a new version, 200 when the instructions are the current version's |
GET /process/appraiser/versions |
{versions: [{blueprint, version, digest, dated}]} |
|
GET /process/appraiser/versions/{n} |
the version, with the whole blueprint as ankka holds it under blueprint |
POST /process/runs answers once ankka has accepted the run, which then goes on without the
caller; dated is when ankka started it and startedBy the caller. blueprint is appraiser,
the one the service carries. runId is an identifier of at most 47 characters not starting
schedule:. input is checked against the blueprint's input shape before the run starts, and its
holder must be held and spoken for by the blueprint. A run ends with an ending,
{run, status, reason?, dated, recordedAt, writer}, where status is completed or failed.
An act is {id, run, step, worker, blueprint, version, record: {kind, id}, holder, dated, recordedAt,
writer}. The writer of a run, a run ending and a version is the service, service:reasoning; the
writer of an act is the blueprint, blueprint:appraiser. A run's acts and a record's act come
from a view that may lag a write by a moment. instructions is v1 or v2.
Run a blueprint shows each reply.
Answers with acts¶
Every route under /answers, and a market's two graph reads, is served again under /process,
with the same parameters, asOf and asRecordedBy included. The reply is {answer, acts}:
answer is the lower route's reply, unchanged, and acts has one entry for every record in it
that has an act.
| Route (graph) | answer is |
|---|---|
GET /process/answers/belief-change?from=&to= |
GET /answers/belief-change |
GET /process/answers/belief?holder=&hypothesis= |
GET /answers/belief |
GET /process/answers/case?hypothesis=&stance= |
GET /answers/case |
GET /process/answers/learned?question=&after= |
GET /answers/learned |
GET /process/answers/comparison?hypothesis=&a=&b= |
GET /answers/comparison |
GET /process/answers/resting-on-revised?question= |
GET /answers/resting-on-revised |
GET /process/markets/{market}/resolution |
GET /markets/{market}/resolution |
GET /process/markets/{market}/beliefs-at-resolution |
GET /markets/{market}/beliefs-at-resolution |
GET /process/answers/run?run= |
{run, ending?, wrote: [{act, record: {kind, id}}]}: everything the run wrote, from the graph |
An entry of acts is {record: {kind, id}, act, run, runEnding?, blueprintVersion}, where act
is {id, step, worker, recordKind, dated, recordedAt}, run and runEnding are the records
without their writer, and blueprintVersion is {id, blueprint, version, digest, dated, recordedAt}.
An act is shown for a record that counts at the time asked about whenever the act itself was
recorded: it is the record's provenance, as a source is shown beside evidence. A run the graph does
not hold is 404 with record.not-held.
The graph¶
| Route | Body | Reply |
|---|---|---|
POST /graph/wait |
{kind, id, limitMs?} |
{caughtUp, waitedMs, missing: [element key]} |
GET /graph/vocabulary |
{layers: [{name, nodes, edges, holderKinds}]} |
/graph/wait answers once the graph holds a record's node and every edge the record stated, at the
record's version or later, or once the limit has passed. An edge counts only when the record it
points to is in the graph too, so a reader who has waited for a record can follow every link from it. kind is question, holder, source,
evidence, claim, revision, market, run, run-ending, act or blueprint-version, the
last with the identifier <blueprint>@<n>; a resolution is waited for through its market, and a
price observation as the revision it is. A wait for a record a run wrote waits for that record and
not for its act, which has a key of its own. limitMs is 5,000 when left out and at most
REASONING_WAIT_LIMIT_MAX_MS (30,000 by default). Passing the limit is a 200 with
caughtUp: false and the keys of the elements still missing, never an error, and says nothing
about whether the record is held: it is. A record that is not held is a 404. With no broker or no
graph database configured the route answers 503.
curl -s localhost:9000/graph/wait -d '{"kind":"revision","id":"agent-a.launch.2"}'
{"caughtUp":true,"waitedMs":1926,"missing":[]}
/graph/vocabulary serves the graph vocabulary as JSON, three layers,
belief, market and process: for each layer its
kinds of node (label, id, properties, publishedBy), its kinds of edge (type, from, to,
properties, publishedBy) and its holder kinds. A property is {name, type, optional}, where
type is text, number, whole number or flag.