API docs
Upload, schedule and publish from your own code.
Base URL https://api.publedia.com. OpenAPI document
Get an API key
- Sign in as a workspace admin.
- Open Settings, Developers, then API keys.
- Create a key. Pick its access and an expiry of 30, 90 or 365 days.
- Copy it. It starts with
pbd_sk_and is shown once.
A key adds no allowance of its own: your plan limits apply. Rotate or revoke a key on the same page.
Authentication and scopes
Send the key as Authorization: Bearer pbd_sk_.... A key works in one workspace and never does more than the admin who owns it. Keep it on a server: browser requests from other sites are refused.
| Scope | Allows |
|---|---|
read | Read posts, media, channels, analytics, comments and settings |
media_upload | Upload files |
post_draft | Create and edit drafts and tags |
post_schedule | Schedule, queue and unschedule posts |
post_publish | Publish posts immediately |
post_retry | Retry failed posts |
post_cancel | Cancel posts |
inbox_reply | Reply to comments |
automation_pause | Pause and resume automations |
Keys cannot manage members, channels, billing, keys or webhooks, or read private messages.
Quick start
These commands need curl and jq. Run them in order in one shell.
Set your key
export PUBLEDIA_API="https://api.publedia.com"
export PUBLEDIA_API_KEY="pbd_sk_your_key"Pick a channel
curl -s "$PUBLEDIA_API/channels" -H "Authorization: Bearer $PUBLEDIA_API_KEY"
CHANNEL_ID=$(curl -s "$PUBLEDIA_API/channels" -H "Authorization: Bearer $PUBLEDIA_API_KEY" | jq -r '.data[0].id')Upload media
Uploading needs the media_upload scope. Start the upload, send the file by PUT to the returned URL, then confirm it. The example uses a 1080 by 1080 PNG named photo.png.
FILE="photo.png"
SIZE=$(wc -c < "$FILE" | tr -d ' ')
UPLOAD=$(curl -s -X POST "$PUBLEDIA_API/media/upload-intent" \
-H "Authorization: Bearer $PUBLEDIA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"filename":"photo.png","mime_type":"image/png","size_bytes":'"$SIZE"'}' \
| jq '.data')curl -s --fail -X PUT "$(echo "$UPLOAD" | jq -r '.upload_url')" \
-H "Content-Type: image/png" \
--data-binary @"$FILE"MEDIA=$(curl -s -X POST "$PUBLEDIA_API/media/confirm" \
-H "Authorization: Bearer $PUBLEDIA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"object_key":'"$(echo "$UPLOAD" | jq '.object_key')"',
"mime_type":"image/png","size_bytes":'"$SIZE"',"width":1080,"height":1080}' \
| jq '.data')
MEDIA_ID=$(echo "$MEDIA" | jq -r '.id')
OBJECT_KEY=$(echo "$MEDIA" | jq -r '.object_key')Create a draft
POST_ID=$(curl -s -X POST "$PUBLEDIA_API/posts" \
-H "Authorization: Bearer $PUBLEDIA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"format":"image","caption":"Hello from the API",
"destinations":[{"channel_id":"'"$CHANNEL_ID"'",
"media":[{"object_key":"'"$OBJECT_KEY"'","media_asset_id":"'"$MEDIA_ID"'",
"mime_type":"image/png","width":1080,"height":1080}]}]}' \
| jq -r '.data.posts[0].id')Schedule it
Use any future time. Without post_publish, a key schedules at least 15 minutes ahead.
SCHEDULE_AT="2027-06-01T09:00:00Z"
curl -s -X POST "$PUBLEDIA_API/posts/$POST_ID/schedule" \
-H "Authorization: Bearer $PUBLEDIA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"scheduled_at":"'"$SCHEDULE_AT"'"}'curl -s -X POST "$PUBLEDIA_API/posts/$POST_ID/unschedule" -H "Authorization: Bearer $PUBLEDIA_API_KEY"Publish now
Publishing is public and cannot be taken back once it starts. With hold_seconds (up to 60), call unschedule before the time runs out to stop it. A key cannot publish or schedule a TikTok post set to post directly: do that in the app.
curl -s -X POST "$PUBLEDIA_API/posts/$POST_ID/publish?hold_seconds=60" -H "Authorization: Bearer $PUBLEDIA_API_KEY"The same in JavaScript
Node 18 or later, saved as schedule.mjs.
import { readFile } from "node:fs/promises";
const API = process.env.PUBLEDIA_API ?? "https://api.publedia.com";
const auth = { Authorization: `Bearer ${process.env.PUBLEDIA_API_KEY}` };
async function api(path, { body, headers, ...init } = {}) {
const response = await fetch(API + path, {
...init,
headers: { ...auth, "Content-Type": "application/json", ...headers },
body: body && JSON.stringify(body),
});
const text = await response.text();
if (!response.ok) throw new Error(`${response.status} ${text}`);
return JSON.parse(text);
}
const file = await readFile("photo.png");
const details = { mime_type: "image/png", size_bytes: file.length };
const { data: upload } = await api("/media/upload-intent", {
method: "POST",
body: { filename: "photo.png", ...details },
});
const sent = await fetch(upload.upload_url, {
method: "PUT",
headers: { "Content-Type": details.mime_type },
body: file,
});
if (!sent.ok) throw new Error(`upload failed: ${sent.status}`);
const { data: stored } = await api("/media/confirm", {
method: "POST",
body: { object_key: upload.object_key, ...details, width: 1080, height: 1080 },
});
const channels = await api("/channels");
const draft = await api("/posts", {
method: "POST",
body: {
format: "image",
caption: "Hello from the API",
destinations: [
{
channel_id: channels.data[0].id,
media: [
{
object_key: stored.object_key,
media_asset_id: stored.id,
mime_type: stored.mime_type,
width: 1080,
height: 1080,
},
],
},
],
},
});
const postId = draft.data.posts[0].id;
await api(`/posts/${postId}/schedule`, {
method: "POST",
body: { scheduled_at: "2027-06-01T09:00:00Z" },
});
console.log("scheduled", postId);Read results
Publishing happens in the background. Read the post until its status settles, or use webhooks.
curl -s "$PUBLEDIA_API/posts/$POST_ID" -H "Authorization: Bearer $PUBLEDIA_API_KEY" \
| jq '.data.post | {status, scheduled_at, published_at, permalink, error_message}'curl -s "$PUBLEDIA_API/posts?status=scheduled&sort=soonest&page_size=20" -H "Authorization: Bearer $PUBLEDIA_API_KEY"curl -s "$PUBLEDIA_API/analytics/summary?from=2027-01-01&to=2027-01-31" -H "Authorization: Bearer $PUBLEDIA_API_KEY"When an X post has to be posted by hand
Some failed X posts can be posted by you on X. This needs post_retry. First stop the automatic retry, post it, then record the link.
curl -s -X POST "$PUBLEDIA_API/posts/$FAILED_POST_ID/post-by-hand" -H "Authorization: Bearer $PUBLEDIA_API_KEY"curl -s -X POST "$PUBLEDIA_API/posts/$FAILED_POST_ID/mark-posted" \
-H "Authorization: Bearer $PUBLEDIA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"permalink":"https://x.com/yourhandle/status/1234567890123456789"}'Errors
Errors share one shape. /mcp answers with problem details instead.
{
"error": {
"code": "permission_denied",
"message": "This caller cannot perform 'post_publish'.",
"details": null
}
}| Status | Code | Meaning |
|---|---|---|
| 401 | unauthorized | No key was sent |
| 401 | invalid_api_key | The key is wrong |
| 403 | permission_denied | The key lacks a scope |
| 403 | api_key_not_allowed | Only a signed-in person can |
| 403 | workspace_forbidden | Another workspace's key |
| 404 | not_found | Nothing here by that id |
| 409 | varies | The post's state forbids it |
| 422 | validation_error | See details for the field |
| 429 | rate_limited | Wait for Retry-After seconds |
Rate limits
Limits are per workspace. Over one, you get status 429 and a Retry-After header.
| Requests | Limit |
|---|---|
| Schedule, queue and reschedule | 300 per 10 minutes |
| Publish, retry and mark posted | 120 per 10 minutes |
| Calls to /mcp | 240 per 1 minute |
| New uploads | 60 per 1 minute |
| AI writing and reply drafts | 20 per 1 minute |
| Assistant messages | 30 per 1 minute |
| Assistant proposals | 120 per 1 minute |
Webhooks
An admin adds a URL in Settings, Developers, Webhooks, up to 20 per workspace. The signing secret starts with whsec_ and is shown once.
- The body is JSON with
id,event,created_at,workspace_idanddata. - Headers:
X-Webhook-Signature,X-Webhook-Event,X-Webhook-Delivery,X-Webhook-Attempt. - Answer with a 2xx within 10 seconds. A failure is retried after 30 seconds, 2 minutes, 10 minutes, 30 minutes, 2 hours.
- Retries repeat the delivery id, so use it to skip duplicates.
Check the signature against the raw body, before parsing it.
import { createHmac, timingSafeEqual } from "node:crypto";
export function verifyWebhook(rawBody, signatureHeader, secret) {
const parts = Object.fromEntries(signatureHeader.split(",").map((part) => part.split("=")));
const expected = createHmac("sha256", secret).update(`${parts.t}.`).update(rawBody).digest("hex");
const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) <= 300;
return (
fresh &&
parts.v1?.length === expected.length &&
timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected))
);
}| Event | Sent when |
|---|---|
post.scheduled | A post was given a time |
post.published | A post reached the platform |
post.failed | The platform refused a post |
post.cancelled | A scheduled post was cancelled |
channel.connected | An account finished connecting |
channel.disconnected | An account needs reconnecting |
comment.received | Someone commented on a post |
comment.replied | An automation answered a comment |
comment.reply_failed | An automation could not answer |
automation.run_failed | An automation run stopped part-way |
automation.approval_requested | A run waits for approval |
Reference
Every endpoint an API key can call, generated from the API itself. Full request and response schemas are in the OpenAPI document. Questions? Contact us.
Posts
GET/postsList posts
One page of post groups, newest first unless sort says otherwise.
Scope read Link
statusquery: draft | queued | scheduled | publishing | published | partially_failed | failed | cancelled[]tag_idquery: uuid[]channel_idquery: uuid[]scheduled_fromquery: date-timescheduled_toquery: date-timeobject_keyquery: stringhas_failed_postquery: booleaninclude_ideasquery: booleansearchquery: stringsortquery: newest | oldest | soonestpagequery: integerpage_sizequery: integer
POST/postsCreate post
Scope post_draft Link
captionbody: stringdestinationsbody: object[]formatbody: text | image | carousel | video | reel | story | poll | threadmediabody: object[]media_idsbody: uuid[]titlebody: string
DELETE/posts/groups/{group_id}Delete idea
GET/posts/groups/{group_id}Get group
One post group: an idea with its caption and files, or a post with its channels.
Scope read Link
group_idpath, required: uuid
PATCH/posts/groups/{group_id}Update idea
Edit an idea's title, caption or files.
Scope post_draft Link
group_idpath, required: uuidcaptionbody: stringmediabody: object[]media_idsbody: uuid[]titlebody: string
POST/posts/groups/{group_id}/channelsAdd group channel
Scope post_draft Link
group_idpath, required: uuidcaption_overridebody: stringchannel_idbody, required: uuidformat_overridebody: text | image | carousel | video | reel | story | poll | threadmediabody: object[]settingsbody: object
DELETE/posts/groups/{group_id}/channels/{channel_id}Remove group channel
Take one channel's post out of the group.
Scope post_draft Link
group_idpath, required: uuidchannel_idpath, required: uuid
POST/posts/tagsApply post tags
GET/posts/{post_id}Get post
One post, its group, its events, and its evergreen provenance: which category published it, and which categories are recycling it.
Scope read Link
post_idpath, required: uuid
PATCH/posts/{post_id}Update post
Scope post_draft Link
post_idpath, required: uuidcaptionbody: stringcollaboratorsbody: string[]expected_updated_atbody: date-timefirst_commentbody: stringformatbody: text | image | carousel | video | reel | story | poll | threadlink_taggingbody: booleanmediabody: object[]placementbody: stringpollbody: objectsettingsbody: objectthreadbody: object[]titlebody: string
POST/posts/{post_id}/cancelCancel post
Scope post_cancel Link
post_idpath, required: uuidscopequery: group | post
POST/posts/{post_id}/duplicateDuplicate post
Copy the whole post, every channel it went to, into new drafts with no time.
Scope post_draft Link
post_idpath, required: uuid
POST/posts/{post_id}/mark-postedMark posted
Record that the owner posted a failed X post themselves: it becomes published with delivery_mode manual and is never sent.
Scope post_retry Link
post_idpath, required: uuidpermalinkbody: string
POST/posts/{post_id}/post-by-handTake post off retry
Stop a failed X post's automatic retry so its owner can post it on X without it going out twice.
Scope post_retry Link
post_idpath, required: uuid
POST/posts/{post_id}/publishPublish post
Publish each post in scope now.
Scope post_publish Link
post_idpath, required: uuidscopequery: group | posthold_secondsquery: integer
POST/posts/{post_id}/queueQueue post
Put each draft in scope on the queue.
Scope post_schedule Link
post_idpath, required: uuidscopequery: group | post
POST/posts/{post_id}/rescheduleReschedule post
Scope post_schedule Link
post_idpath, required: uuidscopequery: group | postscheduled_atbody, required: date-time
POST/posts/{post_id}/retryRetry post
Scope post_retry Link
post_idpath, required: uuidscopequery: group | post
POST/posts/{post_id}/scheduleSchedule post
Scope post_schedule Link
post_idpath, required: uuidscopequery: group | postscheduled_atbody, required: date-time
POST/posts/{post_id}/unscheduleUnschedule post
Put each scheduled or queued post in scope back to draft, with no time.
Scope post_schedule Link
post_idpath, required: uuidscopequery: group | post
Media
GET/albumsList albums
Scope read Link
GET/mediaList media
Scope read Link
album_idquery: uuid
POST/media/confirmConfirm media
Finish an upload: checks the stored file and adds it to the media library.
Scope media_upload Link
album_idbody: uuidalt_textbody: stringdesign_idbody: uuidduration_secondsbody: numberheightbody: integermime_typebody, required: stringobject_keybody, required: stringoriginal_namebody: stringsize_bytesbody, required: integerwidthbody: integer
POST/media/upload-intentCreate upload intent
Start an upload: returns the object key and the URL to send the file to by PUT.
Scope media_upload Link
filenamebody, required: stringmime_typebody, required: stringsize_bytesbody, required: integer
Channels
GET/channelsList channels
Scope read Link
GET/channels/{channel_id}Get channel
Scope read Link
channel_idpath, required: uuid
GET/channels/{channel_id}/healthChannel health
Scope read Link
channel_idpath, required: uuid
GET/channels/{channel_id}/publish-optionsPublish options
What this channel's settings sheet can choose from, read live from its platform.
Scope read Link
channel_idpath, required: uuidlanguagequery: en | es | ru | tr | az
GET/channels/{channel_id}/statsChannel stats
Scope read Link
channel_idpath, required: uuid
Channel groups
Tags
GET/tagsList tags
POST/tagsCreate tag
DELETE/tags/{tag_id}Delete tag
PATCH/tags/{tag_id}Update tag
Posting times
GET/posting-schedulesList posting schedules
Every channel in this workspace that has posting times, with the week it posts on and the next instant that week produces.
Scope read Link
DELETE/posting-schedules/{channel_id}Delete posting schedule
Remove a channel's posting times, so it has no queue.
Scope post_schedule Link
channel_idpath, required: uuid
GET/posting-schedules/{channel_id}Get posting schedule
One channel's posting times, or null when it has none.
Scope read Link
channel_idpath, required: uuid
PUT/posting-schedules/{channel_id}Replace posting schedule
Replace a channel's posting times.
Scope post_schedule Link
channel_idpath, required: uuidday_selectorbody, required: objecttimes_of_daybody, required: string[]
GET/posting-schedules/{channel_id}/slotsList upcoming slots
The next slots this channel's week produces, each marked free or carrying the post that occupies it.
Scope read Link
channel_idpath, required: uuidcountquery: integer
Analytics
GET/analytics/postsList post analytics
Published posts in a date range with their most recent metric reading.
Scope read Link
fromquery: datetoquery: dateplatformquery: x | linkedin | facebook | instagram | tiktok | youtube | bluesky | threads[]channel_idquery: uuid[]post_idquery: uuid[]sortquery: published_at | engagement | engagement_rate | impressions | views | likes | comments | shares | saves | clicksorderquery: asc | descpagequery: integerpage_sizequery: integertimezonequery: string
GET/analytics/summaryAnalytics summary
Metric totals and a per-channel split over the same filters as /analytics/posts, with no paging.
Scope read Link
fromquery: datetoquery: dateplatformquery: x | linkedin | facebook | instagram | tiktok | youtube | bluesky | threads[]channel_idquery: uuid[]timezonequery: string
GET/analytics/timeseriesAnalytics over time
The same totals as /analytics/summary, split by the local day each post published.
Scope read Link
fromquery: datetoquery: dateplatformquery: x | linkedin | facebook | instagram | tiktok | youtube | bluesky | threads[]channel_idquery: uuid[]metricquery: engagement | impressions | views | likes | comments | shares | saves | clicks[]intervalquery: day | weektimezonequery: string
Dashboard
GET/dashboard/summaryGet summary
Omit timezone to read the day grid in the workspace's own zone.
Scope read Link
timezonequery: string
Inbox
GET/inbox/auto-answer-suggestionAuto answer suggestion
Scope read Link
GET/inbox/commentsList comments
One page of top-level comments with single-level nested replies, latest activity first.
Scope read Link
statusquery: open | handledplatformquery: x | linkedin | facebook | instagram | tiktok | youtube | bluesky | threadschannel_idquery: uuidpost_idquery: uuidflaggedquery: booleanpagequery: integerpage_sizequery: integer
POST/inbox/comments/{comment_id}/hideHide comment
POST/inbox/comments/{comment_id}/replyReply to comment
Send a public reply or direct message in answer to one comment.
Scope inbox_reply Link
comment_idpath, required: uuidbodybody, required: stringdestinationbody: public_comment | direct_message
POST/inbox/comments/{comment_id}/statusUpdate comment status
Mark a comment handled or reopen it for triage.
Scope inbox_reply Link
comment_idpath, required: uuidstatusbody, required: open | handled
POST/inbox/comments/{comment_id}/suggested-replySuggest reply
Drafts a reply to one comment in the brand's voice, for a person to edit before sending.
Scope inbox_reply Link
comment_idpath, required: uuid
POST/inbox/comments/{comment_id}/unhideUnhide comment
Unhide one previously hidden comment on the remote platform.
Scope inbox_reply Link
comment_idpath, required: uuid
GET/inbox/saved-repliesList saved replies
Every saved reply in this workspace, by name.
Scope read Link
POST/inbox/saved-repliesCreate saved reply
DELETE/inbox/saved-replies/{saved_reply_id}Delete saved reply
PATCH/inbox/saved-replies/{saved_reply_id}Update saved reply
Rename or rewrite a saved reply.
Scope inbox_reply Link
saved_reply_idpath, required: uuidbodybody: stringnamebody: string
GET/inbox/summaryGet summary
Open top-level comments and open conversations, for the workspace and per channel.
Scope read Link
Automations
GET/automationsList automations
Automations in this workspace.
Scope read Link
statusquery: active | paused | archivedkindquery: evergreen | flow | comment | message | inboxpost_idquery: uuidexclude_archivedquery: booleanpagequery: integerpage_sizequery: integer
GET/automations/countsCount automations
How many automations this workspace has in each kind and status, zeros included, so a screen can label its tabs without paging every list.
Scope read Link
GET/automations/suspended-runsList suspended runs
Runs paused at an approval gate in suspend mode, waiting for a decision.
Scope read Link
automation_idquery: uuid
GET/automations/{automation_id}Get automation
Scope read Link
automation_idpath, required: uuid
POST/automations/{automation_id}/pausePause automation
Scope automation_pause Link
automation_idpath, required: uuid
POST/automations/{automation_id}/resumeResume automation
Scope automation_pause Link
automation_idpath, required: uuid
Designs
GET/designsList designs
Scope read Link
GET/designs/{design_id}Get design
Scope read Link
design_idpath, required: uuid
GET/designs/{design_id}/renders/{render_id}Get render
Scope read Link
design_idpath, required: uuidrender_idpath, required: uuid
GET/designs/{design_id}/variation-setsList variation sets
Every variation set built from this design, newest first.
Scope read Link
design_idpath, required: uuid
GET/designs/{design_id}/variation-sets/{set_id}Get variation set
How a variation set is going: which variants are waiting, running, done, or failed, and why.
Scope read Link
design_idpath, required: uuidset_idpath, required: uuid
Repurposing
Notifications
GET/notificationsGet notifications
What this workspace has to hear about: failed posts, channels that stopped authenticating, runs waiting for approval, and the past week of posts published and members joined.
Scope read Link
Workspace
GET/workspaces/{workspace_id}/brandGet brand
The brand this workspace posts as: name, kind, category, description, website, logo, colour, and tone.
Scope read Link
workspace_idpath, required: uuid
GET/workspaces/{workspace_id}/deletionGet workspace deletion
Whether this workspace is scheduled for deletion and when, whether asking would delete it at once (it holds nothing) or schedule it, and whether the caller may ask or cancel.
Scope read Link
workspace_idpath, required: uuid
GET/workspaces/{workspace_id}/feature-preferencesGet feature preferences
GET/workspaces/{workspace_id}/gateway-appsList platform apps
Every platform this workspace may publish on an app of its own, and whether it brought one.
Scope read Link
workspace_idpath, required: uuid
GET/workspaces/{workspace_id}/membersList members
Everyone in this workspace, oldest membership first.
Scope read Link
workspace_idpath, required: uuid
GET/workspaces/{workspace_id}/notification-preferencesGet notification preferences
What the caller wants to hear about in this workspace.
Scope read Link
workspace_idpath, required: uuid
PUT/workspaces/{workspace_id}/notification-preferencesReplace notification preferences
Replace the caller's notification settings for this workspace.
Scope read Link
workspace_idpath, required: uuideventsbody: object[]
GET/workspaces/{workspace_id}/settingsGet workspace settings
Workspace-wide settings that are not brand facts: the timezone every posting week is read in, plus what setup was told this workspace is for and what it starts from.
Scope read Link
workspace_idpath, required: uuid
GET/workspaces/{workspace_id}/usageGet usage
What this workspace is using against the plan it is on: connected accounts, seats, posts published this month, media storage in bytes, and automations.
Scope read Link
workspace_idpath, required: uuid
Integrations
GET/integrations/lundotGet Lundot
This workspace's Lundot connection: its status, the Lundot workspace it reaches, the granted scopes and each site with its sign-up goal and tagging switch.
Scope read Link
Assistant
POST/ai/chatChat
Ask the assistant about this workspace.
Scope read Link
conversation_idbody: uuidmessagebody, required: stringroutebody: string
GET/ai/conversationsList conversations
The caller's recent assistant conversations, most recently used first.
Scope read Link
POST/ai/conversationsCreate conversation
Reserve a conversation id ahead of the first message, for a client that needs the real id before it can persist anything locally.
Scope read Link
routebody: string
GET/ai/conversations/{conversation_id}Get conversation
Every turn in one of the caller's conversations, oldest first.
Scope read Link
conversation_idpath, required: uuid
GET/ai/conversations/{conversation_id}/proposalsList proposals
Changes the assistant suggested in this conversation that are still waiting for a decision.
Scope read Link
conversation_idpath, required: uuid
POST/ai/fieldsGenerate field
Writes one automation or composer field from the brand and the content already around it.
Scope post_draft Link
contextbody: stringcountbody: integerkindbody, required: automation_name | brand_description | caption | themes | hashtags | call_to_action | rewrite_instructions | blocked_topics | video_hook | video_bodytonebody: casual | professional | playful | authoritative
POST/ai/proposals/{proposal_id}/applyApply proposal
POST/ai/proposals/{proposal_id}/declineDecline proposal
POST/ai/proposals/{proposal_id}/undoUndo proposal
Put the workspace back as it was before an applied change.
Scope read Link
proposal_idpath, required: uuid
GET/ai/settingsGet assistant settings
Workspace AI governance: whether the in-app assistant renders, whether external MCP clients are accepted, and this month's token spend against the configured ceiling.
Scope read Link