Get batches
API v2 is in public beta: endpoints and fields can change before general availability. See the changelog
/preorders/offers/{id}/batchesCosts 1 rate-limit point · Rate limits
Read the batch settings of a preorder offer: release strategy, advance schedule, labels, storefront widget and the kept batches in order.
Batches only run while release_strategy is sequential, which needs a paid plan, at least two items and an offer not scoped to markets. With advance_schedule automatic a variant moves to the next batch once it sells that batch's quantity_limit; with manual it waits for POST /preorders/offers/:id/products/advance_batches. Each item's label comes from label_format and is read-only. Per-variant batch limits and progress are on GET /preorders/offers/:id/products/variants. Edit with PATCH /preorders/offers/:id/batches.
Also searched asget batchesshow batchesview batchesbatch settingslist batches
Path parameters
idstringRequiredThe offer's ID, from
GET /preorders/offers.
Returns
release_strategystringsequential sells the batches one after another; all_at_once means batches are off.
One ofsequentialall_at_onceadvance_schedulestringautomatic moves to the next batch when one sells its quantity_limit; manual waits for the merchant.
One ofautomaticmanuallabel_formatstringBatch name format; {{ n }} is replaced by the position. Null uses "Batch {{ n }}".
status_textobjectWords shown on the storefront for past, live and upcoming batches.
Show 3 child attributesHide child attributes
paststringWord shown for a batch that has passed.
livestringWord shown for the batch on sale now.
upcomingstringWord shown for a batch still to come.
widgetobjectLayout and content of the storefront batch widget.
Show 4 child attributesHide child attributes
stylestringBatch widget layout: roadmap, stacked, compact or segmented.
progressstringcounts shows units sold of the limit; percent shows a percentage.
One ofcountspercentshow_other_ship_datesbooleanWhether the other batches' ship dates show on the storefront.
show_namesbooleanWhether batch names show on the storefront.
itemsarray of objectsThe batches, in selling order. Archived batches are left out.
Show 5 child attributesHide child attributes
idstringBatch ID, used as the key in a variant's batch_limits and batch_ship_texts.
positionintegerPlace in the selling order, from 1.
quantity_limitintegerUnits the batch can sell. Null when unlimited.
shipping_textstringShip text shown while this batch is on sale.
labelstringBatch name, from label_format with its position filled in.
Errors
not_foundThe path is valid but nothing with that id exists in this store.
invalid_paramsOne or more fields failed the action's schema.
validation_failedThe request failed validation.
Any request can also fail with auth_invalid (401) or rate_limited (429).
Every error has the same shape: see Errors and the list of error codes.
curl "https://app.stoqapp.com/api/v2/external/preorders/offers/73a74948-2b57-4cc3-971f-2b441828c977/batches" \
-H "X-Auth-Token: $STOQ_API_KEY"const res = await fetch("https://app.stoqapp.com/api/v2/external/preorders/offers/73a74948-2b57-4cc3-971f-2b441828c977/batches", {
headers: {
"X-Auth-Token": process.env.STOQ_API_KEY,
},
});
const data = await res.json();import os
import requests
res = requests.get(
"https://app.stoqapp.com/api/v2/external/preorders/offers/73a74948-2b57-4cc3-971f-2b441828c977/batches",
headers={"X-Auth-Token": os.environ["STOQ_API_KEY"]},
)
data = res.json()require "net/http"
require "json"
uri = URI("https://app.stoqapp.com/api/v2/external/preorders/offers/73a74948-2b57-4cc3-971f-2b441828c977/batches")
req = Net::HTTP::Get.new(uri, "X-Auth-Token" => ENV["STOQ_API_KEY"])
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body){
"release_strategy": "sequential",
"advance_schedule": "automatic",
"label_format": "string",
"status_text": {
"past": "string",
"live": "string",
"upcoming": "string"
},
"widget": {
"style": "string",
"progress": "counts",
"show_other_ship_dates": true,
"show_names": true
},
"items": [
{
"id": "string",
"position": 1,
"quantity_limit": 1,
"shipping_text": "string",
"label": "string"
}
]
}{
"errors": [
"Invalid API key"
],
"code": "auth_invalid",
"details": [
{
"code": "auth_invalid",
"message": "Invalid API key",
"path": null,
"value": null,
"expected": null
}
]
}{
"errors": [
"Offer not found"
],
"code": "not_found",
"details": [
{
"code": "not_found",
"message": "Offer not found",
"path": null,
"value": null,
"expected": null
}
]
}{
"errors": [
"name is required"
],
"code": "validation_failed",
"details": [
{
"code": "validation_failed",
"message": "name is required",
"path": null,
"value": null,
"expected": null
}
]
}{
"errors": [
"Rate limit exceeded"
],
"code": "rate_limited",
"details": [
{
"code": "rate_limited",
"message": "Rate limit exceeded",
"path": null,
"value": null,
"expected": null
}
]
}