Create a quote
Creates a customer’s quote using prices from your product templates. The quote saves immediately; its Shopify draft order follows, which can change the quote number and totals. Read the quote again before reporting them.
Required access
- API key
- Create and change quotespermission
- Request limit
- Counts as 5 requests. Each key has a capacity of 15, restored at 0.6 a second.
Nothing is sent to the customer. Sending the quote, turning it into an order and deleting it are endpoints of their own, each with its own scope.
Idempotent-Replayed: true. Responses are saved for 24 hours.Headers
Bearer and your key, opk_….
Up to 100 characters (letters, digits, - _ : .). Kept for 24 hours.
application/json. A body is at most 256 KB.
Body
JSONOrder-level custom fields [{ field_id, value }]; the shop required ones must be sent (see GET /custom-fields), and every one missing is listed in the refusal (error.missing, with each one’s choices). A text-and-image field takes its text in value and its picture in image_url.
The picture’s Shopify file id, the shopify_file_id POST /files answered. Optional; sent with image_url.
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.
The customer by their email (any case), instead of customer_id: the one customer with it is quoted. None is 404 CUSTOMER_NOT_FOUND (find them with GET /customers or make them with POST /customers first) and several 409 CUSTOMER_AMBIGUOUS, listed in error.matches.
An id from GET /customers (or POST /customers). Or send customer_email instead.
The quote’s discount, as PATCH /quotes/{id} sets it: { type, value, reason, scope? }. Needs Prices and exceptions (PRICING_WRITE); a role’s discount limit applies.
One of products_and_fees, products_only.
One of percentage, fixed_amount.
Fees to add, as PATCH /quotes/{id} adds them: { add: [...] }, a saved one { template_id, quantity? } (GET /fee-templates) or a custom one { name, type, value, quantity?, taxable?, physical? } (needs Prices and exceptions).
One of fixed_amount, percent_of_discounted_price, percent_of_total, percent_of_retail_price.
At least one. Each is a product template (template_id, with its options), a Shopify product (shopify_variant_id, shopify_product_id optional, or its sku alone) or a custom item (title and price, with sku optional). The server prices a template line from the template and a Shopify product line at its variant’s catalog price. A price each on a template or Shopify product line, 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 as in OrderPilot. A line also takes its own discount and fulfillment, as PATCH /quotes/{id} sets them. A Shopify product that is a composition goes on as its pieces, as the order screens add one: each piece its own line at its quantity times the line’s, at its catalog price (a piece also sent as a plain line raises that line’s quantity); the composition line takes no price, note, discount or fulfillment, and one whose pieces can’t all be sold is refused, naming them.
The line’s own discount: a percent, or an amount off each unit (up to its price each, 2 decimals). Needs Prices and exceptions (PRICING_WRITE); a reason is required unless the store turned that off; a role’s discount limit applies.
One of percentage, fixed_amount.
The line’s fulfillment, as PATCH /quotes/{id}’s line_fulfillment sets it: one part, or two to split the line (their quantities add up to the line’s; one part may leave its quantity out).
A template line’s option values: [{ field_id, value }] or [{ option, value }] (the option by its name, as GET /product-templates/{id} labels it), 1 to 30, each option once. value is text, a number, a dropdown value’s option_id, value or label (spacing and capitals don’t count), or a size as text such as 96 × 38 × 30; a text-and-image option takes its text in value and its picture in image_url. A name two options or values answer to is 409 OPTION_AMBIGUOUS; an unknown one lists the template’s options and values in the refusal. Required options are checked as in the admin, every missing one in error.missing. The server prices the line with them. Not on a Shopify product line.
The picture’s Shopify file id, the shopify_file_id POST /files answered. Optional; sent with image_url.
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.
The option’s name (its label on GET /product-templates/{id}), instead of field_id.
The price each, set by hand (from 0, 2 decimals). Optional on a template or Shopify product line; required for a custom item. Needs Prices and exceptions.
1–9999 (default 1).
Optional with shopify_variant_id: the variant’s own product.
A Shopify product’s variant; its product is read with it. A composition’s goes on as its pieces.
A custom item’s SKU (optional, with its title). Without a title: the Shopify product’s variant with this SKU (exact, any case); none is 422 SKU_NOT_FOUND and several 409 SKU_AMBIGUOUS, listed in error.matches.
A custom item’s name (up to 255 characters), with its price.
A Shopify location id from GET /locations. Defaults to the first active location.
The day fixed-date terms fall due (YYYY-MM-DD), with their payment_terms_id.
A template id from GET /payment-terms. Needs the right to set payment terms (a key: Prices and exceptions, PRICING_WRITE). Terms with a fixed date need payment_terms_due_date.
Staff ids credited with the sale (up to 5; the first is the primary and takes the assignment). Other than the create’s own needs Change sales credit (COMMISSION_WRITE).
Deliver to one of the customer’s saved addresses (an id from GET /customers/{id}/addresses), instead of shipping_address.
Delivery charges [{ title, price }] (up to 5), as PATCH /quotes/{id} sets them. Needs Prices and exceptions (PRICING_WRITE). Not on a quote whose every line is picked up.
The quote’s tags (up to 250, 40 characters each).
The tax choice, as PATCH /quotes/{id} sets it: default, exempt or charge.
One of default, exempt, charge.
Why (up to 200 characters): required for exempt and charge unless the store turned that off.
| customer_id | GET /customers?q=Priya | Read customers |
| template_id | GET /product-templates/{id} | Read the catalog |
| options | GET /product-templates/{id} | Read the catalog |
| location_id | GET /locations | Any quote scope |
| custom_fields | GET /custom-fields | Read quotes |
Returns
Created: balance_due, cancelled_at, created_at, currency, custom_fields, custom_fields_truncated, customer, discount, edit_token, expiry and more
Accepted: the write is done, but its record couldn’t be read back. Don’t send it again: read it with `read`.: charge_id, content_version, done, id, message, number, payment_id, read, refund, reopened and more
Errors
Errors use { "error": { "code", "message" } }. Use code to handle the error. View all error codes.
The request isn’t valid (see error.code), or the API version isn’t supported.
No valid access token or API key.
The store’s subscription isn’t active.
Not allowed: the API is off for this store, or the caller lacks the scope or permission.
Not found, or not visible to this caller.
Wrong method for this path; Allow lists every method the path takes.
The request body didn’t arrive in time.
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.
The request body is too large.
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.
The app is older than the oldest version still served (error.code CLIENT_TOO_OLD); see error.min_version and error.upgrade_url.
Over a rate limit; wait Retry-After seconds.
Something went wrong on our side. A write may have partly happened: check the record before retrying it.
Busy, switched off, or billing couldn’t be checked; wait Retry-After seconds.