Skip to content

HTTP API

This page is generated from the code of engine version 0.16.0. Between releases, the site shows the code on main, which may already have changes for the next version.

The Pointsman HTTP API. Every request needs an API token in the header Authorization: Bearer <token>. The full description, for tools that read OpenAPI, is openapi.yaml.

Get a decision from a profile.

ParameterInRequiredDescription
profilepathyes
versionquerynoProfile version. The latest version when not given.
Idempotency-KeyheadernoA repeated request with the same key from the same client gets the decision already logged, when the request is the same (profile and version, state, ref, decisions); a different request with the same key is refused (409 idempotency_conflict). Ignored for test tokens, whose decisions are not logged.

Request body: DecideRequest (JSON).

StatusDescriptionBody
200The decisionDecision (application/json)
400ErrorError (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403The token may not use this profile.Error (application/json)
404ErrorError (application/json)
409resolved_by_person: the decision this one would replace was resolved by a person, and a person’s answer stays (docs/decision-chains.md). idempotency_conflict: the Idempotency-Key was used for a different request.Error (application/json)
500ErrorError (application/json)
502ErrorError (application/json)

Get a logged decision with its feedback.

ParameterInRequiredDescription
idpathyes
StatusDescriptionBody
200The decision as loggedDecisionRecord (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403A test token, which may only decide.Error (application/json)
404Unknown decision, or one whose profile this token may not use.Error (application/json)
500ErrorError (application/json)

Correct the answers of a decision.

Corrections are checked against the profile version the decision used. A decision can get feedback more than once; all of it is kept.

ParameterInRequiredDescription
idpathyes

Request body: FeedbackRequest (JSON).

StatusDescriptionBody
204Feedback stored
400ErrorError (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403A test token, which may only decide.Error (application/json)
404Unknown decision, or one whose profile this token may not use.Error (application/json)
409The profile version of the decision is no longer available.Error (application/json)
500ErrorError (application/json)

What happened to a profile’s decisions in the last days.

Counts only, no single decisions or states: decisions per action, the review queue (pending, resolved, the final actions people chose), and decisions where a person corrected at least one answer. The window applies to when a decision was made; a later resolution or correction of such a decision counts with it.

ParameterInRequiredDescription
profilepathyes
daysquerynoThe window, from 1 to 90 days back from now (default 7).
StatusDescriptionBody
200The countsProfileStats (application/json)
400ErrorError (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403The token may not use this profile.Error (application/json)
404Unknown profile.Error (application/json)
500ErrorError (application/json)

List decisions waiting for a human review.

Decisions with action review that are not resolved yet, oldest first (at most 100), for the profiles this token may use.

ParameterInRequiredDescription
profilequeryno
StatusDescriptionBody
200Pending reviewsobject (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403The token may not use this profile, or it is a test token (it may only decide).Error (application/json)
500ErrorError (application/json)

Resolve a pending review.

Sets the final action and answers. Answers in correct replace the model’s (source human); the others are kept (source model). correct is also stored as feedback. When the decision has a callback_url, the final answer is sent there (see “Callbacks”).

ParameterInRequiredDescription
idpathyes

Request body: ResolveRequest (JSON).

StatusDescriptionBody
200ResolvedResolution (application/json)
400ErrorError (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403A test token, which may only decide.Error (application/json)
404Unknown decision, or one whose profile this token may not use.Error (application/json)
409The decision has no pending review (not a review, already resolved, or closed as superseded), or its profile version is gone.Error (application/json)
500ErrorError (application/json)

Close a pending review of your own decision.

The review leaves the queue as superseded, for example when the question it asks no longer applies (the GitHub connector closes the review of an older commit after a push). Only the client that made the decision may close it; for any other token the decision does not exist (404). No body. No callback is sent, and a later resolve gets 409 not_pending.

ParameterInRequiredDescription
idpathyes
StatusDescriptionBody
200ClosedClosedReview (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403A test token, which may only decide.Error (application/json)
404Unknown decision, one whose profile this token may not use, or one another client made.Error (application/json)
409The decision has no pending review (not a review, already resolved, or closed).Error (application/json)
500ErrorError (application/json)

List the profiles this token may use, with their versions.

StatusDescriptionBody
200The profiles this token may use (all profiles for a token with scope *)object (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
500ErrorError (application/json)

The decision graph a profile belongs to, for DMN tools.

The profile, the profiles it requires and the ones that require it (docs/decision-chains.md), among the profiles this token may use, as a DMN decision requirements graph. Only the graph: no decision logic. With format=dmn, DMN 1.3 XML with DMNDI shapes, which DMN tools (bpmn.io dmn-js, Camunda Modeler, Apache KIE) open. Not for test tokens.

ParameterInRequiredDescription
idpathyes
formatquerynojson (the graph), dmn (DMN 1.3 XML with DMNDI) or svg (a small diagram in the style of the datamodels.jp diagrams).
langquerynoThe language of the svg diagram’s text.
StatusDescriptionBody
200The graphDecisionGraph (application/json)
400ErrorError (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403The token may not use this profile (also a test token).Error (application/json)
404ErrorError (application/json)
500ErrorError (application/json)

A profile in plain sentences.

The profile as plain sentences in English or Japanese, for the people who approve it (docs/profile-format.md#explain): which model answers, what it sees, the questions, facts and earlier decisions, and each rule as “If …, the action is …”. The rules are read with the engine’s own parser. A required profile out of this token’s scope is not named, and a rule that reads it is shown as written. Test tokens may use it too: it reads no decisions.

ParameterInRequiredDescription
idpathyes
versionquerynoA published version; the latest when not given.
langqueryno
formatquerynojson (the parts), or text (Markdown, to show as it is).
StatusDescriptionBody
200The explanationProfileExplanation (application/json)
400ErrorError (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403The token may not use this profile.Error (application/json)
404ErrorError (application/json)
500ErrorError (application/json)

Try a changed policy on the logged decisions.

What a changed policy would have decided on the newest logged decisions of a published version (docs/profile-format.md#replay). Policy only: the logged answers and facts are used, no model is called, and questions, facts and requires must stay the same (send them to have them checked). Earlier decisions are read from the snapshot kept with each decision; a new rule that reads a value the snapshot did not keep is unknown there, and the decision is counted as inexact. The token must be allowed to use the profile and every profile it requires. Not for test tokens.

ParameterInRequiredDescription
idpathyes

Request body: object (JSON).

StatusDescriptionBody
200The replayReplayResult (application/json)
400ErrorError (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403The token may not use this profile or a profile it requires (also a test token).Error (application/json)
404ErrorError (application/json)
409The draft’s questions, facts or requires differ from the version (not_policy_only).Error (application/json)
500ErrorError (application/json)
FieldTypeRequiredDescription
statestring | object | arrayyesWhat the model decides about: free text, or any JSON object or array. When the profile has an input mapping, this is the raw client payload the mapping reads from.
refstringnoThe client’s reference for this decision, for example an issue id.
callback_urlstringnoWhere to send the final answer after a human review (https only).
decisionsobjectnoFor a profile with requires (docs/decision-chains.md): the ids of the earlier decisions, by the names in requires. They are read from the decision log and must be of the named profile, in the token’s scope, with this request’s ref (then required) and from the same client; every other case gives the same 400. An optional one that was made for an older decision than one given here is left out (it is missing from requires in the answer). Not for test tokens.

A profile in plain sentences (docs/profile-format.md#explain).

FieldTypeRequiredDescription
profilestringyes
versionintegeryes
lang“en” | “ja”yes
titlestringyes
descriptionstringyes
modelstringyesWhich model answers
inputstringyesWhat the model sees of the request.
questionsstring[]yes
factsstring[]yes
requiresstring[]yes
rulesobject[]yesIn order; the first rule that matches gives the action.
orderstringyesHow the rules are checked.
defaultstringyesThe action when no rule matches
peoplestring[]yesWhich actions a person checks
notesstring[]yes

A changed policy replayed on logged decisions (docs/profile-format.md#replay).

FieldTypeRequiredDescription
profilestringyes
versionintegeryesThe version whose decisions were replayed.
replayedintegeryesDecisions replayed exactly; all other numbers count only these.
fromstring | nullyesThe oldest replayed decision.
tostring | nullyesThe newest replayed decision.
inexactintegeryesDecisions not replayed because a new rule reads a value of an earlier decision that was not kept.
skippedintegeryesDecisions not replayed because an answer the new rules read is not in the log.
changedintegeryesDecisions whose action would change.
actionsobjectyes
transitionsobject[]yes
peopleobjectyes
changesobject[]yesUp to 50 changed decisions, newest first.
FieldTypeRequiredDescription
actionstringyes
ruleinteger | nullyes

A DMN decision requirements graph; node and edge types are DMN’s names.

FieldTypeRequiredDescription
profilestringyesThe profile the graph was asked for.
nodesobject[]yes
edgesobject[]yes

What the rules read from one required decision, when this decision was made.

FieldTypeRequiredDescription
decisionstringyes
profilestringyes
profile_versionintegeryes
actionstringyes
outcomestringyesThe person’s answer when a review was resolved
reviewedbooleanyes
readobjectyesEvery value the rules read from it, by path; null = unknown.

A required decision of a profile the reader may not see.

FieldTypeRequiredDescription
decisionnullyes
FieldTypeRequiredDescription
decision_idstringyes
refstringno
answersobjectyesOne answer per question, keyed by question name.
actionstringyesauto, review, or a custom action defined by the profile.
profilestringyes
profile_versionintegeryes
modelstringyesThe model that answered.
created_atstringyesWhen the decision was made.
ruleinteger | nullyesIndex of the policy rule that matched (from 0); null when the default action applied.
factsFactsnoOnly for profiles with facts (docs/profile-format.md#facts): each fact the profile asked for, by name, as looked up for this decision, or why it is missing. A rule that needs a missing fact does not match.
testtruenoPresent (true) only for a test token’s decision, which is not logged.
requiresobjectnoFor a profile with requires, by name. A required decision of a profile the token may no longer use is hidden.
replacesstringnoThe earlier decision of the same profile, ref and client that this one replaces.
reviewobjectnoPresent when a person checks the decision before it counts (the profile’s people_check).
versionsVersionsnoThe engine version and the fact modules that answered the decision’s facts, with their versions (docs/modules.md). Missing for decisions made before fact modules.

The engine version and the fact modules that answered the decision’s facts, with their versions (docs/modules.md). Missing for decisions made before fact modules.

FieldTypeRequiredDescription
enginestringyes
modulesobjectyesModule name to version, for example “@pointsman/github”.
FieldTypeRequiredDescription
profilestringyes
daysintegeryes
sincestringyesDecisions made at or after this time are counted.
decisionsintegeryes
actionsobjectyesDecisions per action.
reviewsobjectyes
correctedintegeryesDecisions where a person corrected at least one answer (as in docs/accuracy.sql).

Type: see openapi.yaml.

FieldTypeRequiredDescription
decision_idstringyes
created_atstringyes
clientstringyesThe client whose token made the decision.
refstringno
profilestringyes
profile_versionintegeryes
modelstringyes
actionstringyes
ruleinteger | nullyesIndex of the policy rule that matched; null when the default action applied.
answersobjectyes
factsFactsnoOnly for profiles with facts (docs/profile-format.md#facts): each fact the profile asked for, by name, as looked up for this decision, or why it is missing. A rule that needs a missing fact does not match.
state_hashstringyesSHA-256 of the state sent to the model (keys sorted).
statenoThe state sent to the model. Only when the profile sets log.store_state.
reviewReviewnoOnly for decisions whose action a person checks (the profile’s people_check; default review).
requiresobjectnoFor a profile with requires, by name. A required decision of a profile the reader may not see is hidden.
idempotency_keystringnoThe Idempotency-Key the decision was made with.
replacesstringnoThe earlier decision of the same profile
versionsVersionsnoThe engine version and the fact modules that answered the decision’s facts, with their versions (docs/modules.md). Missing for decisions made before fact modules.
discarded_atstringnoMade while a person resolved the decision it would replace; the client got 409 resolved_by_person and it never counts.

Only for decisions whose action a person checks (the profile’s people_check; default review).

FieldTypeRequiredDescription
status“pending” | “resolved” | “superseded”yessuperseded: a newer decision replaced this one while the review was open, or the client that made it closed the review.
resolved_atstringno
resolved_bystringno
final_actionstringno
final_answersFinalAnswersno

Type: object.

Delivery of the final answer to the decision’s callback_url.

FieldTypeRequiredDescription
status“pending” | “delivered” | “failed”yes
attemptsintegeryes
last_errorstringno
next_atstringno
FieldTypeRequiredDescription
actionstringyesThe final action, e.g. auto; not review.
correctobjectnoCorrected answers by question name (as in feedback). Empty or left out to keep the model’s answers.
bystringyes
notestringno
FieldTypeRequiredDescription
decision_idstringyes
actionstringyes
answersFinalAnswersyes
resolved_bystringyes
resolved_atstringyes
callback“pending” | “none”yespending when the final answer will be sent to the callback_url.
FieldTypeRequiredDescription
decision_idstringyes
reviewobjectyes
FieldTypeRequiredDescription
correctobjectyesCorrected values by question name: true/false (noul), an option (choice), a level (score).
bystringyesWho made the correction.
notestringno
FieldTypeRequiredDescription
created_atstringyes
clientstringyes
bystringyes
correctobjectyes
notestringno

Only for profiles with facts (docs/profile-format.md#facts): each fact the profile asked for, by name, as looked up for this decision, or why it is missing. A rule that needs a missing fact does not match.

Type: object | object.

Type: NoulAnswer | ChoiceAnswer | ScoreAnswer.

FieldTypeRequiredDescription
type“noul”yes
valuebooleanyestrue when P(yes) >= 0.5
pProbabilityyes
yesProbabilityyes
FieldTypeRequiredDescription
type“choice”yes
valuestringyesThe most likely option.
pProbabilityyes
probabilitiesProbabilitiesyes
FieldTypeRequiredDescription
type“score”yes
valueintegeryesThe most likely level
pProbabilityyes
scorenumberyesProbability-weighted level; can fall between levels.
probabilitiesProbabilitiesyesProbability per level, keyed by level index.

Type: number.

Type: object.

FieldTypeRequiredDescription
idstringyes
versionintegeryesLatest version.
versionsinteger[]yes
titleBilingualTextyes
descriptionBilingualTextyes
requiresstring[]noThe profile ids the latest version requires (decision chains, docs/decision-chains.md).
FieldTypeRequiredDescription
enstringyes
jastringyes
FieldTypeRequiredDescription
errorobjectyes

An open-source project by Geolonia · About this site