# Postiefy: setup for AI agents

Read this before you connect a person's Postiefy workspace. The full reference, with every route, field and error code, is https://api.postiefy.com/llms.txt.

## What Postiefy is

Postiefy schedules and publishes social media posts for a person or an agency. It is built for Instagram, TikTok, Facebook Pages, LinkedIn, YouTube, Pinterest and X. One post goes to several accounts, each with its own version checked against that platform's rules, and every account gets its own status and, once published, the live URL. Agents use it through a remote MCP server or the REST API; both run the same rules.

Publishing on each platform opens only after that platform approves Postiefy's app. Where each one stands today:

- Instagram: Built, and not yet submitted for Meta's app review. Publishing opens once Meta approves Postiefy's app.
- TikTok: Built, and not yet submitted for TikTok's app review. Publishing opens once TikTok approves Postiefy's app.
- Facebook Pages: Built, and not yet submitted for Meta's app review. Publishing opens once Meta approves Postiefy's app.
- LinkedIn: Built, and not yet submitted for LinkedIn's app review. Publishing opens once LinkedIn approves Postiefy's app.
- YouTube: Built, and not yet submitted for Google's app review. Publishing opens once Google approves Postiefy's app.
- Pinterest: Built, and not yet submitted for Pinterest's app review. Publishing opens once Pinterest approves Postiefy's app.
- X: Built, and not yet submitted for X's app review. Publishing opens once X approves Postiefy's app.
- LinkedIn company Pages (a separate LinkedIn app): Built, and not yet submitted for LinkedIn's app review. Publishing opens once LinkedIn approves Postiefy's app.

Tell the person this if they ask you to post to a platform that is not open yet.

## Connect

- MCP server: https://api.postiefy.com/mcp (remote, Streamable HTTP).
- Sign-in: OAuth 2.1. When your client opens the sign-in page, stop and wait. On Postiefy's consent page the person signs in and chooses the workspace, the mode and the accounts this connection may use. Do not choose for them and do not ask for their password.
- Without OAuth (REST, n8n, scripts): the person creates an API key in the dashboard, picks its mode, and gives the key to you. Send it as `Authorization: Bearer pfy_live_...` to https://api.postiefy.com/v1 or to the MCP server. Never print the key back or store it in a post.

## Modes

Each connection has one mode, chosen by the person (the API has no default; the consent page starts on `needs_approval` and offers `publish` only to workspace owners and admins):

- `drafts_only`: everything you create is a draft a person sends out.
- `needs_approval`: a post you send out waits until a person approves it in the dashboard.
- `publish`: posts go out at their time.

A connection may also be limited to some accounts. To change the mode, the person revokes the connection and connects again.

## First calls

1. `list_accounts`, then `get_platform_constraints` and `get_account_options` for the accounts you will post to.
2. Media: `import_media` for a public URL, or `create_media_upload` then `complete_media_upload` for a local file.
3. `validate_post` until `valid` is true. Each issue has a `code`, `field` and `message`, and most have a `hint`: follow it.
4. `create_post` with an `idempotencyKey` and `scheduledAt` or `publishNow`. Without either it is saved as a draft. Read `status` in the answer: the mode decides whether the post is scheduled, waits for approval, or stays a draft.
5. `wait_for_post` until `settled` is true. A published account carries `externalPostId` and, when the platform gave a link, `externalUrl`. A failed one carries an `error` with `retryable` and, most of the time, a `hint`.

## Rules

- In `needs_approval` mode nothing goes out until a person approves it in the dashboard. Only a person can approve.
- Never edit a post that is waiting for approval. The person approves the version they reviewed.
- A TikTok direct post (`overrides.mode: direct_post`, the default) and every Pinterest Pin always wait for a person's approval in the dashboard when a `needs_approval` or `publish` connection sends them out. Both platforms require a person to choose each post. From a `drafts_only` connection they are drafts like any other post. A TikTok `inbox_draft` does not wait: the creator finishes it in TikTok.
- An error with `needsReconnect` means the account lost its connection. Ask the person to reconnect it in the dashboard; after that the error becomes retryable and you may call `retry_post`.
- An error with `mayBeLive` means the platform may already hold the post. Never retry it. Check the account on the platform: if the post is live, call `resolve_post_target` with its URL. If you cannot find it, ask the person to settle it in the dashboard.
- Never retry blind. Retry only an error whose `retryable` is true, and send the same `idempotencyKey` when you repeat a `create_post` call that got no answer: you get the same post back, not a second one.
- Every tool call counts as one API call against the plan's monthly allowance; `create_posts` counts one per post. `get_usage` shows the counters. Once the allowance is used up, every call fails with `RATE_LIMIT_EXCEEDED` ("Monthly API call limit ... exceeded"), `get_usage` included, until the 1st (UTC): stop and tell the person. Poll with `wait_for_post`, not in a tight loop of `get_post`.
- When a tool fails, read `error.hint` and do what it says before calling again.

## Tools

- `list_accounts`: Lists the social accounts this connection may post to, with each one's platform, health and brand.
- `list_brands`: Lists the workspace's brands: the clients an agency posts for, each with its name, colour, timezone and the accounts this connection may use.
- `get_account_options`: Returns the values one account accepts right now, fetched from its platform: TikTok privacy levels and limits, Pinterest boards, the YouTube upload allowance left today and the like.
- `get_platform_constraints`: Returns each platform's fixed limits (text length, media count, sizes, durations, aspect ratios) and the JSON Schema of the overrides it accepts.
- `validate_post`: Dry run of create_post: returns, per account, every issue its platform would raise (code, field, message, hint).
- `create_post`: Creates one post for one or more accounts: a draft without a time; with one, scheduled, held for approval or a draft, depending on the connection's mode and the platform.
- `create_posts`: Creates up to 50 posts in one call, each exactly as create_post would, with one result per post: not all-or-nothing.
- `update_post`: Replaces the content, disclosure, timezone or whole target list of a post that has not started publishing.
- `schedule_post`: Gives a post its time, moves it, or sends it now.
- `cancel_post`: Stops every account of a post that has not started publishing.
- `retry_post`: Publishes again the accounts of a post whose error is retryable now.
- `resolve_post_target`: For a failed account whose post may already be live: reports the live post's URL, and the account becomes published.
- `get_post`: Returns a post with each account's status, the live post URL once published and the error with its hint when one failed.
- `list_posts`: Lists the workspace's posts, filtered by status, time window, account, brand or who made them.
- `wait_for_post`: Waits for a post to stop changing, 20 seconds by default and at most 25, then returns it.
- `create_approval_link`: Makes a link a client opens without an account to approve the post or ask for changes.
- `revoke_approval_link`: Closes an approval link nobody has answered, so it no longer opens.
- `get_post_approvals`: Returns a post's approval links and its approval record: who approved or asked for changes, on which revision.
- `import_media`: Copies an image, video or PDF from a public URL into the media library and returns its id.
- `create_media_upload`: Returns a presigned URL for a file the agent holds locally.
- `complete_media_upload`: Checks an uploaded file and makes it ready for a post.
- `list_media`: Lists the workspace's uploaded and imported files, newest first, so a file already there can be reused instead of uploaded again.
- `get_post_metrics`: Returns the metric snapshots of each published account of one post, taken 24 h, 72 h, 7 days and 30 days after publishing (X: 7 days only).
- `list_metrics`: Lists the published accounts of every post with their metric snapshots, newest first, filtered by time, account, brand or snapshot.
- `get_usage`: Returns this month's counters against the plan: posts sent out, X credits and API calls.

## More

- Full reference for agents: https://api.postiefy.com/llms.txt
- Developer docs for people: https://postiefy.com/developers
