Update batches
BetaAPI v2 is in public beta: endpoints, fields and behaviour can change before general availability. See the changelog
const url = 'https://app.stoqapp.com/api/v2/external/preorders/offers/example/batches';const options = { method: 'PATCH', headers: {'X-Auth-Token': '<X-Auth-Token>', 'Content-Type': 'application/json'}, body: '{"release_strategy":"sequential","items":{"6f1c9e2a-0d4b-4c1e-9a57-2f0e8d3b7c11":{"quantity_limit":120}}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://app.stoqapp.com/api/v2/external/preorders/offers/example/batches \ --header 'Content-Type: application/json' \ --header 'X-Auth-Token: <X-Auth-Token>' \ --data '{ "release_strategy": "sequential", "items": { "6f1c9e2a-0d4b-4c1e-9a57-2f0e8d3b7c11": { "quantity_limit": 120 } } }'Update any subset of the batch settings on a preorder offer, including the batches themselves.
Note: Deep partial: absent fields are unchanged; items[].label is read-only.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Sequential sells the batches one after another (needs at least two batches, a paid plan, and no market-specific offer); all_at_once turns batches off. Turning batches on uses one shipping timeline for every product and moves a Scheduled fulfillment status (shipping.delivery_timing exact_time) to Unfulfilled (asap), listed in also_changed, as the editor does.
Automatic moves to the next batch when one sells its quantity_limit (every batch then needs one); manual waits for the merchant.
Batch name; {{ n }} is replaced by the position. null uses “Batch {{ n }}”.
object
Word shown for a batch that has passed.
Word shown for the batch on sale now.
Word shown for a batch still to come.
object
Storefront batch widget layout.
Counts shows units sold of the limit; percent shows a percentage.
Show the other batches’ ship dates on the storefront.
Show batch names on the storefront.
The batches. A list replaces them: entries with an id keep that batch, entries without one are created, and batches left out are archived. An object keyed by batch id edits those batches (quantity_limit, shipping_text) and keeps the rest. Kept batches stay in their current order and new ones go at the end; positions end up 1..N. Each batch needs shipping_text; quantity_limit is all or none across batches.
Example
{ "release_strategy": "sequential", "items": { "6f1c9e2a-0d4b-4c1e-9a57-2f0e8d3b7c11": { "quantity_limit": 120 } }}Responses
Section titled “Responses”Success — example response shown.
object
Example
{ "release_strategy": "sequential", "advance_schedule": "automatic", "label_format": "Batch {{ n }}", "status_text": { "past": "Sold out", "live": "Live", "upcoming": "Coming soon" }, "widget": { "style": "roadmap", "progress": "counts", "show_other_ship_dates": true, "show_names": false }, "items": [ { "id": "6f1c9e2a-0d4b-4c1e-9a57-2f0e8d3b7c11", "position": 1, "quantity_limit": 120, "shipping_text": "Ships in June", "label": "Batch 1" }, { "id": "a3d8b5f0-7e21-4b9c-8f64-1c2d9e0a5b37", "position": 2, "quantity_limit": 200, "shipping_text": "Ships in July", "label": "Batch 2" } ]}Saved. Returns the updated section, with also_changed for cascades.
object
Example generated
{}Missing or invalid X-Auth-Token.
Error envelope returned by every failed request.
object
Example
{ "errors": [ "Unauthorized" ]}The resource does not exist for this shop, or the action path is not registered.
Error envelope returned by every failed request.
object
Example
{ "errors": [ "Offer not found" ]}Invalid fields, keyed by canonical section paths. Nothing was saved.
object
object
Example generated
{ "errors": { "additionalProperty": [ "example" ] }}Rate limited — cost-weighted per token (read 1, write 2; 360 points / 60s). Check Retry-After.
Error envelope returned by every failed request.
object
Example
{ "errors": [ "Rate limit exceeded" ]}Thanks for letting us know.
Still stuck? Ask Quinn or chat with support