Pagination
The SKUs endpoint is the only paginated endpoint in the Prediko API. All other endpoints (Orders, Suppliers, Locations) return complete result sets.
Paginated Endpoint
Section titled “Paginated Endpoint”| Endpoint | Method | Pagination |
|---|---|---|
/api/v1/skus | POST | ✅ Yes |
/api/v1/orders | GET | ❌ No (returns all) |
/api/v1/suppliers | GET | ❌ No (returns all) |
/api/v1/warehouses | GET | ❌ No (returns all) |
Query Parameters
Section titled “Query Parameters”The SKUs endpoint accepts these pagination parameters:
| Parameter | Type | Default | Max | Description |
|---|---|---|---|---|
limit | integer | 1000 | 5000 | Number of results per page |
offset | integer | 0 | - | Number of results to skip |
Response Format
Section titled “Response Format”The SKUs endpoint returns a pagination object with metadata:
{ "data": [...], "pagination": { "total": 1250, "limit": 100, "offset": 0, "has_more": true }}Pagination Fields
Section titled “Pagination Fields”| Field | Description |
|---|---|
total | Total number of SKUs available |
limit | Number of SKUs returned in this page |
offset | Number of SKUs skipped |
has_more | Whether more SKUs exist after this page |
Example: Paginating Through All SKUs
Section titled “Example: Paginating Through All SKUs”import requests
def get_all_skus(api_key): all_skus = [] offset = 0 limit = 1000 # Use default limit for efficiency
while True: response = requests.post( "https://api.prediko.io/api/v1/skus", headers={ "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" }, params={"limit": limit, "offset": offset}, json={} ) data = response.json()
all_skus.extend(data["data"])
if not data["pagination"]["has_more"]: break
offset += limit
return all_skus
# Usageskus = get_all_skus("YOUR_API_KEY")print(f"Total SKUs: {len(skus)}")async function getAllSkus(apiKey) { const allSkus = []; let offset = 0; const limit = 1000;
while (true) { const response = await fetch( `https://api.prediko.io/api/v1/skus?limit=${limit}&offset=${offset}`, { method: "POST", headers: { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json" }, body: JSON.stringify({}) } ); const data = await response.json();
allSkus.push(...data.data);
if (!data.pagination.has_more) { break; }
offset += limit; }
return allSkus;}
// Usageconst skus = await getAllSkus("YOUR_API_KEY");console.log(`Total SKUs: ${skus.length}`);Best Practices
Section titled “Best Practices”- Use the default limit - 1000 records per page is efficient for most use cases
- Check
has_more- Always check this field before making another request - Handle empty results - The first page may be empty if no SKUs match your filters
- Use filters - Reduce result sets with filters like
name_likeorwith_material