Skip to main content
Understanding responses, error handling, and status codes for every Partner API endpoint. Designed for easy parsing by OpenClaw agents, Claude Code, and any programmatic integration.

Envelope Structure

All endpoints return the same typed envelope so you can branch on ok once and stay type-safe everywhere else.
ok
boolean
required
Indicates success (true) or failure (false).
code
number
required
Mirrors the HTTP status code returned by the endpoint.
message
string
required
Human-readable context for logs or UI surfaces.
data
object
Present only when ok is true. Contains the payload documented for each endpoint.
error_code
string
Optional machine-friendly identifier for failures (e.g., invalid_token, subscription_required).
When ok is true, data is guaranteed to exist. When ok is false, data is omitted, so you can rely on that distinction for strict typing in TypeScript, Swift, or Go clients.

Sample Handling

Common Status Codes

error_code is the fastest way to branch on known issues (e.g., invalid_media_url, post_not_mutable). Log both code and error_code for observability.

Handling 422 invalid_payload

When payload validation fails at the schema/shape layer, Partner API returns 422 with schema-level and field-level details. Account-aware rules that require resolved account metadata (for example a caption that is valid for Facebook but too long for a selected Pinterest account, or a text-only post sent to TikTok) surface later as 400 validation_failed. Unknown provider keys under settings are rejected here because Partner API fails closed on unrecognized platform settings.
Recommended handling:
  1. Detect code === 422 and error_code === "invalid_payload".
  2. Read both issues.formErrors and issues.fieldErrors.
  3. Fix field shape/data and retry.
  4. Do not retry unchanged payloads.