code and a human-readable message.
Error response format
details field with per-field error messages:
details (for example, scope errors include the required_scope):
Schema
HTTP status codes
Authentication & authorization
Resources
Validation
Orders
Customers
Store credits
Tags
Payments
Examples
Insufficient scope (API key)
403
Validation error (customer create)
422
Customer with completed orders
422
Concurrent order update
409
Handling errors with the SDK
@spree/admin-sdk throws a SpreeError for every non-2xx response:
Common patterns
Branch on error code:Optimistic locking
Orders use astate_lock_version column to detect concurrent modifications. Every state-changing operation increments it; if two callers update the same order simultaneously, the second write fails with cart_already_updated (409) — refetch and retry.
This protects against race conditions when multiple clients (or the same client, retried) try to mutate the same order. Combined with idempotency at the integration level (e.g., dedupe webhook deliveries by event ID), it makes admin order management safe under concurrency.
