---
title: "Publishing"
description: "One post resource, targets, delivery attempts, and confirmed outcomes."
---

> Documentation Index
> Fetch the complete documentation index at: https://pubnio.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Publishing

PubNio separates the content you author from the work that delivers it.

| Record  | What it owns                                                               |
| ------- | -------------------------------------------------------------------------- |
| Post    | Shared text, media, selected targets, and one revision. A draft is a post. |
| Target  | One account and placement, with its own attempt and outcome.               |
| Attempt | The payload frozen at admission and the provider evidence.                 |

One post can settle differently for each target. Retrying a failed target
leaves the other targets untouched. Posts stay workspace-owned; filter them by
profile through their destination accounts.

## One post resource

`POST /api/v1/posts` creates and submits in one call. Send `text` plus
`platforms` or `accounts` for the shortest path, or `targets` when you need
exact placements. A target selects an account and a placement:

```json
{
  "text": "Release notes are live.",
  "targets": [
    { "accountId": "…", "provider": "facebook", "placement": "feed" },
    { "accountId": "…", "provider": "instagram", "placement": "reel" }
  ]
}
```

Supported destinations today are Facebook Page feed, Reel, and Story;
Instagram feed, carousel, Reel, and Story; LinkedIn text, one image, or one PDF;
Pinterest image Pins; TikTok video or photo feed; X text or threads; and
YouTube video or Short. A LinkedIn document must be a workspace PDF of up to
100 MB and set `settings.documentTitle` to 1–100 characters. External PDF
URLs are rejected, and the title is rejected on text or image posts. Pinterest
video Pins and comments are not available yet.

Shared content carries one ordered `media` array. Each entry is either a ready
workspace asset or an HTTPS URL:

```json
{
  "text": "Release notes are live.",
  "media": [{ "mediaId": "…" }, { "url": "https://…" }],
  "targets": [{ "accountId": "…", "provider": "facebook", "placement": "feed" }]
}
```

Import or upload media first when a destination requires workspace storage.
`media.importUrl`, `media.upload`, `media.status`, and `media.wait` all use
one result: `{ mediaId, status, asset?, issue? }`. The CLI and hosted MCP
tools return the same shape.

A target can override text or media with the same `media` array. Provider-specific settings belong to the
selected placement. The API rejects a target whose settings do not match its
provider and placement.

To save without submitting, add `isDraft: true`. Read, edit, validate, publish,
or archive the same `postId` through `GET /posts/{postId}`, `PATCH`,
`POST /posts/{postId}/validate`, `POST /posts/{postId}/publish`, and
`DELETE`. Drafts and submitted posts share one ID namespace and one list:
`GET /posts` accepts `isDraft`.

## Validate before publishing

Preflight reports typed issues per destination: account readiness, caption
limits, media requirements, and placement settings. Validation is advisory;
the Worker rechecks authorization and usable credentials before it reserves a
provider write. Direct posts do not need a draft or preflight first.

```ts
const validation = await workspace.posts.validate(postId);
```

## Publish is accepted work

A successful publish response returns a post ID and target IDs. Each target is
a separate delivery. Targets and posts share one status vocabulary:

| Outcome                | Meaning                                                   |
| ---------------------- | --------------------------------------------------------- |
| `scheduled`            | Queued with a future `scheduledAt`.                       |
| `queued`, `submitting` | Waiting for or reserving the provider write.              |
| `confirming`           | The provider accepted work and confirmation is in flight. |
| `published`            | The provider confirmed the target.                        |
| `provider_draft`       | The provider saved a native draft.                        |
| `failed`               | The attempt reached a definitive failure.                 |
| `unresolved`           | PubNio cannot establish the provider outcome yet.         |
| `cancelled`            | The caller cancelled an unreserved attempt.               |

`scheduled` is a derived display state; the stored attempt remains `queued`.
Each target always reports `canRetry` and `canReconcile`. Failed and unresolved
targets also report `nextAction`, which says whether to retry, reconcile, or
create a new post. Confirmed targets report `providerRef: { id, kind }` and an
optional `url`; `kind` is `post`, `pin`, `video`, or `submission`.

Read `GET /api/v1/posts/{postId}` or call `workspace.posts.get` for the saved
content and current deliveries. For a definitive failure, read the issue and attempt history before
retrying. An unresolved attempt may be reconciled later.

## Scheduling, cancellation, and retries

- `scheduledAt` moves a publish to a future time with an explicit offset.
- A target can be rescheduled, cancelled, or brought forward until its
  provider write is reserved.
- A retry creates a new attempt for one target and leaves siblings intact.
- Use one idempotency key per submission intent. Reusing a key for a different
  intent returns `urn:pubnio:problem:idempotency-conflict`.

## Weekly queues

A queue belongs to one connected account and stores an IANA time zone and
weekly local-time slots. Each workspace also stores a default time zone, UTC
unless changed. Creating a queue without `timezone` uses the workspace default;
an explicit queue zone always wins. Changing the workspace default never moves
an existing queue. An account may have several active queues, with
exactly one default. The first queue is always the default; `isDefault: true`
promotes a queue and demotes the others. Demote or archive the default only
after promoting another queue, otherwise the write returns
`QueueDefaultRequired`. A target with `queueId` uses the default queue, or
the only active queue when one remains. Publishing a target with `queueId`
assigns the next free occurrence; rescheduling with `queueId` moves it to
another occurrence.
An explicit `scheduledAt` detaches the target from its queue. Use
`GET /api/v1/queues/{queueId}/next-slot` or `/slots/preview` to inspect
availability. Queue updates, archives, and slot replacements take
`expectedVersion`; a stale write returns `QueueVersionConflict`.

A paused queue blocks new assignments but keeps existing scheduled work. A
queue's limits cannot exceed the account provider's posting guardrails.

"Skip to next" is a client convenience, not a new route. The SDK's
`schedule.skipToNext` and the MCP `schedule_skip_to_next` tool read the
target's status, resolve its queue and current attempt, read the next free
occurrence after its scheduled time, and pin that occurrence through the
existing reschedule. A target with no queue returns `schedule_required` with
`param: "queueId"`; an empty horizon returns `{ skipped: false,
horizonEndsAt }` without writing.

Skip one occurrence with `POST /api/v1/queues/{queueId}/skips` or block a date
range with `POST /api/v1/queues/{queueId}/blackouts`. Both stop future
assignment and preview availability without moving or cancelling work that is
already scheduled. Delete the skip or blackout to restore availability.

Read the calendar with `GET /api/v1/schedule` and an inclusive `from` and
`to` instant range of at most 90 days. It returns current queued attempts in
ascending scheduled order with the shared cursor envelope. Optional
`accountId` and `queueId` filters narrow the target account or open queue
assignment; a wider range returns `ScheduleRangeTooWide`.

## Permissions

Workspace owners manage keys, connections, and account selection. Members can
read accounts, outcomes, queues, and schedule ranges, create posts and drafts,
edit drafts, and upload media.
Publishing requires the owner role or an API key with `publish` access.
Provider credentials stay server-side for every actor.

Source: https://pubnio.com/docs/publishing/index.mdx
