Change an order

Stable throughout v1

Updates an order that has not yet become a Shopify order.

PATCH/orders/{id}
Base URLhttps://api.meetorderpilot.com/connect/v1
Stable throughout v1

Required access

API key
Change orderspermission
Request limit
Counts as 5 requests. Each key has a capacity of 15, restored at 0.6 a second.
Idempotency-Key optionalRetry with the same key and body to get the original response without repeating the change. The response includes Idempotent-Replayed: true. Responses are saved for 24 hours.

Headers

AuthorizationheaderRequired

Bearer and your key, opk_….

Idempotency-Keyheader

Up to 100 characters (letters, digits, - _ : .). Kept for 24 hours.

Content-Typeheader

application/json. A body is at most 256 KB.

Parameters

idpath · stringRequired

The id from a list.

Body

JSON
add_linesarray of objectOptional

Add lines: [{ template_id, quantity?, note?, price? }], [{ shopify_variant_id, shopify_product_id?, quantity?, note?, price? }] (or a Shopify product by its sku alone) or a custom item [{ title, price, quantity?, sku?, note? }] (up to 20). A template line is priced by the server from the template; a Shopify product line at the variant’s catalog price. A price each, and a custom item, set the price by hand: they need the right to change item prices (a key: Prices and exceptions, PRICING_WRITE), and a role’s discount limit applies; a template with no set price is added only with one. A Shopify product that is a composition goes on as its pieces, as the order screens add one: each its own line at its quantity times the line’s, at its catalog price, or, when the record already has the piece as a plain line (no options or discount, at its catalog price), that line’s quantity raised; the composition line takes no price or note, and one whose pieces can’t all be sold is refused, naming them. Can be sent with lines and remove_lines, alone otherwise.

notestringOptional
optionsarray of objectOptional

A template line’s option values [{ field_id, value }] or [{ option, value }] (the option by its name; see GET /product-templates/{id}), as POST /quotes takes them; a text-and-image option takes its picture in image_url.

field_idstringOptional
image_file_idstring, can be nullOptional

The picture’s Shopify file id, the shopify_file_id POST /files answered. Optional; sent with image_url.

image_urlstring, can be nullOptional

A text-and-image option’s or field’s picture: its Shopify Files URL, the url POST /files answered (another host is refused). Its text is value.

optionstringOptional

The option’s name (its label on GET /product-templates/{id}), instead of field_id.

valuestringOptional
pricenumberOptional

The price each, set by hand (from 0, 2 decimals). Required for a custom item.

quantityintegerOptional
shopify_product_idstringOptional
shopify_variant_idstringOptional
skustringOptional

A custom item’s SKU (optional, with its title). Without a title: the Shopify product’s variant with this SKU (exact, any case); several are 409 SKU_AMBIGUOUS, listed in error.matches.

template_idstringOptional
titlestringOptional

A custom item’s name, with its price.

custom_fieldsarray of objectOptional

Set order-level custom fields: [{ field_id, value }] (text, number, a dropdown option’s id or value, or a size as text such as 96 × 38 × 30; null clears one). A text-and-image field takes its text in value and its picture in image_url. Only the fields sent change; required fields are enforced as in the admin. Send on its own.

field_idstringOptional
image_file_idstring, can be nullOptional

The picture’s Shopify file id, the shopify_file_id POST /files answered. Optional; sent with image_url.

image_urlstring, can be nullOptional

A text-and-image option’s or field’s picture: its Shopify Files URL, the url POST /files answered (another host is refused). Its text is value.

valuestring, can be nullOptional
discountobject, can be nullOptional

The order-wide discount: { type: percentage | fixed_amount, value, reason, scope?: products_and_fees | products_only }, or null to remove it. Needs the right to override prices (a key: Prices and exceptions, PRICING_WRITE). A role’s discount limit applies as in the admin: over it the discount is refused (or allowed and flagged, as the shop chose). Send on its own. Not on an order already placed in Shopify (422 ORDER_LOCKED): give its lines their own discounts instead.

reasonstringOptional
scopestringOptional

One of products_and_fees, products_only.

typestringOptional

One of percentage, fixed_amount.

valuenumberOptional
expected_edit_tokenstringOptional

The edit_token you last read (optional; version holds it).

expected_updated_atstring (date-time)Optional

The updated_at you last read, when you don’t send version. A change made since is 409 STALE_VERSION.

feesobjectOptional

Add and/or remove fees: { add: [...], remove: [fee id] }. An added fee is a saved one at its set price, { template_id, quantity? }, or a custom one at your price, { name, type, value, quantity?, taxable?, physical? } (type: fixed_amount, percent_of_discounted_price, percent_of_total or percent_of_retail_price). A saved fee and a removal need only the right to edit. A custom fee is a pricing override: it needs the right to override prices (a key: Prices and exceptions, PRICING_WRITE). Send on its own.

addarray of objectOptional
namestringOptional
physicalbooleanOptional
quantityintegerOptional
taxablebooleanOptional
template_idstringOptional
typestringOptional

One of fixed_amount, percent_of_discounted_price, percent_of_total, percent_of_retail_price.

valuenumberOptional
removearray of stringOptional
line_fulfillmentobjectOptional

One item’s fulfillment, as the order page’s fulfillment pill sets it: where its units come from and how they reach the customer, in one part, or two to split the item (the parts’ quantities add up to the item’s). Works on quotes and orders. Pickup is at the record’s own store: to change the store, move the record with location_id first. line_id is any row of the item (split_group_id names a split item’s rows). Still allowed on a Shopify order under a status that locks editing; refused once the item is handed over or on a purchase order (422 RULE_REFUSED with why). Send on its own.

line_idstringOptional
partsarray of objectOptional
howstringOptional

Store pickup today, pickup on a later day, or delivery. Made to order is never pickup.

One of pickup, later, delivery.

location_idstring, can be nullOptional

Inventory from another store: its Shopify location id (GET /locations), one this caller may use. Null or left out: the order’s own location.

quantityintegerOptional
sourcestringOptional

From stock, or made (or ordered) for this order.

One of inventory, made_to_order.

linesarray of objectOptional

Change existing lines: { id, quantity?, note?, discount?, price? }. price sets the line’s price each by hand (a template line then stays hand-priced): it needs the right to change item prices (a key: Prices and exceptions, PRICING_WRITE), and a role’s discount limit applies to a Shopify product’s line priced under its catalog price. On an order already placed in Shopify a Shopify product’s line and a line with its own discount keep their price (422 RULE_REFUSED), as on the order page. Send on its own, not with other fields. No line is added or removed here.

discountobject, can be nullOptional

The line’s own discount, as the line read shows it: a percent, or an amount off each unit in currency (up to its price each, 2 decimals); null takes it off. Giving or raising one, or changing its type or reason, needs the Prices and exceptions scope (PRICING_WRITE); lowering or removing one doesn’t. A reason is required unless the store turned that off. A role’s discount limit applies as in OrderPilot.

reasonstringOptional
typestringOptional

One of percentage, fixed_amount.

valuenumberOptional
idstringOptional
notestring, can be nullOptional
pricenumberOptional

The price each, set by hand (from 0, 2 decimals).

quantityintegerOptional
location_idstringOptional

Move the record to this Shopify location (an active, billed one, from GET /locations). Not allowed once it is a Shopify order or linked to a purchase order.

notestring, can be nullOptional

The record’s note; null or empty clears it.

payment_terms_due_datestring (date)Optional

The day fixed-date terms fall due (YYYY-MM-DD), sent with their payment_terms_id; they are issued on it too, as in OrderPilot. Only for terms of type fixed; without it they are 422 TERMS_UNSUPPORTED.

payment_terms_idstring, can be nullOptional

A template id from GET /payment-terms; null removes the terms (and any deposit). A change needs the right to set payment terms (a key: Prices and exceptions, PRICING_WRITE). Terms with a fixed date need payment_terms_due_date.

remove_linesarray of stringOptional

Remove lines by id (up to 100). A record keeps at least one line; a line covered by a warranty plan or split for delivery isn’t removed here.

salesperson_idsarray of stringOptional

Staff ids credited with the sale (up to 5; the first is the primary and takes the assignment). A change needs the right to change sales credit (a key: Change sales credit, COMMISSION_WRITE). [] credits nobody.

ship_to_address_idstringOptional

Deliver to one of the customer’s saved addresses (an id from GET /customers/{id}/addresses). Send on its own with expected_updated_at. On an order already placed in Shopify the address is sent to its Shopify order on the queue (Shopify keeps the address it shipped to once it has fulfilled the order); not on a placed order split in two for tax, nor on a store pickup one.

shippingarray of objectOptional

The record’s delivery charges, replacing the current ones: [{ title, price }] (up to 5, price from 0 with 2 decimals); [] removes them. Needs the right to override prices (a key: Prices and exceptions, PRICING_WRITE). Send on its own. Not on a store pickup record.

pricenumberOptional
titlestringOptional
tagsarray of stringOptional

The record’s tags, replacing the current ones (up to 250, 40 characters each).

tax_modestringOptional

The order page’s tax choice: default (Shopify decides from the customer’s resale certificates), exempt (exempt this order from tax) or charge (charge tax despite a certificate; the order is then paid through its own payment link once placed, and the draft’s invoice link is withdrawn). Not once it is a Shopify order, nor on an order split in two for tax.

One of default, exempt, charge.

tax_mode_reasonstring, can be nullOptional

Why (up to 200 characters): required for exempt and charge unless the store turned that off. Left out with an unchanged tax_mode, the stored reason stays.

versionstringOptional

The version of the last answer about this record (its read, its list row or the last change), sent back as it is: no read needed first. A change made since is 409 STALE_VERSION with the current version and what changed. Send this or expected_updated_at.

Returns

200

OK: balance_due, cancelled_at, created_at, currency, custom_fields, custom_fields_truncated, customer, discount, edit_token, expiry and more

Errors

Errors use { "error": { "code", "message" } }. Use code to handle the error. View all error codes.

400

The request isn’t valid (see error.code), or the API version isn’t supported.

401

No valid access token or API key.

402

The store’s subscription isn’t active.

403

Not allowed: the API is off for this store, or the caller lacks the scope or permission.

404

Not found, or not visible to this caller.

405

Wrong method for this path; Allow lists every method the path takes.

408

The request body didn’t arrive in time.

409

The same Idempotency-Key is still being processed (REQUEST_IN_PROGRESS), its outcome is unknown (OUTCOME_UNKNOWN: check the record), or the record changed since it was read.

413

The request body is too large.

422

The request is valid JSON but can’t be done (a rule of the store refuses it), or the Idempotency-Key was used with a different body.

426

The app is older than the oldest version still served (error.code CLIENT_TOO_OLD); see error.min_version and error.upgrade_url.

429

Over a rate limit; wait Retry-After seconds.

500

Something went wrong on our side. A write may have partly happened: check the record before retrying it.

503

Busy, switched off, or billing couldn’t be checked; wait Retry-After seconds.

Was this page useful?