Corpus API reference

Corpus: API reference

Generated from the Corpus's own OpenAPI document (GET /v1/openapi.json), which is the source of truth. This page renders it; it never restates the contract by hand.

/experts

GETList the published experts in the key's scope

Responses

statusfieldtype
200expertsobject[]
401errorobject
403errorobject
429errorobject
500errorobject

/experts/{name}

GETRead the published version of one expert

Parameters

nameintyperequired
namepathstringyes

Responses

statusfieldtype
200idstring
namestring
descriptionstringnull
versionnumber
graphHashstring
conceptsobject[]
goalsstring[]
401errorobject
403errorobject
404errorobject
429errorobject
500errorobject

/experts/{name}/query

POSTAsk an expert for a goal, given facts

The outcome is data: needs_facts and out_of_scope are 200 responses, not errors. Branch on `outcome`, never invent a conclusion.

Parameters

nameintyperequired
namepathstringyes
Idempotency-Keyheaderstringno

Request body

fieldtyperequired
goalstringyes
factsobjectno
questionstringno

Responses

statusfieldtype
200decisionIdstring
outcome"resolved" | "needs_facts" | "out_of_scope" | "error"
conclusionstringnull
needsobject
reasonstringnull
certaintyobject
expertobject
traceobject[]
traceHashstring
inputHashstring
cachedboolean
401errorobject
403errorobject
404errorobject
422errorobject
429errorobject
500errorobject

/answers

POSTAnswer a question from the documents in the key's tag scope

Every claim cites a document version, a chunk and a quote checked verbatim against it. The outcome is data: needs_facts and out_of_scope are 200 responses, not errors. Answer only with the returned claims; on out_of_scope or needs_facts, never invent one.

Parameters

nameintyperequired
Idempotency-Keyheaderstringno

Request body

fieldtyperequired
questionstringyes
tagsstring[]no

Responses

statusfieldtype
200decisionIdstring
modestring
outcome"resolved" | "needs_facts" | "out_of_scope" | "error"
answerstringnull
claimsobject[]
unansweredstring[]
needsobject
reasonstringnull
confidencenumbernull
traceobject[]
traceHashstring
inputHashstring
cachedboolean
401errorobject
403errorobject
422errorobject
429errorobject
500errorobject

/decisions/{id}

GETRead a logged decision

Parameters

nameintyperequired
idpathstringyes

Responses

statusfieldtype
200decisionIdstring
outcome"resolved" | "needs_facts" | "out_of_scope" | "error"
conclusionstringnull
needsobject
reasonstringnull
certaintyobject
expertobject
traceobject[]
traceHashstring
inputHashstring
cachedboolean
mode"expert" | "knowledge" | "hybrid"
questionstring
goalstringnull
createdAtstring
401errorobject
403errorobject
404errorobject
429errorobject
500errorobject

/decisions/{id}/replay

POSTRe-run a decision against its stored expert version and inputs, or re-check an answer's quotes against its cited versions

Parameters

nameintyperequired
idpathstringyes
Idempotency-Keyheaderstringno

Responses

statusfieldtype
200matchesboolean
divergedAtnumbernull
expectedstring
actualstring
traceobject[]
401errorobject
403errorobject
404errorobject
429errorobject
500errorobject

/documents

GETList or search documents in the key's tag scope

Without `q`, lists the published documents in the key's tag scope ordered by title, `limit` at a time; `next` is the cursor of the following page, or null on the last. Drafts-only documents are not listed.

Parameters

nameintyperequired
typequery"policy" | "decision" | "procedure" | "note"no
tagquerystringno
qquerystringno
titlequerystringno
limitqueryintegerno
cursorquerystringno

Responses

statusfieldtype
200documentsobject[]
nextstringnull
401errorobject
403errorobject
429errorobject
500errorobject

POSTCreate a document with its first draft version

Parameters

nameintyperequired
Idempotency-Keyheaderstringno

Request body

fieldtyperequired
type"policy" | "decision" | "procedure" | "note"yes
languagestringyes
titlestringyes
bodystringyes
tagsstring[]yes

Responses

statusfieldtype
201idstring
type"policy" | "decision" | "procedure" | "note"
languagestring
tagsstring[]
versionobject
401errorobject
403errorobject
422errorobject
429errorobject
500errorobject

/tags

GETList the tags in the key's scope

The names create_document and ask_corpus take as `tags`.

Responses

statusfieldtype
200tagsobject[]
401errorobject
403errorobject
429errorobject
500errorobject

/documents/{id}

GETRead a document: its current version, its version list, its tags

Parameters

nameintyperequired
idpathstringyes

Responses

statusfieldtype
200idstring
type"policy" | "decision" | "procedure" | "note"
languagestring
tagsstring[]
currentVersionobject
versionsobject[]
401errorobject
403errorobject
404errorobject
429errorobject
500errorobject

/documents/{id}/versions

POSTAdd a new draft version to a document

Parameters

nameintyperequired
idpathstringyes
Idempotency-Keyheaderstringno

Request body

fieldtyperequired
titlestringyes
bodystringyes

Responses

statusfieldtype
201versionnumber
statusstring
titlestring
bodystring
publishedAtstringnull
401errorobject
403errorobject
404errorobject
422errorobject
429errorobject
500errorobject

/documents/{id}/versions/{version}

GETRead one version of a document

Parameters

nameintyperequired
idpathstringyes
versionpathintegeryes

Responses

statusfieldtype
200versionnumber
statusstring
titlestring
bodystring
publishedAtstringnull
401errorobject
403errorobject
404errorobject
429errorobject
500errorobject

/documents/{id}/versions/{version}/publish

POSTPublish a draft version, superseding the current one

Parameters

nameintyperequired
idpathstringyes
versionpathintegeryes
Idempotency-Keyheaderstringno

Responses

statusfieldtype
200versionnumber
statusstring
titlestring
bodystring
publishedAtstringnull
401errorobject
403errorobject
404errorobject
422errorobject
429errorobject
500errorobject