Export jobs

GET /export-jobs

List the organization's CSV export jobs, newest first. A completed job carries a signed fileUrl to download.

Requires the exports:read permission.

Query Parameters

limitnumber

The number of records to return.

cursorstring

A pagination cursor. Fetch the next page by passing the nextCursor value from the previous response.

sortcreatedAt | -createdAt

The sort order. Prefix a field with - to sort descending. Defaults to -createdAt.

filterstring

A JSON-encoded filter document, for example {"createdAt":{"$gte":"2025-01-01T00:00:00Z"}}. Filterable fields: id, type, status, createdAt. See Filtering for the syntax.

Request
curl \
  "https://api.cascade.dev/export-jobs" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "userId": "550e8400-e29b-41d4-a716-446655440000",
      "fileUrl": "string",
      "type": "customers",
      "status": "pending",
      "totalCount": 0,
      "filter": "...",
      "search": "string",
      "createdAt": "2025-01-15T09:30:00Z",
      "updatedAt": "2025-01-15T09:30:00Z"
    }
  ],
  "nextCursor": "string"
}

POST /export-jobs

Queue a CSV export of records of one type, optionally narrowed by a filter. It runs in the background, so poll the job until it completes and then download fileUrl. Only session-authenticated requests can start one, since an export is attributed to a user.

Requires the exports:write permission.

Costs 10 rate limit tokens instead of the usual one. See Rate limits.

Body Parameters

typecustomers | products | orders | surveys | reviews | wishlists | loyalty-activity | loyalty-members | referralsrequired

Which records to export.

filterstring

A JSON-encoded filter document, in the same shape the matching list endpoint takes. Only the records it matches are exported. Omit to export every record of this type.

searchstring

A free-text search term, matched the same way the matching list endpoint matches it. Combined with filter using AND.

Request
curl \
  -X POST \
  "https://api.cascade.dev/export-jobs" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "customers",
  "filter": "string",
  "search": "string"
}'
Response
{
  "exportJobId": "550e8400-e29b-41d4-a716-446655440000"
}

GET /export-jobs/{id}

Get a single export job by ID. Once its status is completed, fileUrl is a signed link to the CSV.

Requires the exports:read permission.

Path Parameters

idstring (uuid)required

The ID of the export job.

Request
curl \
  "https://api.cascade.dev/export-jobs/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "userId": "550e8400-e29b-41d4-a716-446655440000",
  "fileUrl": "string",
  "type": "customers",
  "status": "pending",
  "totalCount": 0,
  "filter": "...",
  "search": "string",
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z"
}