# Real-time scam detection (/score-api/endpoints/scam-detection)



{/* Written by scripts/build-use-cases.mjs from internal/usecases/catalog.json and use-cases/site.json. Change those, not this file. */}

**Stop the scam while the customer is still in the app.** In a scam, the real customer sends the money, so the login looks normal. Send the payment, the payee and what the customer says it is for, and get a score for how likely they are being scammed.

| Endpoint              | Price           | Group    |
| --------------------- | --------------- | -------- |
| `POST /v1/score/scam` | $0.005 per call | Payments |

## Request [#request]

Send what you know in one `context` object. `payment` is required; every other field is optional. A field can hold text, JSON or CSV.

<Tabs items="[&#x22;curl&#x22;, &#x22;Python&#x22;, &#x22;TypeScript&#x22;]">
  <Tab value="curl">
    ```bash
    curl https://api.finic.ai/v1/score/scam \
      --header "Authorization: Bearer $FINIC_API_KEY" \
      --header "Content-Type: application/json" \
      --data '{
        "context": {
          "payment": { "amount_usd": 8500, "type": "bank_transfer", "first_payment_to_payee": true },
          "purpose": "Crypto investment, my advisor says the window closes today",
          "payee": { "account_type": "personal", "account_opened": "2026-11-04", "added": "2026-11-25" },
          "customer": { "age": 71, "customer_since": 1996, "median_payment_usd": 140 },
          "session": [
            { "at": "2026-11-25T11:02:10Z", "event": "app_backgrounded", "count": 4 },
            { "at": "2026-11-25T11:06:31Z", "event": "account_number_pasted" },
            { "at": "2026-11-25T11:07:02Z", "event": "scam_warning_dismissed", "seconds_shown": 2 }
          ]
        }
      }'
    ```
  </Tab>

  <Tab value="Python">
    ```python
    import os
    import requests

    response = requests.post(
        "https://api.finic.ai/v1/score/scam",
        headers={"Authorization": f"Bearer {os.environ['FINIC_API_KEY']}"},
        json={
            "context": {
                "payment": { "amount_usd": 8500, "type": "bank_transfer", "first_payment_to_payee": True },
                "purpose": "Crypto investment, my advisor says the window closes today",
                "payee": { "account_type": "personal", "account_opened": "2026-11-04", "added": "2026-11-25" },
                "customer": { "age": 71, "customer_since": 1996, "median_payment_usd": 140 },
                "session": [
                  { "at": "2026-11-25T11:02:10Z", "event": "app_backgrounded", "count": 4 },
                  { "at": "2026-11-25T11:06:31Z", "event": "account_number_pasted" },
                  { "at": "2026-11-25T11:07:02Z", "event": "scam_warning_dismissed", "seconds_shown": 2 }
                ]
            }
        },
        timeout=30,
    )
    response.raise_for_status()
    print(response.json()["score"])
    ```
  </Tab>

  <Tab value="TypeScript">
    ```ts
    const response = await fetch("https://api.finic.ai/v1/score/scam", {
      method: "POST",
      headers: {
        Authorization: `Bearer ${process.env.FINIC_API_KEY}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        context: {
          "payment": { "amount_usd": 8500, "type": "bank_transfer", "first_payment_to_payee": true },
          "purpose": "Crypto investment, my advisor says the window closes today",
          "payee": { "account_type": "personal", "account_opened": "2026-11-04", "added": "2026-11-25" },
          "customer": { "age": 71, "customer_since": 1996, "median_payment_usd": 140 },
          "session": [
            { "at": "2026-11-25T11:02:10Z", "event": "app_backgrounded", "count": 4 },
            { "at": "2026-11-25T11:06:31Z", "event": "account_number_pasted" },
            { "at": "2026-11-25T11:07:02Z", "event": "scam_warning_dismissed", "seconds_shown": 2 }
          ]
        },
      }),
    });
    const { score, questions } = await response.json();
    ```
  </Tab>
</Tabs>

## Fields you send [#fields-you-send]

Send the details, not only an ID: an account ID tells the score nothing, but the account's age, profile and history do. Fields that are not in this list are also read.

| Field           |          | Description                                                                                                              |
| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
| `payment`       | Required | The amount, the type of payment, and how it compares with what the customer usually sends.                               |
| `purpose`       | Optional | What the customer says the payment is for, in their own words.                                                           |
| `payee`         | Optional | A description of the payee, not a payee ID: when they were added, the type of account, and how long it has been open.    |
| `customer`      | Optional | A description of the customer, not a customer ID: their age, how long they have been with you, and their usual payments. |
| `session`       | Optional | What the customer did in the app before paying: the session's events, in order.                                          |
| `messages`      | Optional | The text of messages the customer shared or received.                                                                    |
| `other_context` | Optional | Any other information, structured or unstructured, that is useful for scoring.                                           |

## Response [#response]

`score` runs from 0, the lowest risk, to 1000, the highest. `questions` are the yes/no questions behind it, each with the probability that the answer is yes.

```json title="200 OK"
{
  "score": 928,
  "questions": [
    {
      "text": "Is this a first payment to the payee, and far above the customer's usual?",
      "probability": 0.96
    },
    {
      "text": "Does the stated purpose read like an investment, romance or impersonation scam?",
      "probability": 0.95
    },
    {
      "text": "Did the customer go past a scam warning?",
      "probability": 0.93
    },
    {
      "text": "Is someone else rushing the customer?",
      "probability": 0.91
    }
  ],
  "request_id": "req_01M4YF1068X8B4C458ENPD4JHT"
}
```

## The questions behind the score [#the-questions-behind-the-score]

1. Is this a first payment to the payee, and far above the customer's usual?
2. Does the stated purpose read like an investment, romance or impersonation scam?
3. Did the customer go past a scam warning?
4. Is someone else rushing the customer?

Every organization gets the same questions for this score. To use your own questions, or to calibrate a score to your own outcomes, copy it to a [custom scoring model](/score-model) in the Finic app (Starter plan and above).

## Turn the score into an action [#turn-the-score-into-an-action]

These thresholds are examples. Choose your own, and change them as you learn.

| Score       | Action  | Example                                    |
| ----------- | ------- | ------------------------------------------ |
| Under 300   | Approve | Send the payment.                          |
| 300 to 599  | Step up | Warn the customer and ask them to confirm. |
| 600 to 849  | Review  | Hold the payment and call the customer.    |
| 850 or more | Block   | Stop the payment.                          |

## Errors [#errors]

| Status | `type`                 | When                                                                                                           |
| ------ | ---------------------- | -------------------------------------------------------------------------------------------------------------- |
| 400    | `invalid_request`      | `context` is missing, is not a JSON object, or a required field (`payment`) is empty. `param` names the field. |
| 401    | `authentication_error` | The API key is missing or not valid.                                                                           |
| 402    | `insufficient_credit`  | The organization has no credit. Add credit in the Finic app.                                                   |
| 429    | `rate_limited`         | Too many requests. Retry with exponential backoff.                                                             |

See the [API reference](/reference) for every error and limit, and [Pricing](/pricing) for what a call costs.
