Orders

GET /orders

List the organization's orders, newest first by default. Supports search, filtering and cursor pagination.

Requires the orders: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.

sortnumber | -number | createdAt | -createdAt | totalCents | -totalCents

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

searchstring

A free-text search term, matched case-insensitively against the record's most identifying fields. Combined with filter using AND.

filterstring

A JSON-encoded filter document, for example {"createdAt":{"$gte":"2025-01-01T00:00:00Z"}}. Filterable fields: id, number, totalCents, currencyCode, shippedAt, deliveredAt, cancelledAt, metadata, createdAt, customer.id, customer.email, customer.firstName, customer.lastName, customer.metadata, customer.emailOptOut, customer.emailOptOutSource, customer.createdAt, items.productId, items.productVariantId, tags.name. See Filtering for the syntax.

includestring

A comma-separated list of extra fields to compute and return. Each one costs an additional query, so ask only for what you need. Available: importJob, itemsCount, customer, items, tags.

Request
curl \
  "https://api.cascade.dev/orders" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "siteId": "550e8400-e29b-41d4-a716-446655440000",
      "customerId": "550e8400-e29b-41d4-a716-446655440000",
      "remoteId": "string",
      "number": "string",
      "totalCents": 0,
      "subtotalCents": 0,
      "shippingCents": 0,
      "taxCents": 0,
      "currencyCode": "string",
      "shippedAt": "2025-01-15T09:30:00Z",
      "deliveredAt": "2025-01-15T09:30:00Z",
      "cancelledAt": "2025-01-15T09:30:00Z",
      "metadata": "...",
      "notes": "string",
      "createdAt": "2025-01-15T09:30:00Z",
      "updatedAt": "2025-01-15T09:30:00Z",
      "importJob": {
        "id": "...",
        "type": "...",
        "action": "...",
        "row": "...",
        "createdAt": "..."
      },
      "itemsCount": 0,
      "customer": {
        "id": "...",
        "email": "...",
        "phone": "...",
        "firstName": "...",
        "lastName": "...",
        "country": "...",
        "birthday": "...",
        "metadata": "...",
        "notes": "...",
        "emailOptOut": "...",
        "emailOptOutAt": "...",
        "emailOptOutSource": "...",
        "createdAt": "...",
        "updatedAt": "..."
      },
      "items": ["..."],
      "tags": ["..."]
    }
  ],
  "nextCursor": "string"
}

PATCH /orders/bulk-update

Add or remove tags and metadata across every order matching a filter, in one request. Sending no filter applies the changes to every order in the organization.

Requires the orders:write permission.

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

Query Parameters

filterstring

A JSON-encoded filter document selecting the orders to update. Omit it and every order in the organization is updated. See Filtering for the syntax.

searchstring

A free-text search term, matched case-insensitively against the record's most identifying fields. Combined with filter using AND.

Body Parameters

addTagsstring[]

Tag names to add. Tags that do not exist yet are created.

removeTagsstring[]

Tag names to remove.

addMetadataobject

Metadata keys to set, merged onto whatever each order already has.

removeMetadataKeysstring[]

Metadata keys to delete.

Request
curl \
  -X PATCH \
  "https://api.cascade.dev/orders/bulk-update" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "addTags": [
    "string"
  ],
  "removeTags": [
    "string"
  ],
  "addMetadata": "...",
  "removeMetadataKeys": [
    "string"
  ]
}'
Response
{
  "count": 0
}

POST /orders/import

Create or update orders in bulk, matching on remoteId. The customer, site and every product referenced have to exist already, so import those first. Rows whose references don't resolve are skipped and returned in skipped; an order with any item that doesn't resolve is skipped whole, one entry per bad item. Set strict to fail on the first miss instead.

Requires the orders:write permission.

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

Body Parameters

dataobject[]required

The orders to create or update.

strictboolean

When true, a row that references something missing fails the whole import with an error. Off by default: rows whose references don't resolve are skipped and reported in skipped.

earnLoyaltyboolean

Whether newly created orders earn loyalty points and stamps. On by default; turn it off when importing historical orders.

Request
curl \
  -X POST \
  "https://api.cascade.dev/orders/import" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "data": [
    {
      "site": "string",
      "customer": "[email protected]",
      "remoteId": "string",
      "number": "string",
      "totalCents": 0,
      "subtotalCents": 0,
      "shippingCents": 0,
      "taxCents": 0,
      "currencyCode": "string",
      "shippedAt": "2025-01-15T09:30:00Z",
      "deliveredAt": "2025-01-15T09:30:00Z",
      "cancelledAt": "2025-01-15T09:30:00Z",
      "metadata": "...",
      "items": [
        "..."
      ]
    }
  ],
  "strict": true,
  "earnLoyalty": true
}'
Response
{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "siteId": "550e8400-e29b-41d4-a716-446655440000",
      "customerId": "550e8400-e29b-41d4-a716-446655440000",
      "remoteId": "string",
      "number": "string",
      "totalCents": 0,
      "subtotalCents": 0,
      "shippingCents": 0,
      "taxCents": 0,
      "currencyCode": "string",
      "shippedAt": "2025-01-15T09:30:00Z",
      "deliveredAt": "2025-01-15T09:30:00Z",
      "cancelledAt": "2025-01-15T09:30:00Z",
      "metadata": "...",
      "notes": "string",
      "createdAt": "2025-01-15T09:30:00Z",
      "updatedAt": "2025-01-15T09:30:00Z",
      "importJob": {
        "id": "...",
        "type": "...",
        "action": "...",
        "row": "...",
        "createdAt": "..."
      },
      "itemsCount": 0,
      "customer": {
        "id": "...",
        "email": "...",
        "phone": "...",
        "firstName": "...",
        "lastName": "...",
        "country": "...",
        "birthday": "...",
        "metadata": "...",
        "notes": "...",
        "emailOptOut": "...",
        "emailOptOutAt": "...",
        "emailOptOutSource": "...",
        "createdAt": "...",
        "updatedAt": "..."
      },
      "items": ["..."],
      "tags": ["..."]
    }
  ],
  "skipped": [
    {
      "index": 0,
      "message": "string",
      "itemIndex": 0
    }
  ]
}

GET /orders/{id}

Get a single order by ID.

Requires the orders:read permission.

Path Parameters

idstring (uuid)required

The ID of the order.

Query Parameters

includestring

A comma-separated list of extra fields to compute and return. Each one costs an additional query, so ask only for what you need. Available: importJob, itemsCount, customer, items, tags.

Request
curl \
  "https://api.cascade.dev/orders/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "siteId": "550e8400-e29b-41d4-a716-446655440000",
  "customerId": "550e8400-e29b-41d4-a716-446655440000",
  "remoteId": "string",
  "number": "string",
  "totalCents": 0,
  "subtotalCents": 0,
  "shippingCents": 0,
  "taxCents": 0,
  "currencyCode": "string",
  "shippedAt": "2025-01-15T09:30:00Z",
  "deliveredAt": "2025-01-15T09:30:00Z",
  "cancelledAt": "2025-01-15T09:30:00Z",
  "metadata": "...",
  "notes": "string",
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z",
  "importJob": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "customers",
    "action": "created",
    "row": 0,
    "createdAt": "2025-01-15T09:30:00Z"
  },
  "itemsCount": 0,
  "customer": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "email": "[email protected]",
    "phone": "string",
    "firstName": "string",
    "lastName": "string",
    "country": "string",
    "birthday": "string",
    "metadata": "...",
    "notes": "string",
    "emailOptOut": true,
    "emailOptOutAt": "2025-01-15T09:30:00Z",
    "emailOptOutSource": "customer",
    "createdAt": "2025-01-15T09:30:00Z",
    "updatedAt": "2025-01-15T09:30:00Z"
  },
  "items": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "productId": "550e8400-e29b-41d4-a716-446655440000",
      "productVariantId": "550e8400-e29b-41d4-a716-446655440000",
      "quantity": 0,
      "unitPriceCents": 0,
      "product": {
        "id": "...",
        "slug": "...",
        "title": "...",
        "description": "...",
        "imageUrl": "...",
        "url": "...",
        "metadata": "...",
        "notes": "...",
        "createdAt": "...",
        "updatedAt": "..."
      },
      "variant": {
        "id": "...",
        "slug": "...",
        "title": "...",
        "imageUrl": "...",
        "priceCents": "...",
        "currencyCode": "...",
        "available": "...",
        "metadata": "..."
      }
    }
  ],
  "tags": ["string"]
}

PATCH /orders/{id}

Update an order's metadata, notes or tags. Commercial fields such as the total and fulfillment dates come from the store and cannot be edited here. Triggers the order.updated webhook.

Requires the orders:write permission.

Path Parameters

idstring (uuid)required

The ID of the order to update.

Body Parameters

metadataobject

Replaces the order's metadata wholesale. Omit to leave it alone.

notesstring

Internal notes about the order.

tagsstring[]

The order's full set of tag names. Omit to leave the tags alone.

Request
curl \
  -X PATCH \
  "https://api.cascade.dev/orders/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "metadata": "...",
  "notes": "string",
  "tags": [
    "string"
  ]
}'
Response
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "siteId": "550e8400-e29b-41d4-a716-446655440000",
  "customerId": "550e8400-e29b-41d4-a716-446655440000",
  "remoteId": "string",
  "number": "string",
  "totalCents": 0,
  "subtotalCents": 0,
  "shippingCents": 0,
  "taxCents": 0,
  "currencyCode": "string",
  "shippedAt": "2025-01-15T09:30:00Z",
  "deliveredAt": "2025-01-15T09:30:00Z",
  "cancelledAt": "2025-01-15T09:30:00Z",
  "metadata": "...",
  "notes": "string",
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z",
  "importJob": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "customers",
    "action": "created",
    "row": 0,
    "createdAt": "2025-01-15T09:30:00Z"
  },
  "itemsCount": 0,
  "customer": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "email": "[email protected]",
    "phone": "string",
    "firstName": "string",
    "lastName": "string",
    "country": "string",
    "birthday": "string",
    "metadata": "...",
    "notes": "string",
    "emailOptOut": true,
    "emailOptOutAt": "2025-01-15T09:30:00Z",
    "emailOptOutSource": "customer",
    "createdAt": "2025-01-15T09:30:00Z",
    "updatedAt": "2025-01-15T09:30:00Z"
  },
  "items": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "productId": "550e8400-e29b-41d4-a716-446655440000",
      "productVariantId": "550e8400-e29b-41d4-a716-446655440000",
      "quantity": 0,
      "unitPriceCents": 0,
      "product": {
        "id": "...",
        "slug": "...",
        "title": "...",
        "description": "...",
        "imageUrl": "...",
        "url": "...",
        "metadata": "...",
        "notes": "...",
        "createdAt": "...",
        "updatedAt": "..."
      },
      "variant": {
        "id": "...",
        "slug": "...",
        "title": "...",
        "imageUrl": "...",
        "priceCents": "...",
        "currencyCode": "...",
        "available": "...",
        "metadata": "..."
      }
    }
  ],
  "tags": ["string"]
}

DELETE /orders/{id}

Delete an order along with its line items and tags. Triggers the order.deleted webhook.

Requires the orders:write permission.

Path Parameters

idstring (uuid)required

The ID of the order to delete.

Request
curl \
  -X DELETE \
  "https://api.cascade.dev/orders/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "siteId": "550e8400-e29b-41d4-a716-446655440000",
  "customerId": "550e8400-e29b-41d4-a716-446655440000",
  "remoteId": "string",
  "number": "string",
  "totalCents": 0,
  "subtotalCents": 0,
  "shippingCents": 0,
  "taxCents": 0,
  "currencyCode": "string",
  "shippedAt": "2025-01-15T09:30:00Z",
  "deliveredAt": "2025-01-15T09:30:00Z",
  "cancelledAt": "2025-01-15T09:30:00Z",
  "metadata": "...",
  "notes": "string",
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z",
  "importJob": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "customers",
    "action": "created",
    "row": 0,
    "createdAt": "2025-01-15T09:30:00Z"
  },
  "itemsCount": 0,
  "customer": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "email": "[email protected]",
    "phone": "string",
    "firstName": "string",
    "lastName": "string",
    "country": "string",
    "birthday": "string",
    "metadata": "...",
    "notes": "string",
    "emailOptOut": true,
    "emailOptOutAt": "2025-01-15T09:30:00Z",
    "emailOptOutSource": "customer",
    "createdAt": "2025-01-15T09:30:00Z",
    "updatedAt": "2025-01-15T09:30:00Z"
  },
  "items": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "productId": "550e8400-e29b-41d4-a716-446655440000",
      "productVariantId": "550e8400-e29b-41d4-a716-446655440000",
      "quantity": 0,
      "unitPriceCents": 0,
      "product": {
        "id": "...",
        "slug": "...",
        "title": "...",
        "description": "...",
        "imageUrl": "...",
        "url": "...",
        "metadata": "...",
        "notes": "...",
        "createdAt": "...",
        "updatedAt": "..."
      },
      "variant": {
        "id": "...",
        "slug": "...",
        "title": "...",
        "imageUrl": "...",
        "priceCents": "...",
        "currencyCode": "...",
        "available": "...",
        "metadata": "..."
      }
    }
  ],
  "tags": ["string"]
}