Connect your AI agent
Give any HTTP-capable AI agent safe, scoped access to Postkub — direct REST works today, with CLI and MCP in preview.
Updated
On this page
Postkub is built bring-your-own-AI: you keep your assistant of choice and Postkub handles the social networks. Any HTTP-capable agent or automation can call the Postkub REST API directly today. The dedicated CLI and MCP surfaces make the same API more convenient, and both are in preview.
Note
Direct REST is the working integration path today. The CLI and the MCP server (package @postkub/mcp) are documented ahead of their release: the CLI is not yet installable from npm, and the MCP server currently runs locally from a source checkout against a development API. See the preview notices on the CLI and MCP pages.
Integration options
| Interface | Status | Best for |
|---|---|---|
| REST API | Available today | Any HTTP-capable agent or automation: Claude Code, Cursor, ChatGPT, n8n, custom scripts. |
CLI (postkub) | Preview | Terminal workflows and coding agents that shell out; structured JSON output and predictable exit codes. |
MCP server (postkub-mcp) | Preview, local | MCP hosts that can launch a local stdio server; schema-derived tools with structuredContent results. |
All three speak the same contract: one scoped API key, the same records, the same idempotency and error rules. Building against REST now transfers unchanged to the CLI and MCP once they ship.
Start building with your AI agent
Paste this prompt into an agent that can make HTTP requests. It walks the agent from reading the docs to a first scheduled post:
You are helping me operate Postkub, a social media management API.
1. Read the API documentation at https://postkub.com/en/docs, starting with
Overview, Authentication, Hosted media, and Scheduling.
2. Ask me for my Postkub API base URL and API key. Use them from environment
variables only. Never print the key, never write it to a file, and never
include it in a URL or a prompt.
3. Call GET /api/v1/me and summarize which Brands, social accounts, and actions
my key is allowed to use.
4. Call the capabilities endpoint for the account I name, and tell me what
Postkub can actually do on it today.
5. Create a draft post for one of my Brands and accounts, following the docs
exactly: JSON body, Idempotency-Key header with a fresh UUID, and hosted
HTTPS media URLs if I want media.
6. Schedule the draft, either at an explicit time or with the next-slot option,
and show me the post ID, revision, request ID, and the fireAtUtc the API
returned.
7. After every step, tell me the HTTP status and the requestId from the
response before moving on.
Setup stays human-owned: the agent cannot create Brands, connect accounts, or issue keys — you do that in the web UI and hand over only a scoped key.
Safe-access checklist
Before you hand a key to any agent:
- Grant the narrowest scope that works. A key that can only create and read posts cannot be talked into publishing or replying. See the scope catalog in authentication.
- Use one key per agent. Label the key with the agent's purpose so audit and activity records always identify the consumer.
- Store the key in environment variables or a secret store your agent reads at runtime — not in chat history, prompts, dotfiles, or the repository.
- Never paste the key into a prompt or a code block. If you must share configuration, share the variable names, not the values.
- Rotate the key immediately if it is exposed anywhere, and delete the old one.
- Know what revocation does: revoking a key stops new API calls immediately, while schedules the API already accepted continue to run. Fix a bad scheduled post with the normal edit and cancel controls, not by revoking.
- Prefer dry-run-style previews while integrating: create drafts, inspect the response, and only then publish or schedule.
REST recipe for n8n and similar tools
Generic "HTTP Request" node configuration — the same shape works in any automation tool that can send headers and a JSON body.
- Method:
POST - URL:
https://postkub.com/api/v1/posts(your Postkub API base URL plus/api/v1/posts) - Headers:
Authorization:Bearer <API_KEY>Idempotency-Key: a fresh UUID per intentional attempt, reused on retry of the same attemptContent-Type:application/json
- Body (JSON):
{
"brandId": "brd_9x2k",
"text": "Launch recap is live — link in comments.",
"socialAccountIds": ["acc_2gf8xh"]
}
Follow-up requests in the same workflow reuse the same rules: PATCH /api/v1/posts/{id} with expectedRevision to edit, POST /api/v1/posts/{id}/schedule with expectedRevision and schedule.nextSlot: true to reserve queue slots, GET /api/v1/posts/{id} to check status. Store the API key in the tool's credential store, not in the node body; treat every non-2xx response according to the error envelope instead of blind retries.
What your agent can and cannot do
The key decides — not the tool. Everything below is enforced server-side on every call.
| Your agent can | Your agent cannot |
|---|---|
| Create, edit, and delete drafts within the key's Brands and accounts | Create Brands, connect or reconnect social accounts |
| Publish now, schedule explicitly, or reserve queue slots | Create, rotate, or revoke API keys, or manage webhooks and billing |
| Read post status, activity, insights, and request receipts | Upload media files — posts attach hosted HTTPS URLs only |
| Read inbox threads and comments, and reply where the provider allows | Act on Brands or accounts outside its granted targets |
| Update thread handled/unread state | Bypass the key's scopes, provider limits, or tenant isolation |
| Recover any uncertain outcome via the request ID | Guarantee a social network published something — a 202 means accepted, not posted |
Administration stays human-only by design: initial account and Brand setup, connections, and key issuance happen in the authenticated web UI, and external keys cannot reach those owner endpoints at all.
Where to go next
- CLI guide and CLI command reference — terminal access in preview
- MCP server — local stdio tools for MCP hosts in preview
- API reference — start at discovery, then posts, publications, inbox, insights, and requests and activity
- Hosted media, scheduling, idempotency, and errors — the contracts every integration must honor
