List and Filter Sales Orders
This guide covers reading sales orders from the GoodDay API: paging through results with opaque cursors, narrowing the result set with query parameters, and interpreting the response envelope.
All requests assume you have a bearer token with the read:sales_orders
scope. If you need help setting that up, start with the
authentication guide.
Base URL:
https://api.gooddayai.com/v1
The list endpoint
GET /sales-orders
Every sales-order list request accepts the following query parameters:
| Parameter | Type | Description |
|---|---|---|
cursor |
string | Opaque cursor from the previous page. Omit on the first request. |
limit |
integer | Page size. Defaults to the server default; upper bound enforced by the server. |
statuses |
string | Comma-separated status filter (e.g. open, draft, closed). |
fulfillmentReleaseStatus |
string | Return orders with a block in RELEASED or NOT_RELEASED state. |
updatedAt[gte] |
ISO-8601 | Only return orders updated at or after this timestamp. |
updatedAt[lte] |
ISO-8601 | Only return orders updated at or before this timestamp. |
Additional resource-specific filters are documented in the full API reference — this guide covers the shape of the response and the pagination contract.
Response envelope
Every list response wraps the page in a data array and includes a
pagination object that tells the client how to fetch the next page.
{
"data": [
{
"id": 10234,
"orderNumber": "SO-2026-0456",
"status": "open",
"salesOrderDate": "2026-04-19T12:30:00.000Z",
"customer": { "id": 88, "name": "Retail Partner Co." },
"totalPrice": 982.5
}
],
"pagination": {
"mode": "cursor",
"hasMore": true,
"nextCursor": "eyJpZCI6MTAyMDB9"
}
}
The pagination object is always present, even when data is empty.
Poll orders released for fulfillment
Creating a sales order does not release it. A staff action sets the block's fulfillment release state; the GoodDay API has no release endpoint. Poll for orders containing a released block:
curl "https://api.gooddayai.com/v1/sales-orders?fulfillmentReleaseStatus=RELEASED&limit=50" \
-H "Authorization: Bearer gd_yourTokenValueHere"
An unreleased order is not returned by this filter. Follow every page using the
opaque cursor exactly as returned; do not decode it or reuse it with different
sort options. Each matching block reports fulfillmentReleaseStatus as
RELEASED and includes fulfillmentReleaseDate. Release state is independent
of fulfillment completion: a fulfilled block remains in a RELEASED poll until
its release is explicitly revoked. Use order and block IDs to deduplicate
poll results and track fulfillment separately.
Cursor pagination, step by step
Cursors are opaque. Do not decode, edit, or construct them by hand. They are internal encodings of the server's sort position and are free to change format. Pass back whatever value the server returned.
The loop
- Call the endpoint without
cursorto get the first page. - If
pagination.hasMoreistrue, call it again withcursor=<pagination.nextCursor>to get the next page. - Stop when
pagination.hasMoreisfalse.nextCursorisnullon the final page.
curl
# First page
curl "https://api.gooddayai.com/v1/sales-orders?limit=50&statuses=open" \
-H "Authorization: Bearer gd_yourTokenValueHere"
# Next page — URL-encode the cursor if your shell needs it
curl "https://api.gooddayai.com/v1/sales-orders?limit=50&statuses=open&cursor=eyJpZCI6MTAyMDB9" \
-H "Authorization: Bearer gd_yourTokenValueHere"
JavaScript
async function* iterateSalesOrders(params = {}) {
let cursor = undefined;
while (true) {
const query = new URLSearchParams({ ...params, ...(cursor ? { cursor } : {}) });
const response = await fetch(`https://api.gooddayai.com/v1/sales-orders?${query}`, {
headers: { Authorization: `Bearer ${process.env.GOODDAY_API_TOKEN}` },
});
if (!response.ok) throw new Error(`GoodDay API ${response.status}`);
const body = await response.json();
for (const order of body.data) yield order;
if (!body.pagination.hasMore) return;
cursor = body.pagination.nextCursor;
}
}
// Usage
for await (const order of iterateSalesOrders({ statuses: 'open', limit: '100' })) {
console.log(order.id, order.orderNumber);
}
Python
import os
import requests
def iter_sales_orders(**params):
cursor = None
while True:
query = dict(params)
if cursor:
query["cursor"] = cursor
resp = requests.get(
"https://api.gooddayai.com/v1/sales-orders",
params=query,
headers={"Authorization": f"Bearer {os.environ['GOODDAY_API_TOKEN']}"},
timeout=30,
)
resp.raise_for_status()
body = resp.json()
for order in body["data"]:
yield order
if not body["pagination"]["hasMore"]:
return
cursor = body["pagination"]["nextCursor"]
for order in iter_sales_orders(statuses="open", limit=100):
print(order["id"], order["orderNumber"])
Filtering by status
Pass statuses=<value> to return only orders with a matching status, or a
comma-separated list (e.g. statuses=open,draft) to match any of several.
Common values:
draft— not yet openedopen— activeclosed— finalized
Combine with createdAtStart/createdAtEnd to build a window query — for
example, all open sales orders created in the last seven days:
FROM=$(date -u -d '7 days ago' +%Y-%m-%d)
curl "https://api.gooddayai.com/v1/sales-orders?statuses=open&createdAtStart=${FROM}&limit=100" \
-H "Authorization: Bearer gd_yourTokenValueHere"
On macOS/BSD, substitute date -u -v-7d +%Y-%m-%d for date -u -d '7 days ago' +%Y-%m-%d.
createdAtStart and createdAtEnd are both inclusive. Both filters are
applied at day resolution — the time portion of any ISO-8601 timestamp you
pass is ignored server-side. YYYY-MM-DD strings are therefore sufficient.
Getting a single sales order
Once you have an id from a list response, fetch the full payload
(including blocks and line items) with:
GET /sales-orders/:id
curl https://api.gooddayai.com/v1/sales-orders/10234 \
-H "Authorization: Bearer gd_yourTokenValueHere"
The single-resource response uses the same data envelope as the list,
plus the nested salesOrderBlocks array and each block's lineItems:
{
"data": {
"id": 10234,
"orderNumber": "SO-2026-0456",
"status": "open",
"salesOrderBlocks": [
{
"id": 5501,
"shipToLocation": { "id": 3, "name": "West Coast DC" },
"lineItems": [{ "id": 9001, "itemId": 1001, "unitsOrdered": 10, "unitPrice": 24.95 }]
}
]
}
}
Rate limits
The GoodDay API enforces per-merchant rate limits; when you exceed the
budget the server returns 429 Too Many Requests with a Retry-After
header (seconds). The best strategy for backfills is to combine an
async iterator like the ones above with a polite pause when you see a 429.
Common errors
| Status | Meaning |
|---|---|
| 400 | Bad cursor value |
| 401 | Bad or missing bearer token |
| 403 | Token lacks read:sales_orders |
| 422 | Validation failed on a query parameter (e.g. limit is 0) |
| 429 | Rate limit exceeded — honor Retry-After and try again |
Next steps
- Create a purchase order end-to-end
- Browse the full API reference for mutation endpoints
(
PATCH /:id,PATCH /:id/status) and the complete list of fields returned on a sales order.