Skip to main content

Pagination

List endpoints return paginated results using offset-based pagination. You control the page size with limit and skip results with offset.

Parameters

ParameterTypeDefaultDescription
limitinteger20Number of items to return. Minimum 1, maximum 100.
offsetinteger0Number of items to skip before returning results.

Example Request

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..."

Response Format

Paginated endpoints include a pagination object alongside the results:

{
"data": {
"posts": [
{ "id": 1, "content": "..." },
{ "id": 2, "content": "..." }
],
"pagination": {
"limit": 10,
"offset": 10
}
},
"error": null,
"meta": {
"request_id": "req_abc123",
"timestamp": "2026-03-01T12:00:00Z"
}
}

The pagination object contains:

FieldTypeDescription
limitintegerThe limit value used for this request.
offsetintegerThe offset value used for this request.
totalinteger(Since 2026-06-11 on /v1/posts + /v1/campaigns) The total matching count — lets you know if there are more pages without fetching.
has_moreboolean(Since 2026-06-11 on /v1/posts + /v1/campaigns) true if more pages exist beyond this one.

Iterating Through All 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.data.posts;

allPosts.push(...posts);

// If fewer results than the limit, we've reached the last page
if (posts.length < limit) {
break;
}

offset += limit;
}

return allPosts;
}

Paginated Endpoints

The following list endpoints support limit and offset parameters: