Ask for an invitation
Menu

Endpoint

Create an export

POST/v1/exports

Starts an export of your orders, payments, refunds, payouts, conversions, invoices, customers, subscriptions or ledger, as a CSV file (the ledger also as a PDF statement). It is built in the background: the answer is 202 with the export queued, and export.ready is sent when the file can be downloaded. An export is kept 7 days; at most 10 can be made an hour, of up to 500,000 rows each.

Scope a restricted key needs
exports:write
Publishable key
Not allowed: secret or restricted key only
Idempotency-Key
Recommended. It makes a retry safe.

Parameters

Parameters of Create an export
ParameterType and placeMeaning
Orrerie-VersionstringheaderAPI version date. Default: the version the key was created with. Example 2026-10-11.
Idempotency-KeystringheaderMakes a retry safe. Kept 24 hours. 1 to 255 characters.

Request body

A JSON object. The body is required. A field the call does not list is refused with parameter_unknown.

Request body of Create an export
FieldTypeMeaning
typerequiredstringOne of orders, payments, refunds, payouts, conversions, invoices, customers, subscriptions, ledger.
formatstringDefault csv. pdf is offered for ledger (a statement) only. One of csv, pdf.
filtersobjectThe same filters as the matching list endpoint, as JSON: {created: {gte, lt}, status: [...]}.
timezonestringIANA zone for date columns. Default UTC.
display_currencystringFiat currency of the value columns. Default USD.

Example request

curl

curl https://api.orrerie.com/v1/exports \
  -H "Authorization: Bearer $ORRERIE_SECRET_KEY" \
  -H "Idempotency-Key: 8f14e45f-ceea-467f-a9d2-6f1c2b3d4e5a" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "orders",
  "format": "csv",
  "timezone": "America/Los_Angeles",
  "filters": {
    "created": {
      "gte": "2026-09-01T00:00:00.000Z",
      "lt": "2026-10-01T00:00:00.000Z"
    },
    "status": [
      "paid",
      "overpaid"
    ]
  }
}'

JavaScript

const response = await fetch("https://api.orrerie.com/v1/exports", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ORRERIE_SECRET_KEY}`,
    "Idempotency-Key": "8f14e45f-ceea-467f-a9d2-6f1c2b3d4e5a",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "type": "orders",
    "format": "csv",
    "timezone": "America/Los_Angeles",
    "filters": {
      "created": {
        "gte": "2026-09-01T00:00:00.000Z",
        "lt": "2026-10-01T00:00:00.000Z"
      },
      "status": [
        "paid",
        "overpaid"
      ]
    }
  }),
});
const result = await response.json();
if (!response.ok) throw new Error(`${result.error.code}: ${result.error.message}`);
console.log(result);

Python

import os
import requests

response = requests.post(
    "https://api.orrerie.com/v1/exports",
    headers={"Authorization": f"Bearer {os.environ['ORRERIE_SECRET_KEY']}", "Idempotency-Key": "8f14e45f-ceea-467f-a9d2-6f1c2b3d4e5a"},
    json={
        "type": "orders",
        "format": "csv",
        "timezone": "America/Los_Angeles",
        "filters": {
            "created": {
                "gte": "2026-09-01T00:00:00.000Z",
                "lt": "2026-10-01T00:00:00.000Z",
            },
            "status": [
                "paid",
                "overpaid",
            ],
        },
    },
    timeout=30,
)
result = response.json()
if not response.ok:
    raise RuntimeError(f"{result['error']['code']}: {result['error']['message']}")
print(result)

PHP

<?php
$request = curl_init('https://api.orrerie.com/v1/exports');
curl_setopt_array($request, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('ORRERIE_SECRET_KEY'),
        'Idempotency-Key: 8f14e45f-ceea-467f-a9d2-6f1c2b3d4e5a',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'type' => 'orders',
        'format' => 'csv',
        'timezone' => 'America/Los_Angeles',
        'filters' => [
            'created' => [
                'gte' => '2026-09-01T00:00:00.000Z',
                'lt' => '2026-10-01T00:00:00.000Z',
            ],
            'status' => [
                'paid',
                'overpaid',
            ],
        ],
    ]),
]);
$body = curl_exec($request);
if ($body === false) {
    throw new RuntimeException(curl_error($request));
}
$result = json_decode($body, true);
if (curl_getinfo($request, CURLINFO_HTTP_CODE) >= 400) {
    throw new RuntimeException($result['error']['code'] . ': ' . $result['error']['message']);
}
print_r($result);

Responses

202 Accepted

The request was accepted and is waiting: for a person to approve it in the dashboard, or to be built in the background. Nothing has been signed or sent. The answer is the export object. Headers: Orrerie-Request-Id.

Example response, 202

{
  "id": "exp_kpvgpbjqmv3kexwyrnp12j8e",
  "object": "export",
  "livemode": true,
  "created": "2026-10-12T08:00:00.000Z",
  "type": "orders",
  "format": "csv",
  "status": "queued",
  "filters": {
    "created": {
      "gte": "2026-09-01T00:00:00.000Z",
      "lt": "2026-10-01T00:00:00.000Z"
    },
    "status": [
      "paid",
      "overpaid"
    ]
  },
  "timezone": "America/Los_Angeles",
  "display_currency": "USD",
  "row_count": null,
  "file": null,
  "snapshot_at": "2026-10-12T08:00:00.000Z",
  "completed_at": null,
  "expires_at": null,
  "failure_code": null,
  "requested_by": {
    "type": "api_key",
    "id": "key_6e3gg2c6ea176xxdek2nar6v"
  }
}

Any other status: an error

A status of 400 or above answers with the error object. Branch on its code, never on its message.

Errors

Beside the errors every call can answer with (a bad key, a missing scope, the rate limit), this call answers with:

Errors of Create an export
CodeHTTPMeaning
export_limit_reached429More than 10 exports in an hour.
export_too_large400The filters match more than 500,000 rows. Narrow the dates.