Pagination
The Writer API supports pagination for list endpoints. By default, the API returns 50 results per page. See below for more information about how to paginate your API requests.
Pagination parameters
The following parameters are available for pagination in the API:
Parameter | Type | Description |
---|---|---|
limit | integer | The number of items to return per page. The default is 50. The maximum is 100. |
order | string | The order in which to return the items, based on the created_at field for the resource. The default is desc . The possible values are asc and desc . |
before | string | The ID of first object in the previous page. This parameter instructs the API to return the previous page of results. |
after | string | The ID of the last object in the next page. This parameter instructs the API to return the next page of results. |
Pagination response
The API returns the following pagination information in the response body:
Parameter | Type | Description |
---|---|---|
has_more | boolean | Indicates whether there are more pages of results. |
first_id | string | The ID of the first object in the collection. |
last_id | string | The ID of the last object in the collection. |
Pagination example: Retrieving files
Retrieve two most recently created files
The following cURL command retrieves the two most recently created files.
The response body contains the two most recently created files, along with the pagination information:
- The
has_more
parameter istrue
, indicating that there are more files to retrieve - The
first_id
parameter is the ID of the first file in the collection - The
last_id
parameter is the ID of the last file in the collection
Retrieve the next page of results
To retrieve the next page of results, you can use the after
parameter to specify the ID of the last object in the previous page.
SDK support
The Python and JavaScript SDKs provide iterators that automatically handle pagination for you. See more information about pagination in the Python SDK and JavaScript SDK documentation.