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

# scheduled_exports/finished

This webhook is triggered when a run of a repeating export finishes. A
repeating export is one scheduled from the Exports page of the LoyaltyLion
admin to run every 2 hours, daily, weekly or monthly. A run that completes
carries a link to its file, so a pipeline can collect each file without anyone
signing in.

An export that repeats every 2 hours skips a run while its previous run is
still going, so no webhook is sent for that round.

> [!NOTE]
>
> This webhook is in limited availability. Contact
> [support@loyaltylion.com](mailto:support@loyaltylion.com) to have it turned on
> for your program.

Subscribe with your site's token and secret or a program API key. OAuth apps
cannot subscribe to this webhook.

## Downloading the file

`file.download_url` is a signed link that works for 24 hours, until
`file.download_url_expires_at`. Fetch it with a plain `GET` and no
authentication. The file itself is kept for 30 days, until `file.expires_at`.
Treat the link as a secret while it works: anyone who has it can download the
file.

A webhook that we retry carries the link from the first attempt, so a delivery
that arrives more than a day late has an expired link. The file can still be
downloaded from the Exports page.

A `csv` file has a header row of column labels. A `jsonl` file has one JSON
object per line, with the same column labels as field names. Choose the Snake
case format template when you build the export to get field names such as
`points_approved`.

## Payload

**export** `object` *required*

**id** `number` *required*

The LoyaltyLion ID of this run of the export

**kind** `string` *required*

The kind of export, such as `customers` or `customer_transactions`

**status** `string` *required*

`completed` when the file is ready, or `failed` when the run produced no
file

**scheduled\_for** `string` *required*

The day the run was scheduled for, as `YYYY-MM-DD` in your store's time
zone. Runs of an export that repeats every 2 hours share a day, so tell
them apart by `id`

**period** `object` *required*

The period the run covers: the day, the 7 days or the calendar month
before `scheduled_for`. Both fields are `null` for an export that holds
everything as it stood when the run started, which is every export that
repeats every 2 hours, any other that was scheduled to cover everything,
and one with no date range

**start** `string | null` *required*

The start of the period, as an ISO 8601 timestamp

**end** `string | null` *required*

The end of the period, as an ISO 8601 timestamp

**row\_count** `number | null` *required*

The number of rows in the file. `null` for a failed run

**file** `object | null` *required*

The exported file. `null` for a failed run

**format** `string` *required*

`csv` or `jsonl`

**size** `number` *required*

The size of the file in bytes

**download\_url** `string` *required*

A signed link to the file

**download\_url\_expires\_at** `string` *required*

When `download_url` stops working, as an ISO 8601 timestamp

**expires\_at** `string` *required*

When the file is deleted, as an ISO 8601 timestamp

## Example

```json Completed theme={null}
{
  "id": "bff1bddb-6cd8-4c2c-9619-18744657053c",
  "topic": "scheduled_exports/finished",
  "created_at": "2026-12-02T14:03:12.000Z",
  "payload": {
    "export": {
      "id": 48213,
      "kind": "customer_transactions",
      "status": "completed",
      "scheduled_for": "2026-12-02",
      "period": {
        "start": "2026-12-01T05:00:00.000Z",
        "end": "2026-12-02T04:59:59.999Z"
      },
      "row_count": 1842,
      "file": {
        "format": "jsonl",
        "size": 412877,
        "download_url": "https://data-exports.loyaltylion.com/merchant_exports/…",
        "download_url_expires_at": "2026-12-03T14:03:02.000Z",
        "expires_at": "2027-01-01T14:03:02.000Z"
      }
    }
  }
}
```

```json Failed theme={null}
{
  "id": "0c4f6a5e-0d0b-4b53-9f0c-6f1f3a1f2c77",
  "topic": "scheduled_exports/finished",
  "created_at": "2026-12-02T15:10:44.000Z",
  "payload": {
    "export": {
      "id": 48214,
      "kind": "customer_transactions",
      "status": "failed",
      "scheduled_for": "2026-12-02",
      "period": {
        "start": "2026-12-01T05:00:00.000Z",
        "end": "2026-12-02T04:59:59.999Z"
      },
      "row_count": null,
      "file": null
    }
  }
}
```
