Score a transaction
const url = 'https://api-staging.asqary.com/v1/score';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"transaction":{"id":"example","type":"loan_application","amount":1,"currency":"example","occurred_at":"2026-04-15T12:00:00Z","channel":"example"},"customer":{"id_hash":"example","bvn_hash":"example","phone_hash":"example"},"device":{"id_hash":"example","platform":"example"},"beneficiary":{"account_hash":"example","bank_code":"example"},"location":{"country":"example","region":"example"},"product":"example","policy_version_id":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api-staging.asqary.com/v1/score \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "transaction": { "id": "example", "type": "loan_application", "amount": 1, "currency": "example", "occurred_at": "2026-04-15T12:00:00Z", "channel": "example" }, "customer": { "id_hash": "example", "bvn_hash": "example", "phone_hash": "example" }, "device": { "id_hash": "example", "platform": "example" }, "beneficiary": { "account_hash": "example", "bank_code": "example" }, "location": { "country": "example", "region": "example" }, "product": "example", "policy_version_id": "example" }'Idempotent on transaction.id: repeating a transaction ID returns the
original decision (200 with Idempotent-Replayed: true) without
recording the transaction again.
Requires the risk:query scope.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Your own request ID (1–128 of letters, digits and . _ : -), echoed back and stored.
Request Bodyrequired
Section titled “Request Bodyrequired”object
object
Your transaction ID; also the idempotency key.
Minor units (kobo for NGN).
Must match the policy’s market (NGN).
Not more than 5 minutes in the future.
object
HMAC-SHA256 of the identifier under your identifier key, lowercase hex.
HMAC-SHA256 of the identifier under your identifier key, lowercase hex.
HMAC-SHA256 of the identifier under your identifier key, lowercase hex.
object
HMAC-SHA256 of the identifier under your identifier key, lowercase hex.
object
HMAC-SHA256 of the identifier under your identifier key, lowercase hex.
object
Test mode only. Score against this exact version.
Responses
Section titled “Responses”Replayed an earlier decision for this transaction ID
object
object
Score points this rule added.
object
object
Example
{ "risk_level": "low", "recommended_action": "approve", "environment": "live"}Headers
Section titled “Headers”The request ID.
Present (true) when an earlier result was returned.
Scored
object
object
Score points this rule added.
object
object
Example
{ "risk_level": "low", "recommended_action": "approve", "environment": "live"}Headers
Section titled “Headers”The request ID.
Malformed request (invalid_request), including unknown fields.
object
Invalid_request, unauthorized, key_expired, key_revoked, forbidden, ip_not_allowed, quota_exceeded, not_found, method_not_allowed, conflict, policy_in_use, policy_active, policy_archived, idempotency_key_reused, validation_failed, rule_not_available, backtest_invalid_rows, backtest_too_large, rate_limited, internal_error
object
object
Example generated
{ "error_code": "example", "message": "example", "retryable": true, "request_id": "example", "details": {}}Missing, invalid, expired or revoked API key.
object
Invalid_request, unauthorized, key_expired, key_revoked, forbidden, ip_not_allowed, quota_exceeded, not_found, method_not_allowed, conflict, policy_in_use, policy_active, policy_archived, idempotency_key_reused, validation_failed, rule_not_available, backtest_invalid_rows, backtest_too_large, rate_limited, internal_error
object
object
Example generated
{ "error_code": "example", "message": "example", "retryable": true, "request_id": "example", "details": {}}Missing scope or role, IP not allowed, or monthly quota exceeded (quota_exceeded).
object
Invalid_request, unauthorized, key_expired, key_revoked, forbidden, ip_not_allowed, quota_exceeded, not_found, method_not_allowed, conflict, policy_in_use, policy_active, policy_archived, idempotency_key_reused, validation_failed, rule_not_available, backtest_invalid_rows, backtest_too_large, rate_limited, internal_error
object
object
Example generated
{ "error_code": "example", "message": "example", "retryable": true, "request_id": "example", "details": {}}validation_failed (details: field errors), rule_not_available, or backtest_invalid_rows.
object
Invalid_request, unauthorized, key_expired, key_revoked, forbidden, ip_not_allowed, quota_exceeded, not_found, method_not_allowed, conflict, policy_in_use, policy_active, policy_archived, idempotency_key_reused, validation_failed, rule_not_available, backtest_invalid_rows, backtest_too_large, rate_limited, internal_error
object
object
Example generated
{ "error_code": "example", "message": "example", "retryable": true, "request_id": "example", "details": {}}Too many requests (rate_limited); retry after Retry-After seconds.
object
Invalid_request, unauthorized, key_expired, key_revoked, forbidden, ip_not_allowed, quota_exceeded, not_found, method_not_allowed, conflict, policy_in_use, policy_active, policy_archived, idempotency_key_reused, validation_failed, rule_not_available, backtest_invalid_rows, backtest_too_large, rate_limited, internal_error
object
object
Example generated
{ "error_code": "example", "message": "example", "retryable": true, "request_id": "example", "details": {}}Headers
Section titled “Headers”Seconds to wait before retrying.
Unexpected error (internal_error, retryable).
object
Invalid_request, unauthorized, key_expired, key_revoked, forbidden, ip_not_allowed, quota_exceeded, not_found, method_not_allowed, conflict, policy_in_use, policy_active, policy_archived, idempotency_key_reused, validation_failed, rule_not_available, backtest_invalid_rows, backtest_too_large, rate_limited, internal_error
object
object
Example generated
{ "error_code": "example", "message": "example", "retryable": true, "request_id": "example", "details": {}}