Skip to content
DunSocial Docs

Manage posts

Manage scheduled and published posts through the DunSocial API: list with filters, fetch one by id, reschedule, cancel, or delete, all per workspace.

All routes need Bearer + X-Workspace-Id.

List posts

GET /api/posts

Query params: status, socialAccountId, groupId, limit, offset

curl "https://api.dunsocial.com/api/posts?status=scheduled&limit=20" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "X-Workspace-Id: YOUR_WORKSPACE_ID"

Each item includes mediaUrls (media asset ids, same field as GET /api/posts/:id). You do not need to fetch every post to reconcile which assets a batch uses.

Get one post

GET /api/posts/:id — 404 if missing or outside the workspace. Same post fields as list, plus you can resolve asset ids to preview URLs via the media API.

Update a post

PATCH /api/posts/:id

Only drafts and scheduled posts can be edited. Body may include content, metadata, mediaUrls, scheduledAt, and statuses draft / scheduled / cancelled. The body id must match the path. DunSocial sets published / failed automatically; you cannot set them through this endpoint.

Reschedule

POST /api/posts/:id/reschedule

Body: { "content", "scheduledAt", "metadata"?, "mediaUrls"? }

Works for scheduled or failed posts.

Cancel

POST /api/posts/:id/cancel — only when status is scheduled.

Bulk cancel

POST /api/posts/bulk-cancel with { "ids": ["...", "..."] } → { cancelledCount }.

Delete

DELETE /api/posts/:id — removes the post, cancels any pending schedule job, and refunds X monthly cap usage when a scheduled X post is deleted.

Helpers

Method Path Notes
POST /api/posts/validate Dry-run schedule checks (no writes). See Schedule and publish.
GET /api/posts/scheduled-count?socialAccountId= Count of scheduled posts
GET /api/posts/x-cap-usage X monthly usage
POST /api/posts Low-level create (prefer schedule / publish-now)
POST /api/posts/:id/status Client status helper (draft / scheduled / cancelled only)