SparkientDocs
Api reference

Decisions

POST
/api/v1/decide

Make a single decision.

Authorization

AuthorizationBearer <token>

A 64-character hexadecimal Sparkient API key. Create a key in the Sparkient dashboard and send it as Authorization: Bearer YOUR_API_KEY.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Single decision request payload.

The decision_type field accepts the type name (not UUID). Common aliases type and decision_type_name are also accepted.

Response Body

application/json

application/json

curl -X POST "https://example.com/api/v1/decide" \  -H "Content-Type: application/json" \  -d '{    "decision_type": "string",    "input": {}  }'
{  "decision": "string",  "confidence": 0,  "reason_codes": [    "string"  ],  "escalate": false,  "fallback_used": false,  "rules_triggered": [    "string"  ],  "latency_ms": 0,  "policy_version": "string",  "class_probabilities": {    "property1": 0,    "property2": 0  },  "explanation": "string",  "request_id": "string",  "stage": "string"}
POST
/api/v1/decide/batch

Make up to 50 ordered decisions with per-item error reporting.

Items retain the same sequential billing and quota semantics as individual decisions. Warm classifier work is vectorized in bounded microbatches, then each item runs the authoritative pipeline in request order.

results always matches the request's order and length. A failed item is null and has a corresponding entry in errors with the same zero-based index. A null result is never a business decision and must not be acted on; retry only errors whose retryable field is true.

Authorization

AuthorizationBearer <token>

A 64-character hexadecimal Sparkient API key. Create a key in the Sparkient dashboard and send it as Authorization: Bearer YOUR_API_KEY.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Batch of decision requests (max 50).

Accepts either the canonical {"decisions": [...]} envelope or a bare JSON array [{...}, ...] for convenience.

Response Body

application/json

application/json

curl -X POST "https://example.com/api/v1/decide/batch" \  -H "Content-Type: application/json" \  -d '{    "decisions": [      {        "decision_type": "string",        "input": {}      }    ]  }'
{  "results": [    {      "decision": "string",      "confidence": 0,      "reason_codes": [        "string"      ],      "escalate": false,      "fallback_used": false,      "rules_triggered": [        "string"      ],      "latency_ms": 0,      "policy_version": "string",      "class_probabilities": {        "property1": 0,        "property2": 0      },      "explanation": "string",      "request_id": "string",      "stage": "string"    }  ],  "errors": [    {      "index": 0,      "decision_type": "string",      "code": "string",      "message": "string",      "status_code": 400,      "retryable": true,      "request_id": "string"    }  ]}