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 | string

The sort order. Prefix a field with - to sort descending. Defaults to -createdAt. A custom field sorts as metadata.<key>, records without a value last; GET /metadata-definitions lists the fields.

searchstring

A free-text search term. Every word has to match, from the start of a word, in any order and ignoring case and accents, 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, surveys.requestCount, surveys.lastRequestedAt. A custom field's metadata.<key> path takes the operators its type supports: $gt, $gte, $lt and $lte for numbers and dates, $includes for text and pick-any fields, and $exists for any key. GET /metadata-definitions lists the fields. 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://your-store.meisei.app/api/orders" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "data": [
    {
      "id": "A4Ws1igz",
      "siteId": "A4Ws1igz",
      "customerId": "A4Ws1igz",
      "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": "...",
        "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, or an exact list of ids, in one request. Sending neither applies the changes to every order in the organization. Each order whose tags or metadata actually change triggers the order.updated webhook.

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. Every word has to match, from the start of a word, in any order and ignoring case and accents, against the record's most identifying fields. Combined with filter using AND.

Body parameters

idsstring[]

The ids of the orders to update, for changing an exact list. Combined with filter and search using AND when those are sent too.

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://your-store.meisei.app/api/orders/bulk-update" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ids": [
    "string"
  ],
  "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. Each new order triggers the order.created webhook and each existing one order.updated.

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://your-store.meisei.app/api/orders/import" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "data": [
    {
      "site": "string",
      "customer": "user@example.com",
      "remoteId": "string",
      "number": "string",
      "totalCents": 0,
      "subtotalCents": 0,
      "shippingCents": 0,
      "taxCents": 0,
      "currencyCode": "string",
      "createdAt": "2025-01-15T09:30:00Z",
      "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": "A4Ws1igz",
      "siteId": "A4Ws1igz",
      "customerId": "A4Ws1igz",
      "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": "...",
        "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

idstringrequired

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://your-store.meisei.app/api/orders/A4Ws1igz" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "id": "A4Ws1igz",
  "siteId": "A4Ws1igz",
  "customerId": "A4Ws1igz",
  "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": "A4Ws1igz",
    "type": "customers",
    "action": "created",
    "row": 0,
    "createdAt": "2025-01-15T09:30:00Z"
  },
  "itemsCount": 0,
  "customer": {
    "id": "A4Ws1igz",
    "email": "user@example.com",
    "phone": "string",
    "firstName": "string",
    "lastName": "string",
    "country": "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": "A4Ws1igz",
      "productId": "A4Ws1igz",
      "productVariantId": "string",
      "quantity": 0,
      "unitPriceCents": 0,
      "product": {
        "id": "...",
        "slug": "...",
        "title": "...",
        "description": "...",
        "imageUrl": "...",
        "url": "...",
        "brand": "...",
        "metadata": "...",
        "notes": "...",
        "averageRating": "...",
        "ratingCount": "...",
        "createdAt": "...",
        "updatedAt": "..."
      },
      "variant": {
        "id": "...",
        "slug": "...",
        "title": "...",
        "imageUrl": "...",
        "priceCents": "...",
        "currencyCode": "...",
        "available": "...",
        "gtin": "...",
        "mpn": "...",
        "metadata": "...",
        "externalId": "...",
        "externalIds": "..."
      }
    }
  ],
  "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

idstringrequired

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://your-store.meisei.app/api/orders/A4Ws1igz" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "metadata": "...",
  "notes": "string",
  "tags": [
    "string"
  ]
}'
Response
{
  "id": "A4Ws1igz",
  "siteId": "A4Ws1igz",
  "customerId": "A4Ws1igz",
  "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": "A4Ws1igz",
    "type": "customers",
    "action": "created",
    "row": 0,
    "createdAt": "2025-01-15T09:30:00Z"
  },
  "itemsCount": 0,
  "customer": {
    "id": "A4Ws1igz",
    "email": "user@example.com",
    "phone": "string",
    "firstName": "string",
    "lastName": "string",
    "country": "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": "A4Ws1igz",
      "productId": "A4Ws1igz",
      "productVariantId": "string",
      "quantity": 0,
      "unitPriceCents": 0,
      "product": {
        "id": "...",
        "slug": "...",
        "title": "...",
        "description": "...",
        "imageUrl": "...",
        "url": "...",
        "brand": "...",
        "metadata": "...",
        "notes": "...",
        "averageRating": "...",
        "ratingCount": "...",
        "createdAt": "...",
        "updatedAt": "..."
      },
      "variant": {
        "id": "...",
        "slug": "...",
        "title": "...",
        "imageUrl": "...",
        "priceCents": "...",
        "currencyCode": "...",
        "available": "...",
        "gtin": "...",
        "mpn": "...",
        "metadata": "...",
        "externalId": "...",
        "externalIds": "..."
      }
    }
  ],
  "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

idstringrequired

The ID of the order to delete.

Request
curl \
  -X DELETE \
  "https://your-store.meisei.app/api/orders/A4Ws1igz" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "id": "A4Ws1igz",
  "siteId": "A4Ws1igz",
  "customerId": "A4Ws1igz",
  "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": "A4Ws1igz",
    "type": "customers",
    "action": "created",
    "row": 0,
    "createdAt": "2025-01-15T09:30:00Z"
  },
  "itemsCount": 0,
  "customer": {
    "id": "A4Ws1igz",
    "email": "user@example.com",
    "phone": "string",
    "firstName": "string",
    "lastName": "string",
    "country": "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": "A4Ws1igz",
      "productId": "A4Ws1igz",
      "productVariantId": "string",
      "quantity": 0,
      "unitPriceCents": 0,
      "product": {
        "id": "...",
        "slug": "...",
        "title": "...",
        "description": "...",
        "imageUrl": "...",
        "url": "...",
        "brand": "...",
        "metadata": "...",
        "notes": "...",
        "averageRating": "...",
        "ratingCount": "...",
        "createdAt": "...",
        "updatedAt": "..."
      },
      "variant": {
        "id": "...",
        "slug": "...",
        "title": "...",
        "imageUrl": "...",
        "priceCents": "...",
        "currencyCode": "...",
        "available": "...",
        "gtin": "...",
        "mpn": "...",
        "metadata": "...",
        "externalId": "...",
        "externalIds": "..."
      }
    }
  ],
  "tags": ["string"]
}