> Test fraud scoring in shadow mode with the RiskCogs API: SDK, server score call, feedback and webhooks—without blocking payments.

# Shadow-mode fraud scoring API quickstart

This quickstart walks through a first shadow-mode score on the live RiskCogs R1 hosts: load the browser SDK, call POST /v1/risk-score from your server with shadowMode true, store riskId, and optionally send chargeback feedback and webhooks. Keys are issued per pilot.

Updated 20 November 2026 · RiskCogs team

 ![Dark RiskCogs illustration: shadow-mode API quickstart with browser SDK and server score call.](https://riskcogs.com/docs/shadow-quickstart/hero.webp)

## Key facts

- Keys are issued per pilot: pub_YOUR_PUBLISHABLE_KEY for the browser SDK, pr_YOUR_SECRET_KEY for server calls only.
- Scores use a 0–1 risk_score scale; recommendations are still returned in shadow mode but you should not block payments yet.
- Send outcomes to POST /v1/risk-feedback with the same pr_ key so models learn from chargebacks and refunds.
- Public R1 hosts: r1-api (server API), r1-collect (browser intake), r1-sdk (CDN), r1-office (merchant console).

## Hosts you will call

Use the server API and feedback from your backend with a pr_ key. Do not put a pr_ key in a page or mobile app. A pub_ key works only on the intake allow-list.

- Server API — https://r1-api.riskcogs.com — POST /v1/risk-score, POST /v1/risk-feedback, OpenAPI /openapi.json
- Browser intake — https://r1-collect.riskcogs.com — SDK endpoint (pub_ allow-list)
- SDK CDN — https://r1-sdk.riskcogs.com — versioned riskcogs.js
- Merchant console — https://r1-office.riskcogs.com — keys, webhooks, billing overview

## Load the browser SDK

Package @fraud/sdk-browser v0.2.1. Restrict the publishable key to your checkout origins (scheme + host, no path).

Browser

```
<script type="module" src="https://r1-sdk.riskcogs.com/v0.2.1/riskcogs.js" integrity="sha384-4KODFhTRC7Zm9/yfJA+GEfbKUJGaKrY4O+jn+hbASkvEK/6sRToIaY78wwhShCEQ" crossorigin="anonymous"></script>
<script type="module">
  const sdkUrl = "https://r1-sdk.riskcogs.com/v0.2.1/riskcogs.js";
  const { RiskCogs } = await import(sdkUrl);
  const risk = await RiskCogs.init({
    endpoint: "https://r1-collect.riskcogs.com",
    publicKey: "pub_YOUR_PUBLISHABLE_KEY",
  });
  const { sessionId } = await risk.getContext();
</script>
```

## Authenticate API calls

All public API calls use the X-API-Key header (not Authorization). Optional X-Client-Id must match the key tenant.

Server env

```
export RISKCOGS_SECRET_KEY='pr_YOUR_SECRET_KEY'
```

## Shadow-mode score from your server

shadowMode: true still scores the request and returns allow / review / block, without escalating for missing mandatory signals. Send at least one identity (email, phone, sessionId, deviceId, accountId, or fingerprint.visitorId). Money is a JSON object with amount as a decimal string in major units.

curl

```
curl -q --globoff -X POST 'https://r1-api.riskcogs.com/v1/risk-score' \
  -H "X-API-Key: $RISKCOGS_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"requestId":"quickstart-shadow-test-1","flowType":"checkout","shadowMode":true,"email":"buyer@example.com","ip":"203.0.113.45","money":{"version":1,"amount":"49.00","currency":"EUR"}}'
```

## Read the score response

Response

```
{
  "risk_score": 0.18,
  "level": "low",
  "recommendation": "allow",
  "shadowMode": true,
  "riskId": "0190f3c2-0000-4000-8000-000000000000",
  "flags": [],
  "signals": { "email": {}, "ip": {} }
}
```

## Send chargeback feedback

POST https://r1-api.riskcogs.com/v1/risk-feedback requires a pr_ key. Include riskId from the score response when you have it.

Feedback

```
curl -q --globoff -X POST 'https://r1-api.riskcogs.com/v1/risk-feedback' \
  -H "X-API-Key: $RISKCOGS_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"eventType":"chargeback","eventAt":"2026-11-20T08:46:00.000Z","ip":"203.0.113.45","email":"buyer@example.com","riskId":"0190f3c2-0000-4000-8000-000000000000","flowType":"checkout","money":{"version":1,"amount":"49.00","currency":"EUR"}}'
```

## Webhook events

Configure HTTPS endpoints in the merchant console. Subscribe to decision.created, review.needed, and feedback.received. Verify RiskCogs-Signature (HMAC-SHA256 over ".").

- decision.created — every scored decision
- review.needed — recommendation is review, or block while shadowMode was true
- feedback.received — stored outcomes such as chargeback

## Replay and consent

Session replay is off unless captureReplay, explicit sessionReplay consent, fraud consent, and the tenant replay sample rate all allow it. On score requests, consent.fraudPrevention false excludes MAU counting and ignores deviceSignalsSnapshot. Collect only with a lawful basis matching what you enable.

Replay consent

```
// Recording stays off unless captureReplay: true at init and the tenant sample rate selects this session.
risk.setConsent({ sessionReplay: true });
```

## When a call fails

- 401 — check X-API-Key
- 403 on feedback — use pr_ on r1-api, not pub_ on r1-collect
- 409 — same requestId with a different payload; use a new id
- over_limit true, riskId null — plan cap; ask your operator before live traffic

## Stay in shadow until you trust the signal

Shadow mode logs what RiskCogs would recommend without changing your payment flow. When results look right, work with your operator to move recommendations into production.

OpenAPI: https://r1-api.riskcogs.com/openapi.json and https://r1-api.riskcogs.com/docs

 [Apply for the shadow-mode pilot](https://riskcogs.com/pilot/)  [Create a sandbox account](https://riskcogs.com/signup/)

## Frequently asked questions

### Do I need separate keys for browser and server?

Yes. Use a publishable pub_ key in the browser SDK on the intake host, and a secret pr_ key only on your server for /v1/risk-score and /v1/risk-feedback. Keys are issued per pilot; store the secret in your vault immediately when provisioned.

### Does shadow mode still return block or review?

Yes. Shadow mode computes the same recommendation but you should not block payments until you leave shadow. Use the recommendation for logging and dashboards first, then wire enforce mode when you are ready.

### What scale is risk_score on?

The API returns risk_score as a decimal between 0 and 1, not as a whole-number percentage. Thresholds in decisionContext use the same scale, so compare your console bands or contract thresholds against these decimals when you interpret results in shadow mode.

### Why send risk-feedback after a chargeback?

Feedback ties real outcomes to the original riskId so the engine learns which signals predicted disputes and which orders were genuinely good. Without feedback, later scores cannot improve from your traffic patterns, refunds, or chargebacks.

## Sources and related reading

- [Fraud detection API overview](https://riskcogs.com/docs/fraud-detection-api/)
- [How shadow mode works](https://riskcogs.com/#how-it-works)
- [Pricing and quotas](https://riskcogs.com/pricing/)
- [Security and data protection](https://riskcogs.com/security/)

## Stop fraud before it costs you

Run RiskCogs in shadow mode on live traffic. Free. Scores only, never blocks a payment.

 [Start free in shadow mode](https://riskcogs.com/signup/)

---

Source: https://riskcogs.com/docs/shadow-quickstart/
Language: en
Site guide: https://riskcogs.com/llms.txt
