API reference · Posts
Preview or cancel a bounded scheduled batch
POST /v1/posts/bulk/cancel
Supply 1 to 200 unique IDs, one profile, and an inclusive timezone-qualified scheduled-time window. dryRun returns a snapshot of all stored post fields and the selection scope. Send it on apply to reject any intervening change, including media/options edits. Cancellation is all-or-none, scheduled-only and never retracts published content. Legacy calls without a snapshot retain execution-time compare-and-swap protection only.
Request
Authenticate with a bearer API key. This batch operation is REST-only; MCP cancel_post handles one post at a time.
curl -X POST https://api.postlake.dev/v1/posts/bulk/cancel \
-H "Authorization: Bearer $POSTLAKE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"ids":["…"],"profile":"…","from":"…","to":"…"}'Body
| Field | Type | Required | What it is |
|---|---|---|---|
ids | array of string | Yes | Exact IDs of scheduled posts to preview or cancel. |
profile | string | Yes | Every target of every selected post must belong to this profile. |
from | string | Yes | Inclusive earliest scheduled time, with Z or an explicit offset. |
to | string | Yes | Inclusive latest scheduled time, with Z or an explicit offset. |
dryRun | boolean | No | Preview the selection without cancelling anything. |
snapshot | string | No | Full-post and selection snapshot returned by preview. Apply rejects changed content or scope with HTTP 409. |
Response
Preview or all posts cancelled (200).
| Field | Type | Required | What it is |
|---|---|---|---|
dryRun | boolean | Yes | |
snapshot | string | Yes | |
matched | integer | Yes | |
results | array of object | Yes |
Example
{
"dryRun": false,
"snapshot": "…",
"matched": 0,
"results": [
{
"id": "…",
"cancelled": "…",
"error": "…"
}
]
}What it costs
Nothing. Previewing and cancelling scheduled posts spend no publishing credits. A post already claimed for publishing cannot be cancelled by this operation.
Calling this from an agent
This batch operation is REST-only. MCP agents can cancel scheduled posts individually with cancel_post; an agent using a PostLake API key may call this REST endpoint for a bounded batch.
Errors
Every failure uses one shape: a stable type, a granular code, the field at fault in param, and a plain-language fix. An agent can act on it without a person reading the message. See Errors and retries.
Idempotency-Key.Common questions
Can an AI agent do this without the REST API?
MCP's cancel_post handles one scheduled post at a time. The bounded, profile-scoped batch operation is currently REST-only. An agent with an API key can call it directly.
Is it safe to retry this call?
Do not automatically repeat a write after a timeout unless that endpoint explicitly documents idempotency. First read the resulting state; a second request could repeat the action.
What happens when it fails?
You get one error shape: a stable type, a granular code you can branch on, the offending field in param, and a fix written so an agent can correct itself rather than stop. Full list on Errors and retries.