List return inventories with pagination
ReturnInventory
List return inventories with pagination
GET
List return inventories with pagination
Returns a paginated list of return inventory records — the warehouse-side per-item state. Each record represents a single received item with its current handling decision, RMA, SKU mapping, and warehouse assignment.
When (and only when) to call
- One-time backfill when first integrating, to populate a local database with existing inventory before subscribing to webhooks.
- Periodic reconciliation to detect dropped or out-of-order webhook deliveries — diff your local cache against this endpoint’s results.
Required parameters
createFrom/createTo— both required, ISO 8601 timestamps. The window is capped at 62 days (SearchConfig.simpleRecordsMaxDays); wider ranges are rejected with a soft-error. See Window semantics below for the exact rule and what “62 days” really means.pageSize— between1and50inclusive.offset— non-negative integer. Combine withpageSizefor offset-based pagination.
Response notes
totalNumberOfRecords(top-level field, sibling todata) is the row count for the current window — use it as the upper bound when paginating.handlingCodereflects the current decision on the item — call Update return inventory handling to change it.handlingStatusCodereflects the workflow state for that handling decision; translate via Get all handling statuses.- An item’s RMA (
rma) is the warehouse-assigned identifier, not your seller-side reference numbers.
Backfilling historical inventory
Use this endpoint to seed your local database with every inventory record you’ve ever had, then switch to webhooks for everything afterwards. Because the API caps each request at 62 days, you walk the timeline in 62-day windows, paginate inside each window, and step backwards until you reach your account’s start date.Window semantics
Two rules to internalize before you build the loop — they’re the difference between a clean backfill and a backfill that silently drops a day.-
Validator rule (calendar-day diff):
The time-of-day is stripped before comparison. So a request with
createFrom = 2024-03-13T15:00:00ZandcreateTo = 2024-05-14T09:00:00Zis valid (May 14 − Mar 13 = 62days), even though wall-clock difference is less than 62 × 24h. -
Data filter (inclusive both ends, by full day):
That is, the server expands
createFromto that day’s00:00:00.000andcreateToto that day’s23:59:59.999before filtering. So a single legal request actually covers 63 consecutive calendar days of data (the full createFrom day, the full createTo day, and every day in between).
createFrom from window N as createTo for window N+1, the boundary day appears in both results. That’s a duplicate, not a gap — the algorithm never misses records, only over-fetches by ~1 day per window seam. As long as your local store uses returnInventoryId as the primary key with UPSERT (or INSERT IGNORE) semantics, the duplicates collapse and the final state is exact.
If you’d rather avoid the duplicate fetch entirely, step windowEnd = windowStart − 1 day between iterations instead of windowEnd = windowStart. Each window then covers a fresh 63-day slice with no overlap. Either approach is correct; the safe-overlap variant below is the recommended default because it tolerates clock skew between client and server.
Backfill algorithm
- Pick a
historyStart(e.g. the date your account was provisioned). - Start with
windowEnd = now(). - Compute
windowStart = max(windowEnd − 62 days, historyStart). - Inside the window, page from
offset = 0inpageSizechunks untiloffset ≥ totalNumberOfRecords. UPSERT each row keyed byreturnInventoryId. - Set
windowEnd = windowStartand repeat from step 3 untilwindowEnd ≤ historyStart. - From this point on, maintain your local store off the
newInventoryCreatedwebhook (and the other inventory-lifecycle events). Re-running this backfill is unnecessary unless you suspect webhook data loss.
Sample code
Related
- Get return inventory details — fetch a single record by
returnInventoryId(only when a webhook references one you don’t have cached). - Get return inventory by line item ID — look up by your
returnRequestLineItemId. - Update return inventory handling — write counterpart.
- Get all handling statuses and Get all handling types — code-to-label mappings.
- Webhooks — the canonical channel for inventory lifecycle events. Set up webhooks before relying on this endpoint.
Authorizations
Your API key
Your API token — keep this private
Query Parameters
Number of records per page (1–50)
Required range:
1 <= x <= 50