Pagination
In order to support a larger maximum number of campaigns and efficient retrieval of all entities associated with an account, the Advertiser API now supports pagination on many GET endpoints. The paging mechanism is easy to use and very similar to the REST API’s cursor-based pagination as described in Using cursors to navigate collections.
Getting Started
For designated GET requests, we now accept cursor
and count
query parameters, which are both optional. If a response has more than count
entities, these endpoints will now return the first count
entities and a next_cursor
key in the response JSON.
GET https://ads-api.x.com/5/accounts/abc1/campaigns?count=50
To get the next series of responses, you would add cursor
to your query params:
GET https://ads-api.x.com/5/accounts/abc1/campaigns?cursor=c-3yvu1pzhd3i7&count=50
Going Deeper
For most endpoints, the maximum count
value is 1,000, the minimum is 1, and the default is 200.
The value provided by next_cursor
is always a string, and should be considered opaque; the implementation is subject to change. If less than count
entities are returned in the current page of the result set, the next_cursor
value will be null
.
Note: the analytics endpoints do not support this style of pagination. Paging on the stats endpoints is supported by specifying periods of time. See the documentation of those individual endpoints for more information.