This admin-only endpoint moves an order through its lifecycle. Transitioning toDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ALEJ4NDRO2025/urban-store/llms.txt
Use this file to discover all available pages before exploring further.
cancelled from any state other than pending or cancelled triggers automatic inventory restoration: each item’s stock is incremented back (using the stock_by_variant key when available, falling back to general stock). Setting status to paid for the first time also records a paid_at timestamp.
Endpoint
Authentication
Bearer token required withis_admin: true in the JWT payload. Returns 403 if the user is not an admin.
Path Parameter
The MongoDB ObjectId of the order to update (24-character hex string).
Request Body
The new status value. Must be one of the valid states listed below.
Valid Status Values
| Status | Description |
|---|---|
pending | Awaiting payment. Default state at order creation. |
paid | Payment confirmed. Sets paid_at on first transition. |
pending_shipment | Payment received; order is queued for dispatch. |
shipped | Order handed to carrier / delivered. |
cancelled | Order cancelled. Restores stock if previously beyond pending. |
Stock restoration only fires when transitioning to
cancelled from a state that is not pending or cancelled. Cancelling a pending order does not restore stock because stock was already decremented at order creation; those orders are cleaned up by the passive expiry mechanism instead.Behavior Details
Stock Restoration (on cancel)
Whennew_status == 'cancelled' and order.status not in ['pending', 'cancelled']:
- For each item in the order, the matching
Productis located byproduct_slug. - If
product.stock_by_variantcontains the key"<size>|<color>", that variant’s quantity is incremented byitem.quantity. - Otherwise, the product’s general
stockfield is incremented byitem.quantity.
paid_at Recording
If new_status == 'paid' and order.paid_at is currently null, paid_at is set to the current UTC time.
Request Example
Response — 200 OK
Returns the full updated order object (same shape asGET /api/orders/{order_id}/).
Error Responses
| Status | Condition |
|---|---|
400 Bad Request | status value is not one of the five valid states |
403 Forbidden | Caller is not an admin |
404 Not Found | No order found with the given order_id |