Create label

Records a batch of ground truth against the entities it judges.

POST /v1/label

Addresshttps://api.hanzo.ai/v1/label
MethodPOST
OperationriskLabel
AuthAuthorization: Bearer $HANZO_API_KEY

Records a batch of ground truth against the entities it judges.

Each assertion carries TWO times — when the judged event happened, and when the assertion became knowable — and both are required. The second is what keeps a chargeback that landed in June out of a model that had to decide in February.

It is idempotent on the CONTENT of an assertion, so a webhook that redelivers is safe. It never overwrites: a source that corrects itself later files a NEW assertion, which wins from the moment it became knowable and leaves every earlier observation instant seeing exactly what it saw.

The asserter is stamped from the validated credential and is not a body field.

Request

9 fields, body application/json (required).

FieldInTypeRequiredDescription
labelsbodylabel.riskLabelFact[]—Labels is the batch.
labels[].atbodystring—At is when the judged event happened, RFC 3339.
labels[].confidencebodynumber (double)—Confidence in [0,1].
labels[].dispositionbodystring—Disposition is productive, unproductive, or empty for an explicit unjudged — the AML engine's own vocabulary, verbatim.
labels[].evidencebodystring—Evidence points at the record this conclusion came from: a dispute id, a case id, a decision id.
labels[].kindbodystring—Kind is what the subject is: account, agent, merchant, payout, person, session or transaction.
labels[].seenbodystring—Seen is when this assertion became KNOWABLE, RFC 3339.
labels[].sourcebodystring—Source is who asserted: chargeoff, dispute, case, refund, review or sample.
labels[].subjectbodystring—Subject identifies the thing being judged, in the tenant's own namespace.

Response

StatusBodyMeaning
200label.riskLabelOutok
defaultproblem-detailsrefused

200 body — 9 fields.

FieldInTypeAlwaysDescription
duplicatebodyinteger (int64)—Duplicate is how many members this tenant already held, byte for byte.
mirrorbodystring—Mirror names why the columnar copy did not take this batch, when it did not.
pendingbodyinteger (int64)—Pending is how many assertions the derived copy is still to take.
recordedbodyinteger (int64)—Recorded is how many members became a NEW row in the tenant's record.
refusedbodyinteger (int64)—Refused is how many members failed admission and were NOT recorded.
resultsbodylabel.riskLabelResult[]—Results is per fact, in the order sent, so a caller can retry exactly the members that were refused and can log the content digest of the ones that landed.
results[].idbodystring—ID is the content digest of the assertion — the id a redelivery of the same fact resolves to.
results[].refusalbodystring—Refusal states what was wrong, for the refused.
results[].statusbodystring—Status is recorded, duplicate or refused.

Failure carries the platform error shape — see Errors.

Examples

hanzo label create
import { Configuration, LabelApi } from 'hanzoai';

const api = new LabelApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.riskLabel({ labels: [{"at":"<at>","confidence":0,"disposition":"<disposition>","evidence":"<evidence>"}] });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import LabelApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = LabelApi(client).risk_label(labels=[{"at":"<at>","confidence":0,"disposition":"<disposition>","evidence":"<evidence>"}])
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.LabelAPI.RiskLabel(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, label_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = label_api::risk_label(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.LabelApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new LabelApi(client).riskLabel();
curl -X POST https://api.hanzo.ai/v1/label \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "labels": [
         {
           "at": "<at>",
           "confidence": 0,
           "disposition": "<disposition>",
           "evidence": "<evidence>"
         }
       ]
     }'

Tool label, op riskLabel — POST the JSON-RPC envelope to https://api.hanzo.ai/v1/mcp.

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "label",
         "arguments": {
           "op": "riskLabel",
           "input": {
             "labels": [
               {
                 "at": "<at>",
                 "confidence": 0,
                 "disposition": "<disposition>",
                 "evidence": "<evidence>"
               }
             ]
           }
         }
       }
     }'

Label API · All Hanzo APIs · Interactive reference

Was this page useful?