Skip to content

API reference

Authenticate, choose a workspace, and read the full HTTP contract.

The HTTP API is the source of truth for the SDK, CLI, and hosted MCP server.

Base URL

https://pubnio.com/api/v1

Authenticate

Send a WorkOS access token as a bearer token:

curl https://pubnio.com/api/v1/workspaces \
  -H "Authorization: Bearer $PUBNIO_TOKEN"

Workspace API keys use the same header. A key is restricted to its workspace and carries one or more scopes: read, publish, engage, ads_read, or ads_manage. New keys default to read. ads_spend is owner-only and is not a key scope. The browser app uses its session cookie with same-origin checks on writes.

Profiles

Every workspace starts with a Default profile. profileId is optional on account and capability reads; omitting it returns every active profile. On a write that attaches an account, omitting it uses the default profile. Owners manage profiles at /api/v1/profiles.

Choose a workspace

Workspace-scoped routes take workspaceId as a query parameter. List the caller’s workspaces first, then pass the chosen ID on every request:

curl "https://pubnio.com/api/v1/posts?workspaceId=$WORKSPACE_ID" \
  -H "Authorization: Bearer $PUBNIO_TOKEN"

Every workspace has a defaultTimezone, UTC unless set at creation. An owner can change the name, the default IANA time zone, or both. New queues use the default when they omit timezone; existing queues keep their own zone.

curl -X POST https://pubnio.com/api/v1/workspaces \
  -H "Authorization: Bearer $PUBNIO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Studio","defaultTimezone":"America/New_York"}'

curl -X PATCH "https://pubnio.com/api/v1/workspaces/$WORKSPACE_ID" \
  -H "Authorization: Bearer $PUBNIO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"defaultTimezone":"Asia/Tokyo"}'

An invalid IANA name returns 422 with code invalid_timezone.

Posts and drafts

POST /api/v1/posts creates and submits in one call. Send text plus one selector: platforms, accounts, or targets.

curl -X POST "https://pubnio.com/api/v1/posts?workspaceId=$WORKSPACE_ID" \
  -H "Authorization: Bearer $PUBNIO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text":"Launch day","platforms":["x"]}'

Add "isDraft": true to save without submitting. GET /posts/{postId} returns isDraft, revision, content, status, and provider refs. PATCH edits a draft with expectedRevision. POST /posts/{postId}/validate preflights it, POST /posts/{postId}/publish submits it, and DELETE archives it. GET /posts accepts isDraft and deliveryStatus filters. There is no separate top-level draft resource.

Versioning

Send the date-based API version in PubNio-Version. Omitting it uses 2026-12-02, the current version.

curl https://pubnio.com/api/v1/workspaces \
  -H "Authorization: Bearer $PUBNIO_TOKEN" \
  -H "PubNio-Version: 2026-12-02"

Every API response, including problems, carries PubNio-Version with the version it served. The SDK sends the version it was built with, so the CLI and other SDK callers follow the same pin. Webhook endpoints pin the version at creation and send it on outbound deliveries.

An unsupported or malformed version returns 400 with application/problem+json:

{
  "type": "urn:pubnio:problem:unsupported-api-version",
  "code": "unsupported_api_version",
  "status": 400,
  "title": "Unsupported API version",
  "supportedVersions": ["2026-12-02"],
  "nextAction": "Send PubNio-Version: 2026-12-02, or omit the header."
}

Additive changes ship monthly without a new version. Breaking changes require a new API major and a new date version. PubNio supports the current and previous two monthly versions and announces each removal at least six months before it stops serving that version.

Errors and conflicts

Failures use application/problem+json. Schema errors include the offending field paths. Branch on the problem type when recovering:

  • urn:pubnio:problem:post-revision-conflict includes currentRevision.
  • urn:pubnio:problem:attempt-changed includes currentAttemptId.
  • urn:pubnio:problem:idempotency-conflict means the key is tied to another intent.
  • urn:pubnio:problem:delivery-not-retryable means inspect the current outcome before retrying.

Unexpected failures return a redacted 500 with a request ID for diagnosis.

Type to search…

↑↓ navigate↵ selectEsc close