# Grid API Pagination The Grid API supports very large datasets, up to billions of records. To deal with large results in your code, it often makes sense to paginate the results into multile batches. ## Pagination Requests You can control the batch size with the `page` and `size` fields in your requset payload. ```javascript Example pagination request { ... // other fields omitted for brevity "page": 0, // to get the first page (pages start at 0) "size": 100 // to get 100 records per page (min: 10, max: 10,000) } ``` ObservePoint recommends specifying the `size` and `page` parameters in your request payload, even though they are optional. This gives you more control over the result sizes. ## Pagination Responses The Grid API response tells you the number of records in the dataset via the `metadata` → `pagination` property: ```javascript Example pagination metadata response { ... // other fields omitted for brevity "metadata": { "pagination": { "currentPageNumber": 0, // first page "pageSize": 100, // from your "size" request "currentPageSize": 100, // the number of records will always be "size" except for the last page in most cases "totalCount": 4201, // the total number of records in the dataset "totalPageCount": 43, // the total number of pages in the dataset } } } ``` To get all the results in the dataset, you'll need to iterate over the pages, incrementing the `page` parameter each time, until you've received `totalCount` records.