Hanzo
OpenapiRisk

Teach your organisation's own model from its own events

Learn records a batch of events into the caller organisation's own aggregates and lets its model learn from them. It answers how many it learned from.

POST /v1/risk/learn

Addresshttps://api.hanzo.ai/v1/risk/learn
MethodPOST
OperationriskLearn
AuthAuthorization: Bearer $HANZO_API_KEY

Learn records a batch of events into the caller organisation's own aggregates and lets its model learn from them. It answers how many it learned from.

IT DOES NOT SCORE, AND THAT IS THE POINT. An observation is a value you record; learning is a transformation over observations; a verdict is a query against the result. This op is the first two. [ops.score] is the third, it is pure, and it is the ONE door to a verdict. They were one call, which meant you could not record without training and could not train without being answered — and the model ran twice over every event to produce a verdict the response carried and no caller read.

TO OBSERVE AND JUDGE, COMPOSE THE TWO, and mind the order. Score FIRST, then learn: the score is then the model's opinion of an event it has not yet learned from, which is the question worth asking. The other order answers for a model that has already absorbed the event it is judging.

This is the training path, and there is no job behind it: the model IS a set of mass counters over half-space trees, so learning is an increment and the model is current the instant the last event lands. Nothing from any other organisation is in it, and nothing from this organisation leaves it.

A RETRY IS INERT. The record deduplicates on the event id you send, and an event already in it moves nothing, costs nothing and is not counted — so a client that timed out can send the same batch again and its model holds what it holds. Without an id of your own there is nothing to converge on: two identical bodies are two events.

Request

8 fields, body application/json (required).

FieldInTypeRequiredDescription
eventsbodyriskEvent[]Events are the things that happened, oldest first.
events[].atbodystringAt is when it happened, RFC 3339. Empty means now.
events[].devicebodystringDevice is the device fingerprint, if any.
events[].idbodystringID is the caller's own stable identifier for the event.
events[].kindbodystringKind is whose behaviour this is: person, session or account.
events[].nanobodyintegerNano is the value moved, in nano-USD. Omit it for an event that moves no money: the value features then read BLIND rather than being told the amount was zero,…
events[].peerbodystringPeer is the counterparty, if any.
events[].subjectbodystringSubject is the identifier on that kind.

Response

StatusBodyMeaning
200riskLearnOutok

200 body — 1 field.

FieldInTypeAlwaysDescription
learnedbodyintegerLearned is how many of the events the model actually learned from, and is also what the call is metered at: one screen per event learned from.

Failure carries the platform error shape — see Errors.

Examples

hanzo risk learn

Risk API · All Hanzo APIs · Interactive reference

How is this guide?

On this page