Pagination
List endpoints return one page at a time, with an opaque cursor for the next page.
List endpoints return results one page at a time. Each response tells you whether there is another page and how to get it.
These endpoints are paginated:
- List quotes:
GET /v1/quotes, newest first - List cases:
GET /v1/cases - List case messages:
GET /v1/cases/{caseId}/messages, oldest first
The list response
{
"data": [
{ "quoteId": "qot_01ARZ3NDEKTSV4RRFFQ69G5AV", "...": "..." }
],
"hasMore": true,
"links": {
"next": {
"href": "/v1/quotes?cursor=eyJ...",
"cursor": "eyJ..."
}
}
}| Field | Meaning |
|---|---|
data | The items on this page. |
hasMore | true when another page exists. Always the same as links.next being non-null. |
links.next | The next page, or null on the last page. |
links.next.cursor | An opaque cursor. Pass it as ?cursor= to get the next page. |
links.next.href | The full path of the next page, relative to https://api.prets.app. It already contains the cursor. |
When there is a next page, the response also carries an HTTP Link header with the same URL:
Link: </v1/quotes?cursor=eyJ...>; rel="next"There is no total count, no page numbers, and no previous page. Pages only go forward.
Fetching every page
Start without a cursor. Then follow links.next until it is null:
# First page
curl "https://api.prets.app/v1/quotes?limit=100" \
-H "Authorization: Bearer ak_..."
# Next page: use links.next.href, or pass links.next.cursor yourself
curl "https://api.prets.app/v1/quotes?cursor=eyJ..." \
-H "Authorization: Bearer ak_..."href keeps the options of your first request, such as expand on quotes and the state, quoteId, and updatedSince filters on cases. If you build the next URL from cursor yourself, send those options again.
Page size
Pages hold up to 250 items. To ask for fewer, pass limit (1 to 250) on the first request. The cursor remembers that size for the rest of the list, so limit is ignored when you send cursor. A value outside 1 to 250 returns 400.
A page can hold fewer items than limit. Use hasMore or links.next to decide whether to continue, never the page length.
Cursors
Treat a cursor as an opaque string. Don't build, parse, or change one. A cursor that Prets can't read returns 400 with param: "cursor".
Keeping in sync
To pick up changed cases without reading the whole list again, pass updatedSince to List cases. It returns cases whose updatedAt is at or after that time. Store the time you started each sync and use it as updatedSince next time.
For changes as they happen, subscribe to events instead of polling. See Create an event destination.