# Guide: schedule a post with the Beplan API

A post from start to finish: pick the accounts, attach media, create the post, schedule or publish it, and follow the result. With the rules for editing a post someone has open, and the caption tokens for links.

Scopes used here: [`accounts:read`](https://beplan.io/docs/oauth/scopes/#scope-accounts-read) to list accounts, [`posts:write`](https://beplan.io/docs/oauth/scopes/#scope-posts-write) to create and edit, [`posts:publish`](https://beplan.io/docs/oauth/scopes/#scope-posts-publish) to schedule and publish, [`posts:read`](https://beplan.io/docs/oauth/scopes/#scope-posts-read) to follow the result. The person's role must allow the same in that workspace.

## 1. Pick the accounts

[`GET …/social-accounts`](https://beplan.io/docs/api/social-accounts/#socialAccounts.list) lists the workspace's connected accounts, at most one per platform. Use the `id` of each account the post goes to. An account with `status: "disconnected"` or `needsSetup: true` needs a person in Beplan first; scheduling to it fails with [`SOCIAL_ACCOUNT_RECONNECT_REQUIRED`](https://beplan.io/docs/api/errors/#SOCIAL_ACCOUNT_RECONNECT_REQUIRED) or [`SOCIAL_ACCOUNT_SETUP_REQUIRED`](https://beplan.io/docs/api/errors/#SOCIAL_ACCOUNT_SETUP_REQUIRED).

Connecting a new account can't be finished by the API alone: [`POST …/social-accounts/connect`](https://beplan.io/docs/api/social-accounts/#socialAccounts.connect) returns a platform sign-in link that the person must open in a browser where they are signed in to Beplan, within 10 minutes. Then poll [`GET …/social-accounts`](https://beplan.io/docs/api/social-accounts/#socialAccounts.list) until the account appears.

## 2. Put the media in the library

A post refers to media by their library ids. [Upload](https://beplan.io/docs/guides/upload-media/) the files, or import them from a URL, and wait until each is `ready` (`processing.state` on [`GET …/media-library/items/{mediaId}`](https://beplan.io/docs/api/media/#media.get)). Scheduling a post whose video is still processing fails with [`POST_MEDIA_PROCESSING`](https://beplan.io/docs/api/errors/#POST_MEDIA_PROCESSING).

## 3. Create the post

[`POST …/posts`](https://beplan.io/docs/api/posts/#posts.create) makes a draft (status `idea`). Every field is optional, so you can create first and fill in later:

- `title`, `caption`, `hashtags`.
- `media`: `[{ mediaId, altText }]`, in order.
- `platforms`: one entry per account, `{ socialAccountId, isActive }`, with its own caption, media, thread and options (`additionalParams`) when they differ from the post's.

Example (A LinkedIn post with one image), `POST /organizations/{organizationId}/workspaces/{workspaceId}/posts`:

```bash
curl -X POST "https://api.beplan.io/v1/organizations/ORGANIZATION_ID/workspaces/WORKSPACE_ID/posts" \
  -H "Authorization: Bearer beplan_pat_…" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "title": "Spring drop teaser",
  "caption": "Something new lands Thursday.",
  "hashtags": "#springdrop",
  "media": [
    {
      "mediaId": "c3d4e5f6-a7b8-4c9d-8e0f-1a2b3c4d5e6f",
      "altText": "The spring collection on a table"
    }
  ],
  "platforms": [
    {
      "socialAccountId": "0b6f5c1e-2a7d-4c3b-9e8f-1a2b3c4d5e6f",
      "isActive": true,
      "additionalParams": {
        "linkedin_visibility": "PUBLIC"
      }
    }
  ]
}'
```

```typescript
const response = await fetch("https://api.beplan.io/v1/organizations/ORGANIZATION_ID/workspaces/WORKSPACE_ID/posts", {
  method: "POST",
  headers: {
    Authorization: "Bearer beplan_pat_…",
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "title": "Spring drop teaser",
    "caption": "Something new lands Thursday.",
    "hashtags": "#springdrop",
    "media": [
      {
        "mediaId": "c3d4e5f6-a7b8-4c9d-8e0f-1a2b3c4d5e6f",
        "altText": "The spring collection on a table"
      }
    ],
    "platforms": [
      {
        "socialAccountId": "0b6f5c1e-2a7d-4c3b-9e8f-1a2b3c4d5e6f",
        "isActive": true,
        "additionalParams": {
          "linkedin_visibility": "PUBLIC"
        }
      }
    ]
  }),
});
if (!response.ok) throw new Error((await response.json()).error.code);
const { data } = await response.json();
```

```python
import uuid

import requests

response = requests.post(
    "https://api.beplan.io/v1/organizations/ORGANIZATION_ID/workspaces/WORKSPACE_ID/posts",
    headers={"Authorization": "Bearer beplan_pat_…", "Idempotency-Key": str(uuid.uuid4())},
    json={
        "title": "Spring drop teaser",
        "caption": "Something new lands Thursday.",
        "hashtags": "#springdrop",
        "media": [
            {
                "mediaId": "c3d4e5f6-a7b8-4c9d-8e0f-1a2b3c4d5e6f",
                "altText": "The spring collection on a table",
            },
        ],
        "platforms": [
            {
                "socialAccountId": "0b6f5c1e-2a7d-4c3b-9e8f-1a2b3c4d5e6f",
                "isActive": True,
                "additionalParams": {
                    "linkedin_visibility": "PUBLIC",
                },
            },
        ],
    },
)
response.raise_for_status()
data = response.json()["data"]
```

Answers 201:

```json
{
  "data": {
    "id": "6f1c2a3b-4d5e-4f60-8a71-92b3c4d5e6f7",
    "title": "Spring drop teaser",
    "caption": "Something new lands Thursday.",
    "hashtags": "#springdrop",
    "formatIds": [],
    "ignoreOpenFormatSlots": false,
    "status": "idea",
    "scheduledAt": null,
    "media": [
      {
        "mediaId": "c3d4e5f6-a7b8-4c9d-8e0f-1a2b3c4d5e6f",
        "altText": "The spring collection on a table",
        "item": {
          "id": "c3d4e5f6-a7b8-4c9d-8e0f-1a2b3c4d5e6f",
          "folderId": null,
          "filename": "spring-collection.jpg",
          "altText": "The spring collection on a table",
          "mediaType": "image",
          "mimeType": "image/jpeg",
          "size": 482133,
          "width": 1080,
          "height": 1350,
          "aspectRatio": 0.8,
          "duration": null,
          "waveform": null,
          "createdAt": "2026-11-18T09:30:00.000Z",
          "formats": [],
          "usage": "used",
          "processing": {
            "state": "ready",
            "error": null
          },
          "previewUrl": "https://storage.beplan.io/org-media/…/preview?X-Amz-Signature=…",
          "mediaUrl": "https://storage.beplan.io/org-media/…?X-Amz-Signature=…",
          "playback": null,
          "publishCopy": null
        },
        "crop": null
      }
    ],
    "platforms": [
      {
        "socialAccountId": "0b6f5c1e-2a7d-4c3b-9e8f-1a2b3c4d5e6f",
        "platform": "linkedin",
        "isActive": true,
        "type": "post",
        "customCaption": null,
        "additionalParams": {
          "linkedin_visibility": "PUBLIC"
        },
        "media": null,
        "thread": [],
        "publishedUrl": null,
        "publishedUrlKind": null,
        "publishState": "pending",
        "publishError": null
      }
    ],
    "updatedAt": "2026-11-19T10:12:00.000Z",
    "pendingApproval": null,
    "scheduledVia": null
  }
}
```

## 4. Edit it

[`PATCH …/posts/{postId}`](https://beplan.io/docs/api/posts/#posts.update) changes only the fields you send. `media` and `formatIds` replace the whole list; `platforms` updates the accounts you list and leaves the others alone.

- **Don't overwrite someone else's change.** Send the post's `updatedAt` you last read as `baseUpdatedAt`. If the post changed since, the answer is `409` [`POST_CHANGED_ELSEWHERE`](https://beplan.io/docs/api/errors/#POST_CHANGED_ELSEWHERE): read it again and reapply your change.
- **A post open in Beplan's editor** refuses changes to its content (title, caption, hashtags, formats, media, accounts) with `409` [`POST_OPEN_IN_EDITOR`](https://beplan.io/docs/api/errors/#POST_OPEN_IN_EDITOR) and a `Retry-After` header. Wait that long and try again; someone is typing in it.
- A post that is published, or being published, can't change: `422` [`POST_ALREADY_PUBLISHED`](https://beplan.io/docs/api/errors/#POST_ALREADY_PUBLISHED).
- Editing a scheduled post keeps it scheduled. When the organization requires approval for your integration, it goes back to a pending approval for the same time ([post approval](https://beplan.io/docs/concepts/approval/)).

## 5. Schedule, or publish now

[`POST …/posts/{postId}/schedule`](https://beplan.io/docs/api/posts/#posts.schedule) takes `scheduledAt`, an ISO 8601 instant in the future. Every check runs now (accounts ready, media processed in time, platform rules such as TikTok's privacy level, links, the plan's monthly scheduled posts), and a post that could not go out fails here with a precise `422` or `402`, listed on the operation.

Example (Thursday at 14:00 UTC), `POST /organizations/{organizationId}/workspaces/{workspaceId}/posts/{postId}/schedule`:

```bash
curl -X POST "https://api.beplan.io/v1/organizations/ORGANIZATION_ID/workspaces/WORKSPACE_ID/posts/6f1c2a3b-4d5e-4f60-8a71-92b3c4d5e6f7/schedule" \
  -H "Authorization: Bearer beplan_pat_…" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "scheduledAt": "2026-12-03T14:00:00.000Z"
}'
```

```typescript
const response = await fetch("https://api.beplan.io/v1/organizations/ORGANIZATION_ID/workspaces/WORKSPACE_ID/posts/6f1c2a3b-4d5e-4f60-8a71-92b3c4d5e6f7/schedule", {
  method: "POST",
  headers: {
    Authorization: "Bearer beplan_pat_…",
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "scheduledAt": "2026-12-03T14:00:00.000Z"
  }),
});
if (!response.ok) throw new Error((await response.json()).error.code);
const { data } = await response.json();
```

```python
import uuid

import requests

response = requests.post(
    "https://api.beplan.io/v1/organizations/ORGANIZATION_ID/workspaces/WORKSPACE_ID/posts/6f1c2a3b-4d5e-4f60-8a71-92b3c4d5e6f7/schedule",
    headers={"Authorization": "Bearer beplan_pat_…", "Idempotency-Key": str(uuid.uuid4())},
    json={
        "scheduledAt": "2026-12-03T14:00:00.000Z",
    },
)
response.raise_for_status()
data = response.json()["data"]
```

Answers 200:

```json
{
  "data": {
    "id": "6f1c2a3b-4d5e-4f60-8a71-92b3c4d5e6f7",
    "title": "Spring drop teaser",
    "caption": "Something new lands Thursday.",
    "status": "scheduled",
    "scheduledAt": "2026-12-03T14:00:00.000Z",
    "order": 0,
    "formats": [],
    "platforms": [
      {
        "platform": "linkedin",
        "state": "pending",
        "url": null,
        "error": null
      }
    ],
    "media": [],
    "mediaCount": 0
  }
}
```

[`POST …/posts/{postId}/publish-now`](https://beplan.io/docs/api/posts/#posts.publishNow) publishes on every active account right away, with the same checks. It answers with the post `in_process`; read it again to see each account's result.

[`POST …/posts/{postId}/schedule-next-slot`](https://beplan.io/docs/api/posts/#posts.scheduleNextSlot) does what "Schedule to next slot" does in the app: it schedules the post at the first free time of the workspace's posting schedule that fits its formats (no post within 30 minutes, up to 52 weeks ahead, or after `after` when you send it), with the same checks as [`POST …/posts/{postId}/schedule`](https://beplan.io/docs/api/posts/#posts.schedule). The answer's `scheduledAt` is the slot it picked; two calls at once never pick the same one. When no free slot fits, it answers `422` [`NO_OPEN_SLOT_FITS_POST`](https://beplan.io/docs/api/errors/#NO_OPEN_SLOT_FITS_POST).

These answer `202` instead when the organization requires a person's approval; see [post approval](https://beplan.io/docs/concepts/approval/). [`POST …/posts/{postId}/unschedule`](https://beplan.io/docs/api/posts/#posts.unschedule) unschedules a post.

Workspace calendars are in the workspace's time zone (`timezone` from [`GET …/workspaces`](https://beplan.io/docs/api/workspaces/#workspaces.list)); [`GET …/calendar/open-slots`](https://beplan.io/docs/api/calendar/#calendar.openSlots.list) lists the workspace's open posting slots if you want to fill those. To see how far ahead the content is planned, [`GET …/calendar/runway`](https://beplan.io/docs/api/calendar/#calendar.runway.get) gives the covered days with a `breakdown` and a `label` written the way the app shows it (`1m 2w 4d`); [`GET …/calendar/completion`](https://beplan.io/docs/api/calendar/#calendar.completion.get) says how full this week and this month are (filled required slots out of all of them, and the open ones still ahead).

## 6. Follow the result

[`GET …/posts/{postId}`](https://beplan.io/docs/api/posts/#posts.get) gives each account's `publishState`: `pending`, then `published` with `publishedUrl`, or `failed` with `publishError`. A post that failed on some accounts can be retried on those with [`POST …/posts/{postId}/retry-failed`](https://beplan.io/docs/api/posts/#posts.retryFailed). A retry publishes now, so when the organization requires approval it answers `202` and waits for a person like [`POST …/posts/{postId}/publish-now`](https://beplan.io/docs/api/posts/#posts.publishNow).

Rather than polling, an app can subscribe to [`post.published`](https://beplan.io/docs/webhooks/events/#event-post.published) and [`post.failed`](https://beplan.io/docs/webhooks/events/#event-post.failed) ([webhooks](https://beplan.io/docs/guides/webhooks/)): one event per publication, with every account's result.

## Links in captions

Two tokens in a caption (or an account's own caption, or a thread post) become links when each publication goes out:

- **A link to another post**: `{{post:<postId>:<socialAccountId>}}` becomes the URL of that post on that account once it is published. Find candidates with [`GET …/posts/link-targets`](https://beplan.io/docs/api/posts/review-and-approval/#posts.linkTargets.list), and check a saved post's links before scheduling with [`GET …/posts/{postId}/link-status`](https://beplan.io/docs/api/posts/review-and-approval/#posts.linkStatus.get): the linked post must go out first, links can't loop, and an account can't link to its own post. Write `this` as the post id to link to another account's publication of the post being written. Problems are refused at scheduling with the `POST_LINK_*` codes listed on [`POST …/posts/{postId}/schedule`](https://beplan.io/docs/api/posts/#posts.schedule).
- **A tracked link**: create one first with [`POST …/tracked-links`](https://beplan.io/docs/api/tracked-links/#trackedLinks.create) (scope [`links:write`](https://beplan.io/docs/oauth/scopes/#scope-links-write)), then write `{{link:<trackedLinkId>}}`. Each publication gets its own short link (`https://bpln.to/<code>`) and its clicks are counted per publication ([`GET …/tracked-links/{trackedLinkId}/stats`](https://beplan.io/docs/api/tracked-links/#trackedLinks.stats.get), [`GET …/insights/posts/{postId}/tracked-links`](https://beplan.io/docs/api/tracked-links/#trackedLinks.forPost.list)).

## Safe retries

Every `POST` above accepts an `Idempotency-Key`. Send one on create, schedule and publish: if the network fails after Beplan acted, retrying with the same key returns the first answer instead of creating a second post or publishing twice ([idempotency](https://beplan.io/docs/guides/idempotency/)). Scheduling and publishing reach the social platforms, so they also count against the [smaller rate limit](https://beplan.io/docs/guides/rate-limits/) for such operations.

---
HTML version: https://beplan.io/docs/guides/schedule-a-post/
