API endpointsBackfill requestsSubmit one or more backfill requests POST

Submit one or more backfill requests

POST
/v1/backfill-requests

Submit one or more backfill requests. Each re-delivers one collection's history on one Profile; historical items are delivered as ordinary content.* events; nothing is stored. Validation is atomic across the submission and every item then runs independently. Requires an Idempotency-Key; one run per collection per profile may be in flight at a time.

Authorization

bearerAuth
AuthorizationBearer <token>

An API key from the Koil admin console, sent as Authorization: Bearer <key>. A live key starts koil_live_ and a sandbox key koil_sandbox_; the key alone selects the Organization and mode. See https://docs.koil.co/concepts/authentication.

In: header

Header Parameters

Koil-Version*string

The dated API version the request is written against; it fixes the request and response shapes. Every response echoes the version it is rendered in.

Value in"2026-12-08"
Idempotency-Key*string

A unique key for this request, scoped to the Organization and operation. Retrying with the same key and payload returns the first result instead of repeating the work, or runs a request that failed again; the same key with a different payload is refused with 409 conflict. Keys expire 24 hours after first use, and a request still in flight after 15 minutes releases its key to a retry with the same payload.

Match\S
Length1 <= length <= 255

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

backfillRequests*array<>

The runs to start. Each item becomes its own backfill request with its own progress; a profile onboarding lists its collections, an incident recovery lists its profiles.

Items1 <= items <= 100
since?string

Oldest item time to emit, applied to every item. Omit for no lower bound, in which case each run is bounded only by maxItems and the platform's history.

Formatdate-time
maxItems?integer

Hard cap on emitted events per item, not in total. A run that stops here finishes partial.

Default1000
Range1 <= value <= 10000

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/backfill-requests" \  -H "Koil-Version: 2026-12-08" \  -H "Idempotency-Key: string" \  -H "Content-Type: application/json" \  -d '{    "backfillRequests": [      {        "profileId": "prof_123",        "collection": "instagram.media.posts"      },      {        "profileId": "prof_123",        "collection": "instagram.stories.posts"      }    ],    "since": "2026-06-01T00:00:00Z",    "maxItems": 1000  }'
{  "backfillRequests": [    {      "kind": "backfill_request",      "mode": "live",      "id": "string",      "profileId": "string",      "collection": "string",      "since": "2019-08-24T14:15:22Z",      "maxItems": 0,      "status": "pending",      "stopReason": "exhausted",      "emitted": 0,      "fetched": 0,      "skipped": 0,      "oldestEmittedAt": "2019-08-24T14:15:22Z",      "error": {        "code": "validation_error",        "message": "string",        "meta": {          "violations": [            {              "code": "string",              "path": "string",              "message": "string"            }          ],          "budgets": [            "string"          ],          "profileIds": [            "string"          ],          "required": [            "string"          ],          "limit": 0,          "resourceType": "string",          "resourceId": "string",          "reason": "string",          "refusalReason": "messaging_window_closed",          "property1": null,          "property2": null        }      },      "startedAt": "2019-08-24T14:15:22Z",      "completedAt": "2019-08-24T14:15:22Z",      "metadata": {        "property1": "string",        "property2": "string"      },      "createdAt": "2019-08-24T14:15:22Z",      "updatedAt": "2019-08-24T14:15:22Z"    }  ]}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}