> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dojah.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Backfill Events

> Upload historical banking, payment, or onboarding events to Dojah EasyDetect so fraud models learn normal behaviour before you switch to real-time scoring.

<div className="dj-endpoint">
  <span className={`dj-method dj-method-post`}>POST</span>
  <code>/api/ingest/backfill</code>
</div>

Upload historical events that occurred before you integrated the real-time API. Fraud models need past data to learn what “normal” looks like — a user’s usual login locations, transaction amounts, and timing — so early real-time scoring is accurate.

## Endpoint

| Method | URL                                           |
| ------ | --------------------------------------------- |
| POST   | `https://ingest.dojah.io/api/ingest/backfill` |

## Headers

| Header          | Required | Description                                           |
| --------------- | -------- | ----------------------------------------------------- |
| `Authorization` | Yes      | Your private/secret key, sent as-is — *not* `Bearer`. |
| `Content-Type`  | Yes      | `application/json`.                                   |

## Body parameters

Backfill takes the same payload as the real-time endpoint — see the [banking, payments, and onboarding templates](/api-reference/easydetect/send-events#request-body-templates) for the full field list.

| Parameter | Type   | Required | Description                                                                       |
| --------- | ------ | -------- | --------------------------------------------------------------------------------- |
| `key`     | string | Yes      | Your Ingest key from EasyDetect settings.                                         |
| `type`    | string | Yes      | Event type: `banking`, `payments`, or `onboarding`.                               |
| `event`   | object | Yes      | The historical event payload, using the same nested objects as a real-time event. |

## Response

Backfilled events are accepted for training and are not scored in real time, so no per-event verdict is returned. Batches are processed asynchronously; monitor progress from **EasyDetect** on your dashboard.

## Errors

| Code  | Meaning                                                                            |
| ----- | ---------------------------------------------------------------------------------- |
| `400` | Bad request — `type` is invalid or a required field is missing.                    |
| `401` | Unauthorized — check your `Authorization` key (no `Bearer` prefix) and body `key`. |
| `422` | Unprocessable — an event in the batch failed validation.                           |
| `429` | Too many requests — back off and retry.                                            |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    "https://ingest.dojah.io/api/ingest/backfill" \
    -H "Authorization: {{secret_key}}" \
    -H "Content-Type: application/json" \
    -d '{
      "key": "{{ingest_key}}",
      "type": "banking",
      "event": {
        "transaction": {
          "id": "87554303-3f75-4883",
          "time": "2022-08-01T09:20:00.000Z",
          "amount": 15400,
          "currency": "NGN",
          "type": "transfer"
        },
        "user": {
          "user_id": "9931fac0-6bfa-4b3c",
          "registration_time": "2021-05-10T08:00:00.000Z"
        }
      }
    }'
  ```

  ```js Node.js theme={null}
  const res = await fetch("https://ingest.dojah.io/api/ingest/backfill", {
    method: "POST",
    headers: {
      Authorization: process.env.DOJAH_SECRET_KEY,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      key: process.env.DOJAH_INGEST_KEY,
      type: "banking",
      event: {
        transaction: {
          id: "87554303-3f75-4883",
          time: "2022-08-01T09:20:00.000Z",
          amount: 15400,
          currency: "NGN",
          type: "transfer",
        },
        user: {
          user_id: "9931fac0-6bfa-4b3c",
          registration_time: "2021-05-10T08:00:00.000Z",
        },
      },
    }),
  });
  const data = await res.json();
  ```

  ```python Python theme={null}
  import os, requests

  res = requests.post(
      "https://ingest.dojah.io/api/ingest/backfill",
      headers={
          "Authorization": os.environ["DOJAH_SECRET_KEY"],
          "Content-Type": "application/json",
      },
      json={
          "key": os.environ["DOJAH_INGEST_KEY"],
          "type": "banking",
          "event": {
              "transaction": {
                  "id": "87554303-3f75-4883",
                  "time": "2022-08-01T09:20:00.000Z",
                  "amount": 15400,
                  "currency": "NGN",
                  "type": "transfer",
              },
              "user": {
                  "user_id": "9931fac0-6bfa-4b3c",
                  "registration_time": "2021-05-10T08:00:00.000Z",
              },
          },
      },
  )
  data = res.json()
  ```
</RequestExample>

<ResponseExample>
  ```json POST /api/ingest/backfill theme={null}
  {
    "status": "accepted",
    "message": "Events queued for backfill processing"
  }
  ```
</ResponseExample>
