API reference · Sandbox
Have the sandbox buyer ask to cancel an order
/sandbox/orders/{orderId}/cancellation-requestsSandbox only: the production API does not serve this operation. Snapcaster's sandbox buyer asks the seller to cancel an order, the whole order or some of its lines, with an optional reason, exactly as a buyer does from their order page. It works only on an order from this seller's own test purchase; any other order returns 404 ORDER_NOT_FOUND. Snapcaster emails the seller and sends order.cancellation_request.created, the same as for a real buyer. Answer it with POST /orders/{orderId}/cancellation-requests/{requestId}/decline, or honor it by cancelling the lines. A retry with the same Idempotency-Key and body replays the first response. Returns the pending request.
Example
These examples send requests to the sandbox.
Replace the example orderId in the URL with your own.
curl --request POST \
--url 'https://api-sandbox.snapcaster.ca/api/v1/marketplace/sandbox/orders/ord_sandbox_01K4A8Y6D4QJH2N3P5R7S9T0VW/cancellation-requests' \
--header "Authorization: Bearer $MARKETPLACE_API_KEY" \
--header "Idempotency-Key: $(uuidgen)" \
--header 'Content-Type: application/json' \
--data '{
"lines": [
{
"lineRef": "oln_1f0c8a4d7e2b45c9a1d6f3b8e07c9241",
"quantity": 1
}
],
"reason": "Ordered the wrong printing"
}'$(uuidgen) makes a new Idempotency-Key each time you run the command. To retry a command after a lost response, send the key from the first attempt.
{
"success": true,
"data": {
"id": "cnr_8d3f2a61b0c94e7f9a15c2d48e6b7031",
"order_id": "ord_sandbox_01K4A8Y6D4QJH2N3P5R7S9T0VW",
"status": "pending",
"reason": "Ordered the wrong printing",
"resolution_note": null,
"created_at": "2026-09-04T19:01:12.000Z",
"resolved_at": null,
"lines": [
{
"line_ref": "oln_1f0c8a4d7e2b45c9a1d6f3b8e07c9241",
"sku_id": 14602,
"quantity": 1
}
]
}
}Endpoint
| Environment | URL |
|---|---|
| Sandbox | https://api-sandbox.snapcaster.ca/api/v1/marketplace |
marketplaceApiKey-http bearer. Send the seller's marketplace API key asAuthorization: Bearer mp_{sellerCode}_{hex}. Themp_{sellerCode}_prefix identifies the seller; the trailing hex is the secret. The seller generates the key and supplies it to your platform.
Request
Path parameters
orderIdstring requiredThe opaque public order id (the webhook/poll
order_id).Constraints: minimum length: 1 Example
ord_sandbox_01K4A8Y6D4QJH2N3P5R7S9T0VW
Headers
Idempotency-Keystring requiredKeep this UUID when retrying the same order operation and body. Keys remain valid for the lifetime of the order. Changed contents return 409 IDEMPOTENCY_CONFLICT; a concurrent attempt returns 409 REQUEST_IN_PROGRESS with Retry-After.
Constraints: format: uuid Example
f04e4a96-3c99-44dc-abce-5b6862c589c9X-Snapcaster-Api-VersionstringOverride the platform pin for this request only. Webhook versions and the platform pin do not change.
Constraints: allowed values:
2026-10Example2026-10
Request body
linesarray of objectThe line items in this request, response, or event.
Constraints: minimum items: 1
Show child fieldsHide child fields
lines[].stringlineRef The purchase-line ref (
oln_…) of the order line this entry names, read from the order's own lines. Name a line bylineRefor byskuId;lineRefis needed only when the SKU is on more than one line the command can still act on.Constraints: pattern:
^oln_[0-9a-f]{32}$Exampleoln_1f0c8a4d7e2b45c9a1d6f3b8e07c9241lines[].integerskuId The SKU of the order line this entry names. Name a line by
skuIdor bylineRef. When the SKU is on more than one line the command can still act on, the command answersORDER_LINE_AMBIGUOUSwith the candidatelineRefs; name the line by one of them. Supply exactly one oflineRefandskuId.Constraints: exclusive minimum: 0
lines[].integerquantity The number of units.
Constraints: exclusive minimum: 0 Example
1
reasonstringConstraints: minimum length: 1; maximum length: 1000 Example
Ordered the wrong printing
Response
201
The pending cancellation request.
Response body: Cancellation
successboolean requiredWhether the operation completed as requested.
Constraints: allowed values:
trueExampletruedataCancellationrequiredRequest The operation or event payload.
Show child fieldsHide child fields
data.string requiredid The cancellation request id (
cnr_…), stable for the life of the request (STABLE).Example
cnr_8d3f2a61b0c94e7f9a15c2d48e6b7031data.string requiredorder_id The order the buyer asked to cancel (STABLE).
Example
ord_sandbox_01K4A8Y6D4QJH2N3P5R7S9T0VWdata.string requiredstatus pendinguntil it is answered.honored: a cancellation covered it.declined: the seller refused it, withresolution_note.withdrawn: the buyer took it back (STABLE).Constraints: allowed values:
pending,honored,declined,withdrawnExamplependingdata.string or null requiredreason The buyer's own words, or null when they gave none (STABLE).
Example
Ordered the wrong printingdata.string or null requiredresolution_note The decline reason the buyer is shown. Null unless
statusisdeclined(STABLE).Example
nulldata.string requiredcreated_at When the buyer opened the request (STABLE).
Constraints: format: date-time Example
2026-09-04T19:01:12.000Zdata.string or null requiredresolved_at When the request was honored, declined or withdrawn. Null while it is pending (STABLE).
Constraints: format: date-time Example
nulldata.array of object or null requiredlines The lines the buyer asked to cancel, or null when they asked to cancel the whole order (STABLE).
Show child fieldsHide child fields
data.string or null requiredlines[]. line_ref The purchase line the buyer asked to cancel, the same
line_refthe order carries. Null only on a request recorded before line refs existed.Example
oln_1f0c8a4d7e2b45c9a1d6f3b8e07c9241data.integer requiredlines[]. sku_id The SKU now on that line (STABLE).
Example
14602data.integerlines[]. quantity How many units the buyer asked to cancel. Omitted means the whole line (STABLE).
Constraints: exclusive minimum: 0 Example
1
Errors
Errors return a Marketplace body, except HTTP 413, 500 (Api). Error codes explains both error bodies and lists every code.
400
INVALID_REQUESTIDEMPOTENCY_KEY_REQUIREDORDER_LINE_AMBIGUOUSUNSUPPORTED_API_VERSIONInvalid command body, missing/invalid UUID Idempotency-Key, or a
skuIdon more than one line the command can still act on (ORDER_LINE_AMBIGUOUS, with the candidatelineRefsindetails). Unknown or retired API-version override (UNSUPPORTED_API_VERSION).Do this: Correct the request fields and supply a UUID Idempotency-Key. For ORDER_LINE_AMBIGUOUS, name that line by one of the
lineRefvalues indetails. Keep the same key when retrying the same command. For UNSUPPORTED_API_VERSION, choose a supported version from the API versioning guide.401
UNAUTHORIZEDMissing or invalid marketplace API key (
UNAUTHORIZED).Do this: Send the marketplace API key for this seller as a Bearer token, then retry.
403
SUBSCRIPTION_EXCLUDES_ORDERSThe platform's subscription is
inventory, which does not include orders (SUBSCRIPTION_EXCLUDES_ORDERS). Onlyordersandbothsubscriptions read and act on orders.Do this: Do not retry. Ask Snapcaster to change the platform subscription to
ordersorbothif the platform should handle orders.404
ORDER_NOT_FOUNDNo order matches this id for the authenticated seller (
ORDER_NOT_FOUND). Another seller's order also returns 404, so the response does not reveal whether it exists. An order of this seller that no test purchase of this seller created also returns 404 (ORDER_NOT_FOUND): the sandbox buyer acts only on orders fromPOST /sandbox/test-purchases.Do this: Use an order_id from GET /sandbox/test-purchases/{ref} for this seller.
409
IDEMPOTENCY_CONFLICTREQUEST_IN_PROGRESSREQUEST_ALREADY_OPENCANCELLATION_REQUEST_LIMIT_REACHEDIDEMPOTENCY_CONFLICT or REQUEST_IN_PROGRESS. Retry an in-progress command with the same key after Retry-After seconds. REQUEST_ALREADY_OPEN when a cancellation request is already pending on the order. CANCELLATION_REQUEST_LIMIT_REACHED when the order already had three.
Do this: For REQUEST_IN_PROGRESS, wait Retry-After seconds and retry the same key and body. For IDEMPOTENCY_CONFLICT, reuse the original body or create a new UUID for a different operation. For REQUEST_ALREADY_OPEN, decline the pending request first. For CANCELLATION_REQUEST_LIMIT_REACHED, use another test purchase.
413
PAYLOAD_TOO_LARGEThe body is larger than this route accepts (
PAYLOAD_TOO_LARGE).Do this: Send a smaller body and retry.
422
CANCELLATION_NOT_ALLOWEDThe buyer could not ask for this cancellation (
CANCELLATION_NOT_ALLOWED): the order has shipped, or a line has fewer units left to cancel than asked.Do this: Ask before you mark the order shipped, or name fewer units.
500
INTERNAL_ERRORAn unexpected failure (
INTERNAL_ERROR).Do this: Retry with bounded retries and jitter. If the failure persists, contact Snapcaster with the X-Correlation-ID response header.
503
TEST_PURCHASE_NOT_AVAILABLEThis deployment cannot act as the sandbox buyer right now (
TEST_PURCHASE_NOT_AVAILABLE): it is not the sandbox, its payments are not in test mode, or its sandbox buyer is missing.Do this: Call the sandbox API. If this persists there, contact Snapcaster with the X-Correlation-ID response header.