Pagination
The Octopart API uses limit/offset pagination. There are no cursors – you control the window into results with two parameters: limit and start.
Parameters
Parameter |
Default |
Maximum |
Description |
|
10 |
100 |
Number of results to return |
|
0 |
1000 |
Zero-based offset into the result set |
How it Works
start is an item offset, not a page number. To retrieve a specific page, multiply the page index by limit:
start = page * limit (where page 0 is the first page)
The hits field in the response returns the total number of matching results, which may be larger than what you can retrieve. The maximum reachable offset is 1000 – results beyond that are not accessible through pagination.
Examples
Return 15 results from the beginning:
query FirstPage {
supSearchMpn(q: "acs770", limit: 15) {
hits
results {
part {
id
mpn
}
}
}
}
Return the next page (items 15–29):
query SecondPage {
supSearchMpn(q: "acs770", limit: 15, start: 15) {
hits
results {
part {
id
mpn
}
}
}
}
Paging Through Results
To iterate through all results, increment start by limit until you have retrieved all items or reached the offset limit:
page 0: start=0, limit=100 page 1: start=100, limit=100 page 2: start=200, limit=100 ... page 9: start=900, limit=100 ← last reachable page at max limit
If hits exceeds 1000, the remaining results are not reachable through pagination. In practice, narrow your search query or apply filters to keep the result set within range.