Change an option
Change an option of the library, as its editor saves it: its settings, its values (edited in place by option_id, new ones added, remove_option_ids deleted with every template’s prices for them), or turn it off (disabled: true: it leaves every template’s new lines; past orders keep it) and on again. Only what is sent changes. Send its version (or its updated_at as expected_updated_at): a change made since is 409 STALE_VERSION with the current version. A price on a new value needs Change the catalog or Prices and exceptions; a changed price, Change the catalog; any cost, Enter and correct costs. Every template using it syncs to Shopify in the background. Recorded on the option’s Activity.
Required access
- API key
- Change the catalogpermission
- Request limit
- Counts as 5 requests. Each key has a capacity of 15, restored at 0.6 a second.
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.
Parameters
The option’s id from GET /options.
Body
JSONA dropdown also takes a value typed in (Other…).
Which Shopify catalog lines offer it: every one (all, at location_ids), the products in product_ids, or those in category_ids. A template offers it only when it is attached.
One of all, products, categories.
Categories, ids from GET /categories (up to 100); null or []: none.
Starts as: a dropdown’s value by name (one of its values), or a typed option’s text or number as text.
Help text under it.
true turns it off: it leaves every template’s new lines, past orders keep it. false turns it on again.
Leave it out of generated SKUs.
The option’s updated_at from GET /options/{id}, when you don’t send version.
What customers see, when it differs from the name.
The locations it is offered at, ids from GET /locations (up to 250); null or []: every location.
Its default look online; null: automatic.
One of dropdown, buttons, segmented, radio_list, colour_swatches, image_swatches, image_cards, add_on_checkbox, number_box, stepper, slider, text_box, text_area, info_block.
The online look’s settings, by key: columns (2–6), shape (square, round), show_value_names (always, selected), show_prices. null drops one.
One of square, round.
One of always, selected.
A text’s most characters.
Unique in the library.
Its values’ prices read as part of the item’s price, never as “+$”.
Shopify products, ids from GET /products (up to 500).
Dropdown values to delete, by option_id (GET /options/{id}): every template’s price, cost and lead time for them go too; past orders keep their lines. Up to 500.
A size’s 2 or 3 measurements in order, as its editor sets them: label (up to 40 characters), key (made from the label when left out), min, max, step. A new size without them measures Length × Width × Height.
Lower-case letters, digits and _; an edit keeps a part by its key from GET /options/{id}.
Track each value’s stock in Shopify (not for a size).
A dropdown shown as a list (dropdown) or as colours (swatch).
One of dropdown, swatch.
A number’s or a size’s unit (in, cm, …).
A dropdown’s values (up to 500, the most an option holds). A typed option takes at most one: its price, cost and lead time.
Its cost; null: unknown. Needs costs.
One sentence shown online, up to 160 characters.
The picture’s shopify_file_id from POST /files: required with image_url, null with it.
Its picture: the url POST /files answered (a Shopify Files address); null removes it.
What customers see, when it differs.
Days it adds to the lead time (0 is Same day); null: none.
Edit this value in place: a values[].option_id of GET /options/{id} (a typed option’s one row is found without it). Without it, a new value.
Its place in the list, from 0.
Its price, 0 or more (0 is Included).
#rrggbb, for a swatches option.
Its name, up to 255 characters: required for a dropdown’s value (a typed option’s one row is named after the option).
The version of GET /options/{id} (or the last change) answered, 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
OK: allow_other, applies_to, category_ids, created_at, default_value, description, disabled, exclude_from_sku, id, label 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.