{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Pagination","description":"Reference, guides, and webhooks for the Aiwyn API: clients, contacts, engagements, projects, billing, payments, time, and files.","llmstxt":{"title":"Aiwyn API","description":"Aiwyn Product API documentation. Start with reference/quickstart.md; the API reference lists every endpoint, its required role, its request and response schemas, and the webhook payload."}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"pagination","__idx":0},"children":["Pagination"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Collection endpoints (list endpoints such as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /gql/v1/clients"]},") use"," ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["limit/offset"]}," pagination controlled by two body parameters."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Meaning"},"children":["Meaning"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pageSize"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["limit"]},": how many records to return. Default ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["50"]},", maximum ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1000"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["offset"]},": how many records to ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["skip"]},". It is ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["not"]}," a 0-based or 1-based page number."]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To read the next block of records, advance ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]}," by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pageSize"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"knowing-when-you-have-reached-the-end","__idx":1},"children":["Knowing when you have reached the end"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Every collection response includes an aggregate count:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"total\": { \"aggregate\": { \"count\": 25156 } }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["total.aggregate.count"]}," to know how many records exist. When ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]}," is greater"," ","than or equal to that count, the data array comes back empty."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"worked-example","__idx":2},"children":["Worked example"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["With 25,156 clients and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pageSize: 1000"]},":"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Request"},"children":["Request"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Records returned"},"children":["Records returned"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pageSize: 1000"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page: 0"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["records 1–1000"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pageSize: 1000"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page: 1000"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["records 1001–2000"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pageSize: 1000"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page: 25000"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["records 25001–25156 (156 rows)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pageSize: 1000"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page: 25156"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["empty array"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Do ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["not"]}," send ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page: 26"]}," expecting \"page 26\" of 1,000-record pages. That skips"," ","only 26 records and still returns a full ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pageSize"]}," of results."]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This limit/offset model is the stable v1 contract and will not change. A future"," ","API version may introduce conventional page-number pagination under a new version"," ","prefix."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"endpoints-that-page-by-page-number","__idx":3},"children":["Endpoints that page by page number"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["These endpoints use a ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["zero-based page number"]}," instead of the offset model above."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"webhook-subscriptions-and-delivery-history","__idx":4},"children":["Webhook subscriptions and delivery history"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /api/v1/event-subscriptions"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /api/v1/event-subscriptions/{id}/deliveries"]}," take two"," ","optional query parameters:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Meaning"},"children":["Meaning"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Zero-based page number. Default ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0"]},"; must not be negative."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["limit"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Page size. Default ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["50"]},", between ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1000"]},"."]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An out-of-range ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["limit"]}," returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["400"]},". ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}," is a page:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{ \"content\": [], \"totalElements\": 0, \"totalPages\": 0, \"currentPage\": 0, \"hasNext\": false, \"hasPrevious\": false }\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"time-management-code-and-entry-lookups","__idx":5},"children":["Time management code and entry lookups"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /api/v1/codes/batch/{type}"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /api/v1/entries/batch/{type}"]},", the per-type code lookups"," ","(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /api/v1/time-codes/batch"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/api/v1/expense-codes/batch"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/api/v1/operational-codes/batch"]}," and"," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/api/v1/pto-codes/batch"]},") and the per-type entry lookups (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /api/v1/time-entries/batch"]},","," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/api/v1/expense-entries/batch"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/api/v1/operational-entries/batch"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/api/v1/pto-entries/batch"]},") take a body"," ","such as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{ \"pageSize\": 25, \"page\": 0 }"]},":"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Meaning"},"children":["Meaning"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pageSize"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Records per page, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["100"]},". Default ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["25"]},"; a value outside that range returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["400"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Zero-based page index (default ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0"]},"). The lookup skips ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page * pageSize"]}," records."]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A page beyond the last record returns no records."]}]},"headings":[{"value":"Pagination","id":"pagination","depth":1},{"value":"Knowing when you have reached the end","id":"knowing-when-you-have-reached-the-end","depth":2},{"value":"Worked example","id":"worked-example","depth":2},{"value":"Endpoints that page by page number","id":"endpoints-that-page-by-page-number","depth":2},{"value":"Webhook subscriptions and delivery history","id":"webhook-subscriptions-and-delivery-history","depth":3},{"value":"Time management code and entry lookups","id":"time-management-code-and-entry-lookups","depth":3}],"frontmatter":{"seo":{"title":"Pagination"}},"lastModified":"2026-11-18T05:03:56.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/reference/pagination","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}