Start free
Docs · Schedule a post

Developer docs

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.

Read as Markdown

On this page
  1. 1. Pick the accounts
  2. 2. Put the media in the library
  3. 3. Create the post
  4. 4. Edit it
  5. 5. Schedule, or publish now
  6. 6. Follow the result
  7. Links in captions
  8. Safe retries

Scopes used here: accounts:read to list accounts, posts:write to create and edit, posts:publish to schedule and publish, posts:read to follow the result. The person's role must allow the same in that workspace.

1. Pick the accounts

GET …/social-accounts 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 or SOCIAL_ACCOUNT_SETUP_REQUIRED.

Connecting a new account can't be finished by the API alone: POST …/social-accounts/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 until the account appears.

2. Put the media in the library

A post refers to media by their library ids. Upload the files, or import them from a URL, and wait until each is ready (processing.state on GET …/media-library/items/{mediaId}). Scheduling a post whose video is still processing fails with POST_MEDIA_PROCESSING.

3. Create the post

POST …/posts 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.
curl
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
{
  "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} 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: 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 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.
  • 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).

5. Schedule, or publish now

POST …/posts/{postId}/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.

curl
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
{
  "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 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 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. 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.

These answer 202 instead when the organization requires a person's approval; see post approval. POST …/posts/{postId}/unschedule unschedules a post.

Workspace calendars are in the workspace's time zone (timezone from GET …/workspaces); GET …/calendar/open-slots 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 gives the covered days with a breakdown and a label written the way the app shows it (1m 2w 4d); GET …/calendar/completion 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} 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. A retry publishes now, so when the organization requires approval it answers 202 and waits for a person like POST …/posts/{postId}/publish-now.

Rather than polling, an app can subscribe to post.published and post.failed (webhooks): one event per publication, with every account's result.

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

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). Scheduling and publishing reach the social platforms, so they also count against the smaller rate limit for such operations.