Add a line to a draft order
Authorizations
A secret API key. Publishable keys cannot reach this API. A key may carry an expiry, and an expired key is refused exactly like an unknown one, with a 401 that names no reason; check the key's expires_at in the dashboard rather than inferring it from a response. When a merchant rolls a key's secret they choose a grace window of up to 3 days, and for its duration BOTH the new secret and the one it replaced authenticate, so an integration moves over on its own deploy schedule instead of at the instant the button is pressed. Move before the window closes: after it, the old secret is refused. Nothing else about this contract moves with a roll. The key keeps its id and its scopes, so the only thing an integration updates is the credential itself.
Headers
A unique key per logical write. Replaying a request with the same key returns the first response byte for byte instead of applying the write twice.
Path Parameters
Body
TWO FIELDS, and the shortness is the point. The line's price and both titles are read from the catalogue inside the same transaction, so this call chooses WHICH variant and HOW MANY and never what it costs. unit_price_minor, product_title and variant_title are refused BY NAME. ADDING A VARIANT THE DRAFT ALREADY CARRIES ADDS TO ITS QUANTITY rather than replacing it, and the existing line keeps the price it was quoted at. Use the PATCH below to set an absolute quantity. The response is the DRAFT with its totals recomputed, not the line: a line is not separately addressable, so a 201 would promise a Location that does not exist.
A variant in this store. One that is not is 400 invalid_body naming variant_id, rather than a 404, because the draft in the path does exist and a 404 would send you to debug the wrong id.
REQUIRED and never defaulted to 1: a defaulted quantity turns a field lost in a marshal into a wrong quote that looks right.
x >= 1Response
Success
