API reference

Every endpoint of the Risk API, with the scope it needs, the fields it takes and a real request and response. Base URL https://risk.ausbab-secops.com; send Authorization: Bearer rk_... and Content-Type: application/json on every call. Errors are listed in the overview.

Method and pathScopePurpose
POST /v1/risk/assessrisk:assessScore a login, signup, password reset, value-out or payment
GET /v1/risk/assessments/{assessment_id}risk:assessRead a stored decision back
POST /v1/risk/eventsrisk:eventsReport the outcome of an assessed attempt
POST /v1/risk/labelsrisk:labelsReport ground truth: fraud or legitimate
POST /v1/risk/wallet-eventsrisk:walletRecord ledger events
POST /v1/risk/settlementsrisk:walletRecord the payment provider's settlement lines
POST /v1/risk/merchantsrisk:walletSet a merchant's tier and onboarding date
GET /v1/risk/merchants/{merchant_id}risk:assessIs this merchant's value-out on hold?
POST /v1/risk/payment-eventsrisk:paymentsReport what happened to a payment

POST /v1/risk/assess

Scores one attempt. The event_type picks the kind of decision.

Login, signup and password reset

FieldTypeNotes
event_typestring, requiredlogin, signup or password_reset
ipstring, requiredThe end user's IPv4 or IPv6 address
accountstringUsername, email or your user ID, up to 256 characters. Required for login and password_reset
emailstringSignup only. A signup needs account or email
device_idstringA stable device cookie, up to 128 characters
user_agentstringUp to 512 characters
headersobjectSelected browser headers: accept, accept-language, accept-encoding, sec-ch-ua, sec-ch-ua-mobile, sec-ch-ua-platform, sec-fetch-site, sec-fetch-mode, sec-fetch-dest, origin, referer. Others are ignored

Optional header: Idempotency-Key, up to 128 characters.

Request: POST /v1/risk/assess
{
  "event_type": "login",
  "account": "[email protected]",
  "ip": "203.0.113.10",
  "device_id": "9f3c2a7e-device-cookie",
  "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/131.0 Safari/537.36",
  "headers": {"accept-language": "en-CA,en;q=0.9"}
}
Response 200: POST /v1/risk/assess (shadow mode)
{
  "assessment_id": "ra_01a2347758834f0557d137b39927",
  "score": 3,
  "decision": "allow",
  "reasons": [],
  "policy": {"ruleset_version": 0, "model": "points-v1", "mode": "shadow"},
  "case_id": null,
  "shadow_decision": "allow"
}

In enforce mode, a device trying many accounts from one IP is denied and a case is opened:

Example 200: POST /v1/risk/assess (enforce mode, credential stuffing)
{
  "assessment_id": "ra_01a2347758a00e1dbda70118d8cf",
  "score": 98,
  "decision": "deny",
  "reasons": [
    {
      "code": "DEVICE_MANY_ACCOUNTS",
      "contribution": 51.4,
      "detail": "This device was used with 12 different accounts in 24 hours",
      "evidence": {"distinct_accounts": 12}
    },
    {
      "code": "IP_MANY_USERNAMES",
      "contribution": 43.6,
      "detail": "This IP tried 12 different accounts in 10 minutes",
      "evidence": {"distinct_accounts": 12, "scope": "IP", "window_s": 600}
    }
  ],
  "policy": {"ruleset_version": 1, "model": "points-v1", "mode": "enforce"},
  "case_id": "case_01a2347758a120a0bbf4ec2464c0"
}
Response fieldMeaning
assessment_idra_.... Name it when you report the outcome
score0 to 100. null only when degraded
decisionallow, challenge (step up: MFA or an email code), review (allow but look, or step up) or deny. Always allow in shadow mode
shadow_decisionShadow mode only: what SecOps would have decided
reasonsEach with a code, the points it added (contribution, negative lowers the score), a plain detail and evidence
policyruleset_version, model and mode (shadow or enforce)
case_idSet when a review or deny opened a case (enforce mode)
degradedtrue when the engine failed and answered allow
idempotent_replaytrue when this is the stored answer to a repeated Idempotency-Key

Value-out (wallets)

Ask before airtime, data, a bill payment, a transfer or a withdrawal leaves. Amounts are decimal strings in the currency's major unit, never floats.

FieldTypeNotes
event_typestring, requiredvalue_out
merchant_idstring, requiredYour opaque merchant or wallet ID, up to 128 characters. Never an email address or card number
amountstring, requiredFor example "4500.00"
currencystring, requiredISO 4217, for example NGN
productstring, requiredairtime, data, bill, transfer, withdrawal or other
counterpartystringRecipient phone number or account, up to 64 characters. Pseudonymised on arrival
referencestringUp to 128 characters
Request: POST /v1/risk/assess (value-out)
{
  "event_type": "value_out",
  "merchant_id": "mch_10293",
  "amount": "4500.00",
  "currency": "NGN",
  "product": "airtime",
  "counterparty": "+2348031234567"
}
Response 200: POST /v1/risk/assess (value-out)
{
  "assessment_id": "wa_01a2347a086a870c9e45a0965d07",
  "event_type": "value_out",
  "decision": "allow",
  "step_up": false,
  "score": 22,
  "reasons": [
    {
      "code": "CREDIT_THEN_CASHOUT",
      "contribution": 19.3,
      "detail": "Most of a new credit is being spent on value-out within minutes",
      "evidence": {"credits_in_window": "5000.00", "value_out_in_window": "4500.00", "window_minutes": 30}
    }
  ],
  "policy": {"ruleset_version": 0, "model": "points-v1", "mode": "shadow"},
  "shadow_decision": "allow"
}

decision is allow (ask for a second factor first when step_up is true), hold (don't send; the merchant's value-out is frozen until an analyst releases it) or deny.

Payments

Ask before you send a payment to your processor, then act on recommended_action. Identify the card only by your provider's fingerprint (Stripe card.fingerprint, Braintree unique_number_identifier, Adyen card alias), plus the BIN and issuing country if you have them. Fields not listed here are refused.

FieldTypeNotes
event_typestring, requiredpayment
amount, currencystring, requiredDecimal string and ISO 4217 code
payment_methodobject, requiredtype (card, wallet, bank_transfer, bnpl, other), fingerprint (required for cards), bin (first 6 or 8 digits), country, wallet
order_id, customer_idstringUp to 128 characters. Leave customer_id out for guest checkout
emailstringPseudonymised on arrival
ip, device_idstringThe shopper's IP and device cookie
billing_countrystringISO 3166 two-letter code
shippingobjectcountry and postal_code (pseudonymised)
promo_codestringPseudonymised on arrival
channelstringweb (default), app, phone, pos or other
Request: POST /v1/risk/assess (payment)
{
  "event_type": "payment",
  "order_id": "ord_88121",
  "customer_id": "cus_4410",
  "email": "[email protected]",
  "ip": "203.0.113.10",
  "device_id": "9f3c2a7e-device-cookie",
  "amount": "129.00",
  "currency": "CAD",
  "payment_method": {"type": "card", "fingerprint": "Xt5EWLLDS7FJjR1c", "bin": "453201", "country": "CA"},
  "billing_country": "CA",
  "shipping": {"country": "CA", "postal_code": "M5V 2T6"}
}
Response 200: POST /v1/risk/assess (payment)
{
  "assessment_id": "pa_EfPSS2LVbGMy6DVH",
  "event_type": "payment",
  "score": 3,
  "decision": "allow",
  "recommended_action": "approve",
  "reasons": [],
  "policy": {"ruleset_version": 0, "model": "points-v1", "mode": "shadow"},
  "case_id": null,
  "shadow_decision": "allow"
}

recommended_action: approve (authorise as normal), require_3ds (authorise with 3-D Secure), review (hold the order for an analyst, don't capture) or decline (don't send it to the processor).

GET /v1/risk/assessments/{assessment_id}

Reads a stored login, signup or reset decision back. A decision can take up to a second to become readable.

Response 200: GET /v1/risk/assessments/{assessment_id}
{
  "assessment_id": "ra_01a2347758834f0557d137b39927",
  "event_type": "login",
  "score": 2.9312230751356316,
  "decision": "allow",
  "effective_decision": "allow",
  "mode": "shadow",
  "reasons": [],
  "policy_version": 0,
  "model": "points-v1",
  "created": 1795000000.0
}

decision is what the policy decided; effective_decision is what was returned to you (allow in shadow mode). An unknown ID answers 404 not_found.

POST /v1/risk/events

Reports what happened after an assessment, within one hour. Each outcome is counted once per assessment: a repeat answers 200 with duplicate: true.

FieldTypeNotes
assessment_idstring, requiredFrom the assess response
outcomestring, requiredlogin_succeeded, login_failed, unknown_user, mfa_passed, mfa_failed, account_created, signup_rejected, reset_requested or reset_completed
Request: POST /v1/risk/events
{"assessment_id": "ra_01a2347758834f0557d137b39927", "outcome": "login_succeeded"}
Response 201: POST /v1/risk/events
{"assessment_id": "ra_01a2347758834f0557d137b39927", "outcome": "login_succeeded"}

When the outcome itself is risky, such as a correct password after a run of failures, the response also carries post_auth (score, pre_auth_score, action, reasons, and case_id in enforce mode), and an account.at_risk webhook is sent. An unknown or expired assessment answers 404 unknown_assessment.

POST /v1/risk/labels

Tells SecOps an attempt or identifier turned out to be fraud (a chargeback, a confirmed takeover) or legitimate (a cleared false positive). Labels never change past decisions. Give either assessment_id, or subject_kind and subject.

FieldTypeNotes
labelstring, requiredfraud or legitimate
assessment_idstringThe assessment the label is about
subject_kindstringaccount, email, device or ip
subjectstringUp to 320 characters. Pseudonymised on arrival
sourcestringUp to 40 characters, for example chargeback, support_review or customer_report
Request: POST /v1/risk/labels
{"assessment_id": "ra_01a2347758834f0557d137b39927", "label": "legitimate", "source": "support_review"}
Response 201: POST /v1/risk/labels
{
  "label": "legitimate",
  "subject_kind": "account",
  "assessment_id": "ra_01a2347758834f0557d137b39927",
  "recorded": true
}

POST /v1/risk/wallet-events

Records ledger entries as they are written: one event, or {"events": [...]} with up to 50. Each event_id is recorded once, so retries are safe. Credits are matched against verified inflows (provider callbacks routed through SecOps, settlement lines); a credit still unmatched after an hour is flagged and, in enforce mode, holds the merchant.

FieldTypeNotes
event_idstring, requiredYour ID for this ledger entry
typestring, requiredcredit, transfer_in, debit, transfer_out, value_out, reversal, adjustment or inflow
amount, currencystring, requiredPositive decimal string; the type gives the direction
merchant_idstringRequired except for inflow
balance_afterstringThe merchant's balance after this event, as your ledger has it
sequenceintegerPer-merchant ledger sequence, so out-of-order delivery isn't mistaken for drift
referencestringThe provider's reference (credits, reversals, inflows) or the transfer reference
productstringRequired for value_out
assessment_idstringThe value-out assessment (wa_...) this event carries out
reversal_of, direction, approved_by, provider, counterparty, occurred_atSee the OpenAPI contract
Request: POST /v1/risk/wallet-events
{
  "event_id": "led_88231",
  "merchant_id": "mch_10293",
  "type": "credit",
  "amount": "5000.00",
  "currency": "NGN",
  "reference": "PSK_T685312322670591",
  "balance_after": "5250.00",
  "sequence": 412
}
Response 201: POST /v1/risk/wallet-events
{"event_id": "led_88231", "status": "recorded", "reconciliation": "open", "flags": []}

A batch answers 200 with one result per event, in order. A bad event doesn't fail the others:

Example 200: POST /v1/risk/wallet-events (batch)
{
  "results": [
    {"event_id": "led_1", "status": "recorded", "reconciliation": "n/a", "flags": []},
    {"event_id": "led_2", "status": "error",
     "error": {"code": "invalid_request", "message": "type must be one of ['credit', 'transfer_in', 'debit', 'transfer_out', 'value_out', 'reversal', 'adjustment', 'inflow']"}}
  ]
}

POST /v1/risk/settlements

Sends your payment provider's settlement lines, up to 100 a call (upload bigger files as CSV in the dashboard). Open credits with the same reference and amount are matched on arrival.

Request: POST /v1/risk/settlements
{
  "provider": "paystack",
  "lines": [{"reference": "PSK_T685312322670591", "amount": "5000.00", "currency": "NGN"}]
}
Response 201: POST /v1/risk/settlements
{"provider": "paystack", "lines": 1, "recorded": 1, "matched_credits": 1, "rejected": 0, "errors": []}

POST /v1/risk/merchants

Sets a merchant's tier and onboarding date, used by tier limits and the new-merchant checks. Merchants you never describe are aged from their first event.

Request: POST /v1/risk/merchants
{"merchant_id": "mch_10293", "tier": "2", "onboarded_at": 1790000000}
Response 200: POST /v1/risk/merchants
{"merchant_id": "mch_10293", "tier": "2", "onboarded_at": 1790000000.0}

GET /v1/risk/merchants/{merchant_id}

Says whether a merchant's value-out is on hold. The merchant.hold and merchant.released webhooks tell you when that changes; your admins release holds in the dashboard, with a note.

Response 200: GET /v1/risk/merchants/{merchant_id}
{"merchant_id": "mch_10293", "on_hold": false, "hold": null}

POST /v1/risk/merchant-events

Reports a merchant's onboarding and activation steps: one event, or {"events": [...]} with up to 50. Needs risk:wallet. Each event has an event_id (resending the same one is safe), a merchant_id and a type: application_submitted, step_completed (with step), approved, activation_requested, activated, payout_account_changed (with payout_account), sale, refund or settlement_requested (the last three with amount and currency). approved, activation_requested and activated need actor, the staff member or system that did it. Optional fields: session_id and verified_by.

Activation and settlement requests are scored. SecOps flags a merchant activated without finishing the required steps, approved and activated by the same actor or session, or asking for a settlement with no sales behind it, and in enforce mode puts the merchant's value-out on hold.

Example: a settlement request event
{"event_id": "evt_881", "merchant_id": "mch_10293", "type": "settlement_requested", "amount": "250000.00", "currency": "NGN"}
Example: the settlement assessment
{"event_id": "evt_881", "status": "assessed", "assessment_id": "asm_...", "event_type": "settlement",
 "decision": "hold", "score": 93, "reasons": [{"code": "SETTLEMENT_WITHOUT_SALES", "contribution": 3.1}]}

Other event types answer {"event_id": "...", "status": "stored"}.

GET /v1/risk/merchants/{merchant_id}/lifecycle

Shows how far a merchant got through onboarding and what was flagged at activation. Needs risk:assess.

Example: GET /v1/risk/merchants/{merchant_id}/lifecycle
{"merchant_id": "mch_10293", "applied": true, "steps_completed": ["business_details", "identity", "bank_account"],
 "steps_missing": [], "approved": true, "activated": true, "activation_flags": [],
 "payout_account_set": true}

POST /v1/risk/payment-events

Reports what happened to a payment: one event, or {"events": [...]} with up to 50. Name the payment by its assessment_id within 35 days. Disputes usually come later: send them with card_fingerprint and customer_id (or email) instead. A fraud dispute is a chargeback: the card, customer, device and email are flagged for 180 days and the assessment is labelled fraud.

FieldTypeNotes
event_idstring, requiredYour ID for this event; a charge or dispute ID works
typestring, requiredauthorized, declined, three_ds, refunded or dispute
assessment_idstringThe payment assessment (pa_...). Required within 35 days, except for disputes
decline_categorystringDeclined only: insufficient_funds, generic, incorrect_number, incorrect_cvc, invalid_expiry, lost_or_stolen, fraud_suspected, velocity_exceeded, authentication_required, processing_error or other
three_ds_resultstringpassed, failed or abandoned
dispute_reasonstringfraud, not_received, not_as_described, duplicate, subscription or other
amount, currency, card_fingerprint, customer_id, email, device_idstringWhen they differ from the order, or for disputes
Request: POST /v1/risk/payment-events
{"event_id": "ch_3Pq", "assessment_id": "pa_EfPSS2LVbGMy6DVH", "type": "declined", "decline_category": "incorrect_cvc"}
Response 201: POST /v1/risk/payment-events
{"event_id": "ch_3Pq", "status": "recorded", "type": "declined", "assessment_id": "pa_EfPSS2LVbGMy6DVH"}