PostEverywhere Pagination Reference
How to paginate through PostEverywhere API results. Offset-based pagination with limit and offset parameters.
List endpoints return paginated results using offset-based pagination. You control the page size with limit and skip results with offset.
The limit and offset parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit |
integer | 20 (50 on /v1/campaigns) |
Number of items to return. Minimum 1, maximum 100. |
offset |
integer | 0 |
Number of items to skip before returning results. |
A paginated request, end to end
Fetch the second page of 10 posts:
curl "https://app.posteverywhere.ai/api/v1/posts?limit=10&offset=10" \
-H "Authorization: Bearer pe_live_abc123..."
What a paginated response contains
Paginated endpoints include a pagination object alongside the results:
{
"data": {
"posts": [
{ "post_id": "9f3c4d12-...", "content": "..." },
{ "post_id": "a81e7b50-...", "content": "..." }
],
"pagination": {
"limit": 10,
"offset": 10
}
},
"error": null,
"meta": {
"request_id": "a1b2c3d4",
"timestamp": "2026-03-01T12:00:00Z"
}
}
The pagination object contains:
| Field | Type | Description |
|---|---|---|
limit |
integer | The limit value used for this request. |
offset |
integer | The offset value used for this request. |
total |
integer | (Since 2026-06-11 on /v1/posts + /v1/campaigns) The total matching count: lets you know if there are more pages without fetching. |
has_more |
boolean | (Since 2026-06-11 on /v1/posts + /v1/campaigns) true if more pages exist beyond this one. |
Looping through every page of results
The recommended pattern (using has_more):
import { PostEverywhere } from '@posteverywhere/sdk';
const client = new PostEverywhere({ apiKey: process.env.POSTEVERYWHERE_API_KEY });
async function fetchAllPosts() {
const allPosts = [];
const limit = 50;
let offset = 0;
while (true) {
const { posts, pagination } = await client.posts.list({ limit, offset });
allPosts.push(...posts);
if (!pagination.has_more) break;
offset += limit;
}
return allPosts;
}
The older pattern (fallback for endpoints that don't yet return has_more): keep iterating until the response returns fewer items than the requested limit:
import { PostEverywhere } from '@posteverywhere/sdk';
const client = new PostEverywhere({
apiKey: process.env.POSTEVERYWHERE_API_KEY,
});
async function fetchAllPosts() {
const allPosts = [];
const limit = 50;
let offset = 0;
while (true) {
const response = await client.posts.list({ limit, offset });
const posts = response.posts; // the SDK unwraps the { data } envelope for you
allPosts.push(...posts);
// If fewer results than the limit, we've reached the last page
if (posts.length < limit) {
break;
}
offset += limit;
}
return allPosts;
}
Which endpoints support pagination
The following list endpoints support limit and offset parameters:
- List Posts -- filter by status and platform
- List Media -- filter by media type
- List Campaigns -- default
limitis 50; returnstotalandhas_more
Related: invalid parameter errors · campaigns list pagination · aggregate counts without paging · your first API call