OverviewProductsPlatformsAPI ReferenceResources
Posts

List posts

GEThttps://zernio.com/api/v1/posts

Returns a paginated list of posts. Published posts include platformPostUrl with the public URL on each platform. A query parameter that is not listed here returns 400 naming it and the accepted parameters, so a misspelled filter never silently returns the unfiltered list.

Authentication

AuthorizationBearer tokenRequired

API key authentication: send your Zernio API key in the Authorization header, prefixed with Bearer.

Query parameters

Optional
pageintegerDefault 1

Page number (1-based)

limitintegerDefault 10

Page size. Values above the maximum return 400 rather than being clamped.

offsetinteger

Row offset. Takes precedence over page when both are sent; the response pagination.page is derived from it.

cursorstring

Opaque cursor from a previous response's pagination.nextCursor. Returns the next page in the same sortBy order and takes precedence over page and offset.

Each cursor page costs the same however deep it is, unlike page/offset, which get slower the further you go. Prefer it to walk a long history.

  • Send the same filters and sortBy as the request that issued it. A cursor from another sortBy returns 400.
  • Not available with sortBy=status or sortBy=platform, or with source=external.
fieldsstring

Comma-separated list of post fields to return. Each post then carries _id plus only these fields, which makes large pages much cheaper: leave out platforms, content, mediaItems or metadata when you do not need them.

Accepted: userId, title, content, mediaItems, platforms, scheduledFor, timezone, status, tags, hashtags, mentions, visibility, metadata, recycling, recycledFromPostId, queuedFromProfile, queueId, createdAt, updatedAt.

An unknown field returns 400 naming it. fields=_id returns ids only. Omit it (or send it empty) for the full post. Not available with source=external.

viewstringDefault fullOne of full | summary

full returns the whole post. summary returns only what an agent needs to read a page of posts:

  • Post: _id, title, content, status, scheduledFor, timezone, tags, createdAt, updatedAt, and contentNotRetained when set.
  • Each platform: platform, status, accountId (the id), username, scheduledFor, publishedAt, platformPostId, platformPostUrl, errorMessage, errorCategory.
  • Left out: the author (userId), mediaItems, metadata, recycling, and each platform's custom content, custom media and platformSpecificData. Null values are left out too.

Works with both sources. Send either fields or view=summary: both together return 400.

updatedSincestring (date-time)

Only posts whose updatedAt is at or after this ISO 8601 timestamp (an offset or Z required).

updatedAt moves when the post or any of its platforms changes (an edit, a status change, a platform publishing or failing). To keep a copy in sync, send the time of your previous sync instead of reading every page again.

Combines with the other filters and with cursor. Deleted posts are not returned. Not available with source=external.

sourcestringDefault zernioOne of zernio | external

Which collection to read. zernio (default) returns posts authored through Zernio. external returns posts synced from the platform (existing/historical posts that were published outside Zernio). Combine with accountId and paginate via page/limit to walk the full synced history (we keep up to the last ~12 months per account).

statusstringOne of draft | pending_approval | scheduled | publishing | published | partial | failed | cancelled
platformstring
profileIdstring

Filter posts to a specific profile (24-char hex ObjectId), including drafts filed under it without platforms. Omit it, or send all or an empty value, to list posts across every profile.

createdBystring

Filter posts to those created by a specific team user (24-char hex ObjectId).

fromDatestring (date)

Zero-padded YYYY-MM-DD, or a full ISO 8601 datetime. An empty value means no date filter; any other malformed value returns 400. The same name the other date-window filters use (ads, analytics).

toDatestring (date)

Zero-padded YYYY-MM-DD, or a full ISO 8601 datetime. An empty value means no date filter; any other malformed value returns 400. The same name the other date-window filters use (ads, analytics).

dateFromDeprecatedstring (date)

Alias of fromDate, kept for existing callers

dateToDeprecatedstring (date)

Alias of toDate, kept for existing callers

includeHiddenbooleanDefault false
searchstring

Search posts by text content.

tagsstring

Comma-separated tags (at most 20). Returns only posts carrying every listed tag, matched exactly and case-sensitively against the tags set when the post was created. An empty value means no tag filter. tag is accepted as an alias.

sortBystringDefault scheduled-descOne of scheduled-desc | scheduled-asc | created-desc | created-asc | status | platform

Sort order for results.

accountIdstring

Filter posts to those published via a specific account (24-char hex ObjectId).

Responses

Success· the request worked

Errors· the request failed

Check an OAuth app's keys

Checks the saved keys with the platform again and records the outcome in `status` and `lastError`.

Create post

Create a post, and optionally publish it in the same request. A post published immediately (`publishNow: true`) comes back with `platformPostUrl` in the response. On prepaid-balance billing, X posts are paid from the balance ($0.015 per post, $0.20 with a link). At a $0 balance, publishing to X now returns 402 `insufficient_balance` with `funding_url`, and a post saved for later waits for funds (202). ## Optional content `content` is optional in four cases: - media is attached - all platforms have `customContent` - every platform entry is an X Article (`platformSpecificData.article`) - every platform entry is a LinkedIn text-free reshare (`platformSpecificData.reshareUrl` with no text) See each platform's schema for media constraints. ## Scheduling Pick one of: - `scheduledFor`: publish at the scheduled time - `publishNow: true`: publish synchronously, inside this request - `queuedFromProfile`: publish in the profile's next queue slot With none of them and `isDraft` unset, the post is saved as a draft. `platforms` is required unless the post is a draft. Precedence: - `isDraft: true` wins over `publishNow` and `scheduledFor` (the post is saved, never published). - `publishNow: true` wins over `scheduledFor`. - A `scheduledFor` already in the past is not rejected: the post is published synchronously in the same request, exactly like `publishNow`. ## Idempotency Three layers of duplicate-protection apply, so safe-to-retry callers (network blips, n8n / Zapier retries, etc.) don't accidentally double-post. They are checked in this order: 1. An `Idempotency-Key` match (200) 2. Same-`x-request-id` retries (200) 3. The content-hash dedup (409) ### 1. `Idempotency-Key` (recommended for retries, 24-hour window) Send an `Idempotency-Key` header (a UUID per logical post, up to 255 characters). Reuse it when you retry after a 5xx, a timeout or a dropped connection. A retry with the same key within 24 hours returns **HTTP 200** with the original post in the `post` field, and no new post is created. The match is on the key alone, not on the body: a retry returns the original post even if its body differs (for example a re-uploaded media URL). It covers drafts, and a post that was saved even though the original response was a 5xx or timed out. - If the first request is still being processed, the retry gets **HTTP 409** with `code: idempotency_conflict` and a `Retry-After` header; retry after that delay. - If the first request failed without creating a post, the retry is processed as a new request. Keys are scoped to your user. Never reuse a key for a different post: that post would not be created, and the earlier one would be returned instead. ### 2. `x-request-id` retry detection (24-hour window) A request may carry the same `x-request-id` as an earlier one AND collide with it on the content fingerprint below (same account, content and media URLs). Then we return **HTTP 200** with the original post in the `post` field (or **HTTP 202** with `postId` if the original is still being saved) instead of a 409. A request with the same `x-request-id` but different content is a new post. When both headers are sent, `Idempotency-Key` wins and `x-request-id` is ignored for matching. The official Zernio SDKs auto-generate a unique `x-request-id` per call. On a generic HTTP client (curl, n8n's HTTP node, Zapier, custom code), either: - Set a unique `x-request-id` per logical call (UUIDv4 is fine) - Or omit the header, and we'll treat each request as new ### 3. Content-hash dedup (24-hour window) Independently, we hash `(platform, accountId, content + media URLs)` and reject duplicates within 24 hours with **HTTP 409**. This catches genuine "same content posted twice to the same account" cases regardless of `x-request-id`. The response carries `error`, `accountId`, `platform`, and `existingPostId` so you can find the original. To intentionally re-post identical content within 24h, change something (the caption, the media, the account), because the dedup is keyed on the full content fingerprint.

GET/v1/posts
import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.posts.listPosts();console.log(data);
{  "posts": [    {      "_id": "65f1c0a9e2b5af0012ab34cd",      "title": "Launch post",      "content": "We just launched!",      "status": "scheduled",      "scheduledFor": "2024-11-01T10:00:00Z",      "timezone": "UTC",      "platforms": [        {          "platform": "twitter",          "accountId": {            "_id": "64e1f0...",            "platform": "twitter",            "username": "@acme",            "displayName": "Acme Corp",            "isActive": true          },          "status": "pending"        }      ],      "tags": [        "launch"      ],      "createdAt": "2024-10-01T12:00:00Z",      "updatedAt": "2024-10-01T12:00:00Z"    }  ],  "pagination": {    "page": 1,    "limit": 10,    "total": 1,    "pages": 1  }}
OpenAPI specification
Was this page helpful?