Create Invoice
Creates an invoice in one of two ways:
- From an order: send
orderId. The line items, addresses, amounts, payment term, amount paid, status and due date are taken from the order. - Standalone: send
"standalone": truewith the full invoice details, for invoices that do not come from a store order (for example, invoices from your ERP).
Each order can have one active (not voided) invoice.
HTTP Request
- URL:
/invoices - 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. Use the first table to create an invoice from an order, or the second table for a standalone invoice.
Invoice From an Order
| Field | Type | Required | Description |
|---|---|---|---|
orderId | String | Yes | ID of the order to invoice. The order must have items and must not be cancelled. |
notes | String | No | Notes shown on the invoice. |
termsAndConditions | String | No | Terms shown on the invoice. Default is the store's default terms. |
metaFields | Array | No | Custom field values, each with code and value. Default is the order's metafields. |
sendEmail | Boolean | No | true to email the invoice to the customer. Default is false. |
Standalone Invoice
Include at least one of companyId, customerId or customerDetails.email.
| Field | Type | Required | Description |
|---|---|---|---|
standalone | Boolean | Yes | Set to true. |
lineItems | Array | Yes | Invoiced items, at least one. See Line Item Object. |
total | Number | Yes | Invoice total. |
companyId | String | No | ID of the company to bill. Its details are filled in if companyDetails is not sent. |
customerId | String | No | ID of the customer to bill. Their details are filled in if customerDetails is not sent. |
customerDetails | Object | No | Customer firstName, lastName, email and phoneNumber. |
companyDetails | Object | No | Company name, email and phoneNumber. |
orderId | String | No | ID of a related order. |
billingAddress | Object | No | Billing address. See Address Object. |
shippingAddress | Object | No | Shipping address. See Address Object. |
currency | Object | No | Currency currency (code) and symbol. Default is the store currency. |
selectedCurrency | Object | No | Customer's currency currency and exchange rate. The currency must be set up in the store. |
selectedCurrencyAmount | Object | No | Amounts in the selected currency. Calculated from rate if not sent. |
subTotal | Number | No | Subtotal. Default is the sum of the line totals. |
lineDiscountAmount | Number | No | Line discounts. Default is the sum of the line discounts. |
discountAmount | Number | No | Order-level discount. |
shippingCost | Number | No | Shipping charge. |
shippingDiscountAmount | Number | No | Discount on shipping. |
taxAmount | Number | No | Tax. |
storeCreditAmount | Number | No | Store credit used. |
additionalCosts | Array | No | Extra charges, each with name and amount. |
shipmentDetails | Object | No | Shipping method, as shippingMethod with name and label. |
status | String | No | draft, open, partially_paid, paid or void. Default is based on paidAmount and total. |
paidAmount | Number | No | Amount already paid. Default is 0. |
issuedDate | String | No | Issue date. Default is today. |
dueDate | String | No | Due date. Default is based on the payment term. |
paymentTerm | Object | No | Payment term name, paymentDueDays and dueType (net or fulfillment). Default is the store's default invoice payment term. |
voidReason | String | No | Reason, when creating a void invoice. |
termsAndConditions | String | No | Terms shown on the invoice. |
notes | String | No | Notes shown on the invoice. |
metaFields | Array | No | Custom field values, each with code and value. |
sendEmail | Boolean | No | true to email the invoice to the customer. Default is false. |
Line Item Object
| Field | Type | Required | Description |
|---|---|---|---|
name | String | Yes | Item name. |
sku | String | Yes | Item SKU. |
quantity | Number | Yes | Quantity, greater than 0. |
price | Number | Yes | Unit price. |
extendedPrice | Number | Yes | Line total. |
discountAmount | Number | No | Line discount. |
productId | String | No | ID of the matching store product. |
variantId | String | No | ID of the matching variant. |
options | Array | No | Variant options, each with optionName, optionValueLabel and optionValue. |
Address Object
| Field | Type | Required | Description |
|---|---|---|---|
address1 | String | Yes | Street address. |
city | String | Yes | City. |
state | Object | Yes | State name and code. |
country | Object | Yes | Country name and code. |
firstName, lastName | String | No | Name. |
companyName | String | No | Company name. |
address2 | String | No | Additional address line. |
zipcode | String | No | Postal code. |
phoneNumber | String | No | Phone number. |
cURL Example
Create an invoice from an order:
curl --location '<BASE_URL>/invoices' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"orderId": "664f2310d5775459152d6dd8",
"notes": "Invoiced per customer PO #4521",
"metaFields": [{ "code": "erpInvoiceId", "value": "ERP-INV-88213" }],
"sendEmail": true
}'
Create a standalone invoice:
curl --location '<BASE_URL>/invoices' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"standalone": true,
"customerId": "664dec6cd5775459152d4926",
"billingAddress": {
"firstName": "Maria",
"lastName": "Lopez",
"address1": "4100 Industrial Blvd",
"city": "Austin",
"state": { "name": "Texas", "code": "TX" },
"country": { "name": "United States", "code": "US" },
"zipcode": "78744"
},
"lineItems": [
{ "name": "On-site safety training (July)", "sku": "SVC-TRAIN", "quantity": 10, "price": 150, "extendedPrice": 1500 }
],
"total": 1500
}'
Response
- 200 OK: The invoice was created.
- 400 Bad Request: A required field is missing or invalid, the order, company or customer was not found, the order cannot be invoiced, or the order already has an invoice.
- 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": "Invoice created successfully",
"data": {
"id": "665f2310d5775459152d6dd8",
"entityId": "INV-1002",
"order": null,
"customer": "664dec6cd5775459152d4926",
"customerDetails": {
"firstName": "Maria",
"lastName": "Lopez",
"email": "maria.lopez@northwindsupply.com",
"phoneNumber": "512-555-0142"
},
"lineItems": [
{
"id": "665f2310d5775459152d6ddb",
"name": "On-site safety training (July)",
"sku": "SVC-TRAIN",
"quantity": 10,
"price": 150,
"extendedPrice": 1500,
"discountAmount": 0
}
],
"subTotal": 1500,
"total": 1500,
"status": "open",
"issuedDate": "2026-07-13T08:39:44.791Z",
"dueDate": "2026-08-12T08:39:44.791Z",
"paidAmount": 0,
"createdBy": { "id": "6489b2479467bbcf8c3d33aa", "name": "ERP Connector", "type": "api" },
"createdAt": "2026-07-13T08:39:44.816Z",
"updatedAt": "2026-07-13T08:39:44.816Z"
}
}
Response Details
Invoice Data
| Field | Type | Description |
|---|---|---|
success | Boolean | Whether the invoice was created. |
message | String | Result message. |
data | Object | The new invoice. See Get Invoice for all fields. |
Notes
- The due date is the issue date plus the payment term's due days. For
fulfillmentpayment terms, it is counted from the latest shipment date and is empty until the order ships. Without a payment term, the due date is the issue date. - An invoice created from an order can already be
partially_paidorpaidif the order has been paid. - A voided invoice does not stop you from creating a new invoice for the same order.
- To invoice many orders at once, use Create Bulk Invoices.