API Conventions
Pagination
Navigate large collections with cursor-based pagination
⌘I
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
New: Stripe & TossPayments integration guides now available →
Navigate large collections with cursor-based pagination
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | integer | 20 | Items per page (1–100) |
starting_after | string | — | Cursor: return items after this ID |
{
"data": [
{ "id": "prod_abc", "name": "Product A" },
{ "id": "prod_def", "name": "Product B" }
],
"has_more": true,
"next_cursor": "prod_def"
}
| Field | Type | Description |
|---|---|---|
data | array | The list of items |
has_more | boolean | Whether more items exist after this page |
next_cursor | string | null | The ID to pass as starting_after for the next page |
let cursor: string | undefined;
const allProducts = [];
do {
const params = new URLSearchParams({ limit: '100' });
if (cursor) params.set('starting_after', cursor);
const res = await fetch(
`https://api.headlesscommerce.io/v1/storefront/products?${params}`,
{ headers: { Authorization: `Bearer ${apiKey}` } },
);
const body = await res.json();
allProducts.push(...body.data);
cursor = body.has_more ? body.next_cursor : undefined;
} while (cursor);
# Filter by status + sort by creation date
GET /v1/admin/products?status=active&sort=created_at&order=desc&limit=50