Documentation
REST API
Build a custom returns flow on the headless core.
The REST API exposes the full returns lifecycle. All write endpoints accept an idempotency key.
Create a return
http
POST /v1/portal/returns
Content-Type: application/json
Idempotency-Key: rt_2048_v1
{
"order_id": "2048",
"line": { "sku": "knit-navy-m" },
"reason": "FIT_TOO_SMALL_SHOULDER",
"resolution": "EXCHANGE",
"exchange_size": "L"
}Advance state
Returns move through a state machine: draft → submitted → approved → in_transit → received → graded → closed (with rejected, flagged, and cancelled branches). Each transition is a single merchant endpoint.
http
POST /v1/merchant/returns/:id/:event
# :event ∈ approve | reject | flag | unflag
# ship | receive | grade | close
# fit signals are emitted at: received, graded, closedEvery write is idempotent and every state change is published as an HMAC-signed webhook, so agents and back-office tools can follow a return end to end.
