Developer docs
Guide: handle Beplan API errors
Every Beplan API error has the same shape and a stable code. Branch on the code, show the message, log the request id, and retry only what can succeed on a retry.
The envelope
{
"error": {
"code": "MISSING_PERMISSION",
"message": "You don't have permission to do this.",
"details": { "permission": "post:schedule" },
"requestId": "req_…"
}
} code: stable, upper-case, one HTTP status each. Branch on it, never onmessage.message: an English sentence written for people. It may be reworded at any time.details: extra facts for some codes (details.scope,details.reason,details.retryAfterSeconds,details.issuesfor validation errors…), described on the codes that have them. May be absent.requestId: also in theX-Request-Idheader of every answer, errors and successes alike. Log it; quote it when you contact Beplan about a call.
Every operation in the reference lists the codes it can answer, and the error codes page lists them all with their status and default message.
Validation errors
400 VALIDATION_FAILED carries details.issues, a list of { path, message }, one per field that failed. Fields you send that the operation does not know are ignored, not refused (versioning). A body that is not JSON is 415 UNSUPPORTED_MEDIA_TYPE: send Content-Type: application/json.
What to do, by class
| Status | Typical codes | Retry? | What to do |
|---|---|---|---|
400 |
VALIDATION_FAILED |
No | Fix the request: details.issues names the fields |
401 |
UNAUTHENTICATED, TOKEN_EXPIRED, TOKEN_REVOKED, APP_SUSPENDED |
No (an app refreshes once) | See authentication |
402 |
PLAN_UPGRADE_REQUIRED, SCHEDULED_POST_LIMIT_REACHED |
No | The organization's plan doesn't allow it, or a quota is used up. Tell the person |
403 |
INSUFFICIENT_SCOPE, INTEGRATION_BLOCKED_BY_ORGANIZATION, INTEGRATION_PENDING_APPROVAL, MISSING_PERMISSION |
No | Access: see why a call was refused |
404 |
ROUTE_NOT_FOUND, ORGANIZATION_NOT_FOUND, WORKSPACE_NOT_FOUND, …_NOT_FOUND |
No | The thing doesn't exist, or isn't given to this connection. Refresh your ids |
409 |
CONFLICT, POST_CHANGED_ELSEWHERE, POST_OPEN_IN_EDITOR, IDEMPOTENCY_KEY_REUSED |
Depends | Read the code: wait for Retry-After and retry (POST_OPEN_IN_EDITOR, an idempotent request still running), or read again and reapply (POST_CHANGED_ELSEWHERE), or use a new key (IDEMPOTENCY_KEY_REUSED) |
413 |
PAYLOAD_TOO_LARGE, MEDIA_STORAGE_FULL |
No | Send less, or free storage |
415 |
UNSUPPORTED_MEDIA_TYPE |
No | Send JSON |
422 |
Domain rules: POST_ALREADY_PUBLISHED, SCHEDULED_AT_IN_PAST, POST_LINK_*… |
No | The request is well formed but breaks a rule; the message says which |
429 |
RATE_LIMITED |
Yes, after Retry-After |
See rate limits |
500 |
INTERNAL_ERROR |
Yes, with backoff | Something failed on Beplan's side. Retry a few times, then report the requestId |
502 / 503 |
UPSTREAM_FAILED, SOCIAL_PLATFORM_UNAVAILABLE |
Yes, with backoff | A social platform or another service failed |
Some failures happen later, not in the answer: a scheduled post can fail when it is published. Follow it with GET …/posts/{postId} or the post.failed webhook.
Retrying well
- Retry only
429,5xxand the409codes that say to wait. Everything else fails the same way again. - Wait the
Retry-Afterheader's seconds when there is one. Otherwise back off exponentially (1 s, 2 s, 4 s…) with some randomness, and give up after a few tries. - Send an
Idempotency-Keyon everyPOSTyou might retry, and keep the same key across retries of the same request (idempotency). A5xxanswer is never stored, so the retry runs again; a2xxor4xxone is replayed. PATCH,PUTandDELETEtake no key. APATCHwithbaseUpdatedAtis safe to retry: if the first attempt went through, the retry answersPOST_CHANGED_ELSEWHEREand you read the post to see.
Through MCP
An MCP tool call that fails returns a tool error carrying the same code and message. A missing scope on an assistant's connection is an HTTP 403 with a WWW-Authenticate challenge naming the scope instead, so the assistant can ask the person for it (MCP).