Start free trial

REST API & Webhooks

Automate publishing with the Postcapy REST API, idempotency keys, cursor pagination, and HMAC-signed webhooks.

Developers

The Postcapy REST API gives you direct HTTP access to the same workspace, channel, posting, media, and analytics operations available through the MCP server.

  • Base URL: https://postcapy.com/api/v1
  • Format: JSON request and response envelopes; timestamps are ISO-8601 UTC unless noted.
  • Tracing: Every response includes an X-Request-Id header (ULID) for debugging and support.
  • YouTube boundary: YouTube channels and posts targeting YouTube are not available through the REST API.

Authentication#

Authenticate every request with a Bearer token in the Authorization header. Tokens passed in query parameters are always rejected.

Terminal
curl -sS "https://postcapy.com/api/v1/workspace" \
  -H "Authorization: Bearer pwa_your_workspace_token" \
  -H "Accept: application/json"

Postcapy accepts two token types:

Token type Prefix How to obtain
Workspace API credential pwa_ Create a scoped key inside your workspace under Settings → API credentials.
OAuth 2.1 access token pos_ Issued through /oauth/authorize and /oauth/token with PKCE (S256).

Each endpoint checks the token's granted scopes (channels:read, channels:write, posts:read, posts:write, media:read, media:write, media:generate, analytics:read, notifications:read).

Idempotency, pagination & rate limits#

Idempotency keys#

POST /api/v1/posts requires an Idempotency-Key header so network retries never publish duplicates. Other write endpoints accept Idempotency-Key optionally. Keys are retained for 24 hours, and replayed responses include Idempotent-Replayed: true.

Cursor pagination#

List endpoints accept limit (default 20, maximum 100) and cursor query parameters and return an opaque next cursor when additional pages exist.

Rate limits#

Default API traffic is limited to 90 requests/hour per credential and workspace, with tighter per-minute buckets on sensitive writes:

  • Post creation & batch scheduling: 12 requests/minute
  • Remote media URL import: 5 requests/minute
  • Provider option lists (/options/{list}): 10 requests/minute
  • Publication state repair: 6 requests/minute

Throttled responses return HTTP 429 with X-RateLimit-Limit, X-RateLimit-Remaining, and Retry-After headers.

Core endpoints#

Method & Path Scope Purpose
GET /api/v1/workspace channels:read Workspace overview, time zone, channels, rules, and writing guides.
GET /api/v1/channels channels:read List connected channels (never returns provider credentials).
GET /api/v1/channels/{channelId}/schema channels:read Channel capabilities, text/media constraints, and provider settings schema.
GET /api/v1/channels/{channelId}/options/{list} channels:read Live option values (boards, categories, flairs, channels).
PUT /api/v1/channels/{channelId}/writing-guide posts:write Save or clear a channel's writing guide.
GET /api/v1/free-slots & /free-slots/next channels:read Find open posting slots per channel or shared across channels.
GET /api/v1/posts & /posts/summaries posts:read List posts in full detail or compact summary form.
POST /api/v1/posts posts:write Create a draft, scheduled post, or immediate post (Idempotency-Key required).
POST /api/v1/posts/batch posts:write Batch-create multiple single-channel drafts or scheduled posts.
PATCH /api/v1/posts/{postId} posts:write Update text or media on an unpublished post.
POST /api/v1/posts/{postId}/reschedule posts:write Reschedule a scheduled post or schedule a draft.
DELETE /api/v1/posts/{postId} posts:write Delete an unpublished post.
GET /api/v1/media & POST /api/v1/media media:read / media:write List or upload workspace media assets.
POST /api/v1/media/import media:write Import an image or video from a public HTTPS URL.
GET /api/v1/channels/{channelId}/analytics analytics:read Channel metrics over 7, 30, or 90 days.
GET /api/v1/analytics/top-posts analytics:read Top published posts ranked by engagement.

Example: Create a scheduled post#

Terminal
curl -sS -X POST "https://postcapy.com/api/v1/posts" \
  -H "Authorization: Bearer pwa_your_workspace_token" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: launch-post-2026-05-01" \
  -d '{
    "action": "schedule",
    "scheduled_at": "2026-05-01T14:00:00Z",
    "text": "Postcapy MCP server is now live.",
    "channels": [
      { "channel_id": "01JXYZ..." }
    ]
  }'

Webhooks#

Configure outbound webhooks in your workspace to receive real-time notifications when publishing finishes, fails, or requires a channel reconnect.

Subscribable events#

  • publication.completed — all channel deliveries for a post succeeded.
  • publication.partially_completed — some channel deliveries succeeded while others failed.
  • publication.failed — publishing failed for a post.
  • post.published — a post finished publishing.
  • channel.reconnect_required — a connected channel's provider credentials expired or were revoked.
  • automation.failed — a feed automation run failed.
  • webhook.test — emitted when you trigger a test delivery from settings.

Failed deliveries are retried automatically with exponential backoff up to 6 attempts.

Verifying signatures#

Every webhook delivery includes four headers:

  • X-Postcapy-Event — event name (for example publication.completed)
  • X-Postcapy-Delivery — unique delivery ULID
  • X-Postcapy-Timestamp — Unix timestamp in seconds
  • X-Postcapy-Signature — HMAC-SHA256 signature formatted as v1=<hex-digest>

Compute the expected signature over <timestamp>.<raw_request_body> using your endpoint's signing secret (whsec_...) and compare with a constant-time check:

JavaScript
import crypto from 'node:crypto';

export function verifyPostcapyWebhook(rawBody, headers, secret) {
    const timestamp = headers['x-postcapy-timestamp'];
    const signature = headers['x-postcapy-signature'];

    if (!timestamp || !signature) {
        return false;
    }

    const expected =
        'v1=' +
        crypto
            .createHmac('sha256', secret)
            .update(`${timestamp}.${rawBody}`)
            .digest('hex');

    const expectedBuf = Buffer.from(expected, 'utf8');
    const receivedBuf = Buffer.from(signature, 'utf8');

    if (expectedBuf.length !== receivedBuf.length) {
        return false;
    }

    return crypto.timingSafeEqual(expectedBuf, receivedBuf);
}

Tip

Reject timestamps older than 5 minutes to protect your webhook endpoint against replay attacks.