Manage posts
List, get, reschedule, cancel, and delete posts.
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"Get one post
GET /api/posts/:id — 404 if missing or outside the workspace.
Update a post
PATCH /api/posts/:id
Only drafts and scheduled posts can be edited. Body may include content, metadata, mediaUrls, scheduledAt, and client statuses draft / scheduled / cancelled. The body id must match the path. published / failed are set only by trusted publish workers.
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 |
|---|---|---|
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) |