API Basics

Pagination and Filters

Page through lists with a cursor, filter them by time, and change their order.

Every list pages the same way, and every time-based list takes the same time filter. This page also covers sort and include.

Pagination

Every list returns data, nextCursor and hasMore.

{
  "data": [{ "id": "pst_3c8a2d6e91b44f7a8e250d6b4c1f9a73" }],
  "nextCursor": "eyJrZXkiOjE4MDM...",
  "hasMore": true
}
FieldMeaning
dataThe items of this page
nextCursorThe cursor of the next page, null on the last
hasMoretrue when another page follows

Pass nextCursor as cursor until hasMore is false. Send the cursor unchanged, and keep the other parameters the same.

Leave cursor out to start over. On lists such as posts, accounts and media, a changed or foreign cursor returns 400 INVALID_CURSOR.

import { Configuration, PostsApi } from "@onepostly/sdk";

const postsApi = new PostsApi(
  new Configuration({ accessToken: process.env.ONEPOSTLY_API_KEY })
);

let cursor: string | undefined;
do {
  const page = await postsApi.listPosts({ status: "published", limit: 100, cursor });
  for (const post of page.data) {
    console.log(post.id, post.url);
  }
  cursor = page.nextCursor ?? undefined;
} while (cursor);

Page Size

limit sets the page size of a list. A value below 1 or above the maximum for that list returns 400 VALIDATION_ERROR.

ListDefaultMaximum
Most lists50100
Comments and Facebook Page reviews5050
Account media2020

Comments, reviews and account media follow the platform's page size. Each endpoint in the API Reference lists its limit.

Time Filters

Time-based lists and reports take since and until.

RuleDetail
FormatISO 8601 with Z or an offset, such as 2026-08-01T00:00:00Z
sinceInclusive
untilExclusive
DefaultsEach endpoint has its own, see below
Ordersince must be before until

A date alone or a time without a zone returns 400 VALIDATION_ERROR. A since after until returns 400 INVALID_RANGE.

Since until is exclusive, one window ends where the next begins. For all of August, send since=2026-08-01T00:00:00Z and until=2026-09-01T00:00:00Z. Encode + as %2B in a query string.

EndpointFilters onDefault
GET /v1/postsSchedule, else publish, else creation timeNo limit
GET /v1/accountsConnection timeNo limit
GET /v1/webhooks/{id}/deliveriesDelivery timeThe last 7 days
GET /v1/posts/{id}/analytics/timelineUTC days90 days, also the maximum
GET /v1/accounts/{id}/analyticsThe insights periodThe platform's default

Deliveries are kept for your plan's log retention. A since older than that starts at the oldest delivery that is still kept.

Sorting

Some lists take sort, a field and a direction, such as created_desc for newest first. Every other list has a fixed order, mostly newest first.

Listsort valuesDefault
GET /v1/postscreated_*, published_*, scheduled_*, metric:<name>created_desc
GET /v1/accountscreated_desc, created_asccreated_desc

Each * is desc or asc. See List Posts for the metric sorts.

Include

Some lists add extras when you ask with include, a comma-separated list.

ListincludeAdds
GET /v1/poststotal, facetsTotal, and counts per status and platform
GET /v1/accountstotalTotal
GET /v1/mediatotalTotal
GET /v1/webhooks/{id}/deliveriesfacets, histogramCounts per status, and results over time

total counts every match across all pages. An unknown value returns 400 VALIDATION_ERROR with the accepted values.

Errors

CodeHTTPCauseFix
VALIDATION_ERROR400A bad limit, time format, sort or includeFix the field in param
INVALID_CURSOR400cursor is not from this listUse the last nextCursor, or drop cursor
INVALID_RANGE400since is not before until, or the range is too longFix the dates

Other codes are in Errors.