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 URL | https://risk.ausbab-secops.com |
| Format | JSON in, JSON out. Content-Type: application/json, bodies up to 16 KB |
| Auth | Authorization: Bearer rk_... (a scoped API key) |
| Plans | Business, Assured and Enterprise, and during a free trial |
| Contract | OpenAPI 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
| Scope | Allows |
|---|---|
risk:assess | POST /v1/risk/assess, GET /v1/risk/assessments/{assessment_id}, GET /v1/risk/merchants/{merchant_id}, GET /v1/risk/merchants/{merchant_id}/lifecycle |
risk:events | POST /v1/risk/events |
risk:labels | POST /v1/risk/labels |
risk:wallet | POST /v1/risk/wallet-events, POST /v1/risk/settlements, POST /v1/risk/merchants, POST /v1/risk/merchant-events |
risk:payments | POST /v1/risk/payment-events |
A key without the scope a route needs gets 403 insufficient_scope.
The basic loop
- Assess before you check the password, create the account, release value or authorise the payment:
POST /v1/risk/assess. - Act on
decision(orrecommended_actionfor payments). - Report what happened:
POST /v1/risk/eventsfor logins, signups and resets,POST /v1/risk/wallet-eventsfor ledger entries,POST /v1/risk/payment-eventsfor payments. - Label confirmed fraud or cleared false positives:
POST /v1/risk/labels.
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"})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
allowwithdegraded: trueand the reasonENGINE_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
| Limit | Value |
|---|---|
| Requests per key | 6,000 a minute |
| Requests per account | 30,000 a minute, across all keys |
| Failed authentications per client IP | 60 a minute |
| Request body | 16 KB |
| Events per batch call | 50 (wallet-events, payment-events) |
| Settlement lines per call | 100 |
| Free trial | 10,000 assessments a month |
Windows are fixed one-minute windows. Every authenticated response carries:
| Header | Meaning |
|---|---|
X-RateLimit-Limit | Requests allowed per minute for this key |
X-RateLimit-Remaining | Requests left in this window |
X-RateLimit-Reset | Unix time the window resets |
X-Request-Id | Quote 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": {
"code": "insufficient_scope",
"message": "this key lacks the risk:wallet scope"
}
}| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | The body failed validation. The message says which field |
| 401 | unauthorized | Missing or invalid API key. Comes with WWW-Authenticate: Bearer |
| 403 | insufficient_scope | The key lacks the scope this route needs |
| 403 | tenant_inactive | The account is not active |
| 403 | plan_required | The account's plan doesn't include account protection |
| 404 | not_found | No such assessment for your account, or no such route |
| 404 | unknown_assessment | An event names an assessment that doesn't exist or has expired |
| 405 | method_not_allowed | Wrong HTTP method for the route |
| 413 | payload_too_large | The body is over 16 KB |
| 415 | unsupported_media_type | The body is not application/json |
| 429 | rate_limited | A rate limit was reached. Wait Retry-After seconds |
| 429 | quota_exceeded | A free trial's monthly allowance is used up |
| 500 | internal_error | Unexpected error. The request ID is in X-Request-Id |
| 503 | unavailable | Decision 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.