Risk API overview

The Risk Assessment API scores your own sign-in, signup and password-reset attempts, wallet value-out and card payments, and tells you why. Call it from your backend before you act, then report what happened so the next decision is better.

Base URLhttps://risk.ausbab-secops.com
FormatJSON in, JSON out. Content-Type: application/json, bodies up to 16 KB
AuthAuthorization: Bearer rk_... (a scoped API key)
PlansBusiness, Assured and Enterprise, and during a free trial
ContractOpenAPI 3.1, docs/risk-api.openapi.yaml in the SecOps repository

Create an API key

Tenant admins create keys in Settings › Account protection › Risk API keys and webhook: give the key a label (for example login-service), tick its scopes and click Create key. Create one key per backend service, with only the scopes that service needs, so revoking one never breaks the others.

  • A key looks like rk_<key id>_<secret>. It is shown once, when it is created. SecOps stores only a SHA-256 hash of it.
  • The key ID (16 hex characters) is not secret; it appears in the dashboard and the audit trail.
  • Revoke a key from the same panel. Every edge server stops accepting it within 30 seconds.
  • Up to 20 active keys per account.
  • Your account is identified by the key. Never send a tenant ID.

Scopes

ScopeAllows
risk:assessPOST /v1/risk/assess, GET /v1/risk/assessments/{assessment_id}, GET /v1/risk/merchants/{merchant_id}, GET /v1/risk/merchants/{merchant_id}/lifecycle
risk:eventsPOST /v1/risk/events
risk:labelsPOST /v1/risk/labels
risk:walletPOST /v1/risk/wallet-events, POST /v1/risk/settlements, POST /v1/risk/merchants, POST /v1/risk/merchant-events
risk:paymentsPOST /v1/risk/payment-events

A key without the scope a route needs gets 403 insufficient_scope.

The basic loop

  1. Assess before you check the password, create the account, release value or authorise the payment: POST /v1/risk/assess.
  2. Act on decision (or recommended_action for payments).
  3. Report what happened: POST /v1/risk/events for logins, signups and resets, POST /v1/risk/wallet-events for ledger entries, POST /v1/risk/payment-events for payments.
  4. Label confirmed fraud or cleared false positives: POST /v1/risk/labels.
Assess a login, act, report (Python)
import uuid
import requests

RISK = "https://risk.ausbab-secops.com"
HEADERS = {"Authorization": f"Bearer {RISK_KEY}"}

def check_login(username, client_ip, device_id, user_agent, accept_language):
    try:
        r = requests.post(f"{RISK}/v1/risk/assess", timeout=0.3,
                          headers={**HEADERS, "Idempotency-Key": str(uuid.uuid4())},
                          json={"event_type": "login", "account": username, "ip": client_ip,
                                "device_id": device_id, "user_agent": user_agent,
                                "headers": {"accept-language": accept_language}})
        r.raise_for_status()
        return r.json()
    except requests.RequestException:
        return {"decision": "allow", "assessment_id": None}   # fail open

result = check_login(...)
if result["decision"] == "deny":
    ...  # refuse with a generic message
elif result["decision"] in ("challenge", "review"):
    ...  # step up: MFA or an email code
# after the password check:
if result["assessment_id"]:
    requests.post(f"{RISK}/v1/risk/events", headers=HEADERS, timeout=0.3,
                  json={"assessment_id": result["assessment_id"], "outcome": "login_succeeded"})
Assess a login (Node.js 18+)
const RISK = "https://risk.ausbab-secops.com";

async function checkLogin({ username, ip, deviceId, userAgent }) {
  try {
    const res = await fetch(`${RISK}/v1/risk/assess`, {
      method: "POST",
      headers: {
        Authorization: `Bearer ${process.env.SECOPS_RISK_KEY}`,
        "Content-Type": "application/json",
        "Idempotency-Key": crypto.randomUUID(),
      },
      body: JSON.stringify({ event_type: "login", account: username, ip, device_id: deviceId, user_agent: userAgent }),
      signal: AbortSignal.timeout(300),
    });
    if (!res.ok) throw new Error(`risk API ${res.status}`);
    return await res.json();
  } catch {
    return { decision: "allow", assessment_id: null }; // fail open
  }
}

Rules every integration should follow

  • Send the end user's IP address, not your server's.
  • Never send passwords, card numbers or security codes. Card-number patterns are refused with 400. Identify a card by your payment provider's fingerprint.
  • Report outcomes within one hour. unknown_user (no such account) matters for credential-stuffing detection.
  • Use short timeouts (300 ms for logins) and fail open on timeouts and 5xx, so SecOps can never lock your users out. For value-out, decide in advance what your business accepts; most wallet operators queue and retry.
  • If SecOps itself is degraded, assess still answers allow with degraded: true and the reason ENGINE_DEGRADED.

Shadow mode

Every new account starts in shadow mode: decision is always allow, policy.mode is shadow, and shadow_decision shows what SecOps would have decided. Switch to enforce in Settings › Account protection › Rules when you are happy with what you see. See Monitor, shadow and enforce.

Idempotency

Send an Idempotency-Key header (any string up to 128 characters) on POST /v1/risk/assess. A retry with the same key within 24 hours returns the first answer, with idempotent_replay: true, and is not counted again. Ledger and payment events use their own event_id instead: each is recorded once, and a repeat answers duplicate.

Rate limits and usage

LimitValue
Requests per key6,000 a minute
Requests per account30,000 a minute, across all keys
Failed authentications per client IP60 a minute
Request body16 KB
Events per batch call50 (wallet-events, payment-events)
Settlement lines per call100
Free trial10,000 assessments a month

Windows are fixed one-minute windows. Every authenticated response carries:

HeaderMeaning
X-RateLimit-LimitRequests allowed per minute for this key
X-RateLimit-RemainingRequests left in this window
X-RateLimit-ResetUnix time the window resets
X-Request-IdQuote it when you contact support

Over a limit, the answer is 429 rate_limited with Retry-After in seconds. During a free trial, assessments past the monthly allowance answer 429 quota_exceeded, with Retry-After running to the start of next month (UTC). Paid plans are never cut off: assessments above the plan's included amount are billed per 1,000, and the Account protection tab shows this month's count. Idempotent replays are not counted.

Errors

Every error has the same shape:

Error body
{
  "error": {
    "code": "insufficient_scope",
    "message": "this key lacks the risk:wallet scope"
  }
}
StatusCodeMeaning
400invalid_requestThe body failed validation. The message says which field
401unauthorizedMissing or invalid API key. Comes with WWW-Authenticate: Bearer
403insufficient_scopeThe key lacks the scope this route needs
403tenant_inactiveThe account is not active
403plan_requiredThe account's plan doesn't include account protection
404not_foundNo such assessment for your account, or no such route
404unknown_assessmentAn event names an assessment that doesn't exist or has expired
405method_not_allowedWrong HTTP method for the route
413payload_too_largeThe body is over 16 KB
415unsupported_media_typeThe body is not application/json
429rate_limitedA rate limit was reached. Wait Retry-After seconds
429quota_exceededA free trial's monthly allowance is used up
500internal_errorUnexpected error. The request ID is in X-Request-Id
503unavailableDecision storage is down; SecOps never decides without an audit record. Retry after Retry-After, and fail open

Responses are never cached (Cache-Control: no-store).

Next: the API reference lists every endpoint with request and response examples.