Publications

Publish now, schedule, cancel, retry, and retry video covers for a saved post.

Updated

Open in ClaudeOpen in ChatGPT
On this page

Publication operations accept work for a saved post's selected targets. Acceptance is durable and idempotent, but it is not remote success: a 202 means the work is queued, and the per-target states in the receipt tell you what happened next. Read the target states back with Get a post. All operations here require an Idempotency-Key header and the current expectedRevision (see API reference).

The publication receipt

Every operation on this page returns the same receipt shape (or an identical replay of it):

{
  "requestId": "7f6c2f1e-8b4a-4c3d-9e2f-1a2b3c4d5e6f",
  "post": {
    "id": "post_example123",
    "brandId": "brand_example1",
    "revision": 2,
    "socialAccountIds": ["acc_example1"]
  },
  "targets": [
    {
      "socialAccountId": "acc_example1",
      "publicationId": "pub_example1",
      "revision": 1,
      "status": "queued",
      "scheduleMode": "now",
      "fireAtUtc": "2026-12-03T09:00:05.000Z",
      "localTime": null,
      "resolvedLocalTime": null,
      "timezone": null,
      "cancellationRequested": false,
      "allowedActions": ["cancel"]
    }
  ],
  "statusUrl": "/api/v1/posts/post_example123"
}

Target status is one of queued, processing, outcome_unknown, needs_review, blocked, published, failed, cancelled. scheduleMode is now, at_time, or next_slot. For accepted schedules, localTime and timezone echo what you sent and resolvedLocalTime is the UTC-resolved wall time. allowedActions lists what this key may still do per target (cancel, retry). For video posts the receipt can also carry coverState and firstCommentState step states.

statusUrl points back at the post resource; poll it to follow progress. See Scheduling for what each target state means.

Publish now

POST /api/v1/posts/{id}/publish

Accepts publish-now for an explicitly selected subset of the post's saved targets. Scopes: post:publish. CLI: postkub posts publish. MCP: posts_publish.

Headers

NameTypeRequiredDescription
Idempotency-KeyUUIDYesStable client UUID; repeat the same UUID after a lost response

Body parameters

NameTypeRequiredDescription
expectedRevisionintegerYesCurrent post revision; minimum 1
socialAccountIdsarray of stringYesSelected saved targets, 0-10 unique IDs; publishing requires at least one, an empty selection returns 422 TARGETS_REQUIRED
replaceExistingbooleanNoReplace selected known-unstarted work, advancing the saved post revision once

Request example

curl -sS -X POST https://postkub.com/api/v1/posts/post_example123/publish \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Idempotency-Key: 1d7e4c2b-5f6a-4b8c-1d2e-3f4a5b6c7d8e" \
  -H "Content-Type: application/json" \
  -d '{
    "expectedRevision": 2,
    "socialAccountIds": ["acc_example1"]
  }'

Response 202 Accepted — the publication receipt above. Acceptance queues the work; the target will move through processing to published (or failed, or outcome_unknown/needs_review when the remote result is ambiguous).

StatusMeaning
202Accepted; not yet a provider success
400Validation error (see Errors)
401Authentication required
403Key lacks post:publish or authority over the selected targets
404Post or target not found / out of scope
409REVISION_CONFLICT, PUBLICATION_ALREADY_ACCEPTED (selected target already has accepted work; use replaceExisting), REPLACEMENT_REQUIRES_ACCEPTED_WORK, RECONCILIATION_REQUIRED (started work cannot be replaced), ACCOUNT_UNAVAILABLE, or idempotency conflict
422TARGETS_REQUIRED (empty selection), TEXT_EXCEEDS_PLATFORM_LIMIT, image/video policy or media errors, PROVIDER_CAPABILITY_UNAVAILABLE, or PLATFORM_NOT_SUPPORTED
428REVISION_REQUIRED (missing expectedRevision)
429Key rate limit, PUBLICATION_CAPACITY_EXCEEDED, ACCOUNT_QUEUE_LIMIT_EXCEEDED, or PLATFORM_DAILY_LIMIT_EXCEEDED

Schedule a post

POST /api/v1/posts/{id}/schedule

Accepts explicit at-time schedules per target, or reserves each selected account's next weekly queue slot. Scheduling also requires publish authority, so both scopes are checked. Scopes: post:publish and post:schedule. CLI: postkub posts schedule. MCP: posts_schedule.

Headers

NameTypeRequiredDescription
Idempotency-KeyUUIDYesStable client UUID; repeat the same UUID after a lost response

Body — variant A, explicit at-time targets

NameTypeRequiredDescription
expectedRevisionintegerYesCurrent post revision; minimum 1
targetsarray of objectYes0-10 per-target schedules (publishing rules still require at least one effective target)
replaceExistingbooleanNoReplace selected known-unstarted work, advancing the saved post revision once

Each targets entry:

NameTypeRequiredDescription
socialAccountIdstringYesSaved target account ID
localTimestringYesWall time in the target's timezone, for example 2026-12-25T09:00:00
timezonestringYesIANA timezone name, for example Asia/Bangkok
fireAtUtcstringYesThe exact UTC instant that localTime plus timezone resolve to

The server recomputes the UTC instant from localTime and timezone and rejects the request with 422 (SCHEDULE_RESOLUTION_MISMATCH, SCHEDULE_IN_PAST, or SCHEDULE_TIMEZONE_CHANGED) when they do not agree or the instant is not in the future.

Body — variant B, next weekly queue slot

NameTypeRequiredDescription
expectedRevisionintegerYesCurrent post revision; minimum 1
socialAccountIdsarray of stringYesSelected accounts, 0-10 unique IDs; an empty selection is rejected with TARGETS_REQUIRED
schedule.nextSlotbooleanYesMust be exactly true
schedule.prioritizebooleanNoWhen true, reserve a slot immediately before the earliest already-reserved upcoming slot instead of the next unoccupied slot
replaceExistingbooleanNoReplace selected known-unstarted work, advancing the saved post revision once

The weekly slots come from the account's schedule settings.

Request example (variant A)

curl -sS -X POST https://postkub.com/api/v1/posts/post_example123/schedule \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Idempotency-Key: 2e8f5d3c-6a7b-4c9d-2e3f-4a5b6c7d8e9f" \
  -H "Content-Type: application/json" \
  -d '{
    "expectedRevision": 2,
    "targets": [
      {
        "socialAccountId": "acc_example1",
        "localTime": "2026-12-25T09:00:00",
        "timezone": "Asia/Bangkok",
        "fireAtUtc": "2026-12-25T02:00:00.000Z"
      }
    ]
  }'

Response 202 Accepted — the publication receipt; each target carries scheduleMode at_time or next_slot plus the reserved fireAtUtc.

StatusMeaning
202Accepted; not yet a provider success
400Validation error (see Errors)
401Authentication required
403Key lacks post:publish or post:schedule, or lacks authority over the selected targets
404Post or target not found / out of scope
409Same acceptance conflicts as publish now (PUBLICATION_ALREADY_ACCEPTED, RECONCILIATION_REQUIRED, ACCOUNT_UNAVAILABLE, REVISION_CONFLICT, idempotency conflict)
422TARGETS_REQUIRED, NO_AVAILABLE_SLOT (with error.details.socialAccountId), schedule resolution errors (SCHEDULE_RESOLUTION_MISMATCH, SCHEDULE_IN_PAST, SCHEDULE_TIMEZONE_CHANGED), or platform text/media policy errors
428REVISION_REQUIRED (missing expectedRevision)
429Key rate limit, PUBLICATION_CAPACITY_EXCEEDED, ACCOUNT_QUEUE_LIMIT_EXCEEDED, or PLATFORM_DAILY_LIMIT_EXCEEDED

Cancel publications

POST /api/v1/posts/{id}/cancel

Cancels selected unstarted work immediately, or, when the remote request has already started, records a cancellation request that is resolved by reconciliation. Published remote content cannot be cancelled. Scopes: post:cancel. CLI: postkub posts cancel. MCP: posts_cancel.

Headers

NameTypeRequiredDescription
Idempotency-KeyUUIDYesStable client UUID; repeat the same UUID after a lost response

Body parameters

NameTypeRequiredDescription
expectedRevisionintegerYesCurrent post revision; minimum 1
socialAccountIdsarray of stringYesSelected targets with accepted work, 1-10 unique IDs

Request example

curl -sS -X POST https://postkub.com/api/v1/posts/post_example123/cancel \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Idempotency-Key: 3f9a6e4d-7b8c-4d0e-3f4a-5b6c7d8e9f0a" \
  -H "Content-Type: application/json" \
  -d '{
    "expectedRevision": 3,
    "socialAccountIds": ["acc_example1"]
  }'

Response 200 OK when every selected target was cancelled outright, 202 Accepted when a cancellation was requested and the remote outcome still requires reconciliation. In the 202 case each receipt target keeps its prior status with cancellationRequested: true.

StatusMeaning
200Selected work cancelled
202Cancellation requested; remote outcome requires reconciliation
400Validation error (see Errors)
401Authentication required
403Key lacks post:cancel or authority over the selected targets
404Post or target not found / out of scope
409ALREADY_PUBLISHED (published remote content cannot be cancelled), PUBLICATION_NOT_ACCEPTED (every selected target must have accepted work), REVISION_CONFLICT, or idempotency conflict
422Request rejected by an acceptance rule (see Errors)
428REVISION_REQUIRED (missing expectedRevision)
429Key rate limit or publication capacity

Retry failed publications

POST /api/v1/posts/{id}/retry

Retries selected proven-no-effect failures inside the original 15-minute lateness window. Work that started remotely, has an unknown outcome, or is past its window is not retryable; those states surface as needs_review. Scopes: post:publish; retrying work whose scheduleMode is not now also requires post:schedule. CLI: postkub posts retry. MCP: posts_retry.

Headers

NameTypeRequiredDescription
Idempotency-KeyUUIDYesStable client UUID; repeat the same UUID after a lost response

Body parameters

NameTypeRequiredDescription
expectedRevisionintegerYesCurrent post revision; minimum 1
socialAccountIdsarray of stringYesSelected failed targets, 1-10 unique IDs

Request example

curl -sS -X POST https://postkub.com/api/v1/posts/post_example123/retry \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Idempotency-Key: 4a0b7f5e-8c9d-4e1f-4a5b-6c7d8e9f0a1b" \
  -H "Content-Type: application/json" \
  -d '{
    "expectedRevision": 4,
    "socialAccountIds": ["acc_example1"]
  }'

Response 202 Accepted — the receipt with retried targets back in queued status.

StatusMeaning
202Retry accepted; targets re-queued
400Validation error (see Errors)
401Authentication required
403Key lacks post:publish (or post:schedule for scheduled work), or lacks authority over the selected targets
404Post or target not found / out of scope
409UNSAFE_RETRY (only proven-no-effect failed work inside the original lateness window can be retried), ACCOUNT_UNAVAILABLE, PUBLICATION_NOT_ACCEPTED, REVISION_CONFLICT, or idempotency conflict
422Request rejected by a capability or media rule (see Errors)
428REVISION_REQUIRED (missing expectedRevision)
429Key rate limit or publication capacity

Retry a video cover

POST /api/v1/posts/{id}/cover-retry

Retries a proven-no-effect failed video cover step without republishing the video. Only the failed cover of an already-published video is eligible. Scopes: post:publish. CLI: postkub posts cover-retry. MCP: posts_cover-retry.

Headers

NameTypeRequiredDescription
Idempotency-KeyUUIDYesStable client UUID; repeat the same UUID after a lost response

Body parameters

NameTypeRequiredDescription
expectedRevisionintegerYesCurrent post revision; minimum 1
socialAccountIdsarray of stringYesSelected targets with a failed cover, 1-10 unique IDs

Request example

curl -sS -X POST https://postkub.com/api/v1/posts/post_example123/cover-retry \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Idempotency-Key: 5b1c8a6f-9d0e-4f2a-5b6c-7d8e9f0a1b2c" \
  -H "Content-Type: application/json" \
  -d '{
    "expectedRevision": 5,
    "socialAccountIds": ["acc_example1"]
  }'

Response 202 Accepted — the receipt with the cover step reset to pending (coverState: "pending").

StatusMeaning
202Cover retry accepted
400Validation error (see Errors)
401Authentication required
403Key lacks post:publish or authority over the selected targets
404Post or target not found / out of scope
409UNSAFE_RETRY (only a published video's proven-no-effect failed cover can be retried; unknown outcomes require review), ACCOUNT_UNAVAILABLE, PUBLICATION_NOT_ACCEPTED, REVISION_CONFLICT, or idempotency conflict
422Request rejected by a capability rule (see Errors)
428REVISION_REQUIRED (missing expectedRevision)
429Key rate limit or publication capacity