Skip to main content

Create Bulk Invoices

Creates an invoice for each order in the list, the same way as Create Invoice from an order. Orders that cannot be invoiced are listed in errors, and the other orders are still invoiced.

HTTP Request​

  • URL: /invoices/bulk
  • Method: POST
  • Headers:
    • accessToken: Required. Your API access token.
    • Content-Type: application/json
  • Required scope: READ_WRITE_INVOICE

Request Body​

The request body is a JSON object with the list of order IDs.

FieldTypeRequiredDescription
orderIdsArrayYesIDs of the orders to invoice. At least one.
sendEmailBooleanNotrue to email each new invoice to its customer. Default is false.

cURL Example​

curl --location '<BASE_URL>/invoices/bulk' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"orderIds": ["664f2310d5775459152d6dd8", "664f2310d5775459152d6dd9"],
"sendEmail": false
}'

Response​

  • 200 OK: At least one invoice was created.
  • 400 Bad Request: The list is missing or invalid, an order was not found, or none of the orders could be invoiced.
  • 401 Unauthorized: The access token is missing or invalid.
  • 403 Forbidden: The access token does not have the required scope.

Sample JSON Response​

{
"success": true,
"message": "Successfully created 1 invoice(s)",
"data": [
{
"id": "665f2310d5775459152d6dd8",
"entityId": "INV-1003",
"order": "664f2310d5775459152d6dd8",
"orderEntityId": "ORD-1042",
"status": "open",
"total": 552,
"paidAmount": 0
}
],
"errors": [
{
"orderId": "664f2310d5775459152d6dd9",
"error": "An invoice (INV-1001) already exists for this order"
}
]
}

Response Details​

Bulk Invoice Data​

FieldTypeDescription
successBooleanWhether at least one invoice was created.
messageStringNumber of invoices created.
dataArrayThe new invoices. See Get Invoice for all fields.
errorsArrayOrders that were not invoiced, each with orderId and error. Only present when some orders were skipped.

Notes​

  • An order is skipped if it already has an active invoice, is cancelled, or has no items.
  • Each invoice uses the store's default terms and the order's metafields. Use Update Invoice to change them.