{
  "openapi": "3.1.0",
  "info": {
    "title": "PostEverywhere API Reference",
    "version": "1.0.1",
    "description": "Public v1 API for PostEverywhere: schedule and publish content across\n13 platforms: X (Twitter), Google Business Profile, Instagram, Facebook, LinkedIn, YouTube,\nTikTok, Threads, Pinterest, Bluesky, Telegram, Discord and WordPress.\n\nNew here? Start with the [Quick Start](/quick-start) (first post in 5\nminutes) and [Authentication](/authentication). Platform-specific\nbehavior lives in the [Platform Guides](/platforms/instagram), and\nmedia constraints in [Media Requirements](/media-requirements).\n\n## Authentication\nAll endpoints (except the device-login pair under `/auth/device`) accept an\nAPI key in the `Authorization` header:\n\n```\nAuthorization: Bearer pe_live_...\n```\n\nKeys are created in the dashboard (Developers) or minted by the CLI device\nflow (`POST /auth/device` → `POST /auth/device/token`). Keys carry scopes\n(`read`, `write`, `ai`); each operation's required scope is noted via\n`x-scope`. A missing scope returns `403 insufficient_scope`. A browser\nsession cookie also works as a fallback for interactive testing; scopes are\nthen implicitly `read, write, ai` and API-key rate limits are skipped.\n\nAuth failures return `401` with codes `invalid_api_key`, `api_key_revoked`,\nor `api_key_expired`. Organizations without an active subscription receive\n`402 subscription_required` (the error object additionally carries\n`subscription_status`).\n\n## Response envelope\nEvery endpoint responds with the same JSON envelope: a `data` object, an\n`error` object and a `meta` object (`meta.request_id`, an 8-character\ncorrelation id, and `meta.timestamp`, ISO 8601). On success `error` is\n`null`. On failure `data` is `null` and `error` carries `message`, `code`\n(for example `validation_error`), `retryable` and an optional `details`\nobject.\n\n`error.retryable` is `true` for transient failures (HTTP 5xx and 429) and\n`false` for permanent ones; clients should not blindly retry 4xx.\nException: the auth layer's own 401/402 responses omit `retryable` and\n`meta.request_id` (they carry only `meta.timestamp`).\n\n## Rate limiting\nAPI keys are limited to 60 requests/minute and 1,000 requests/hour.\nWhen the API-key limit is hit the `429` response includes\n`X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`\n(unix seconds) headers. Every `429` (including posting-budget and\nAI-budget limits, which are separate from the API-key limit) includes a\n`Retry-After` header (seconds, default 30).\n\nPosting budgets (per user): immediate publishes 60/min, 200/hour,\n1,000/day; scheduled posts 100/min, 1,000/hour with no daily cap.\nMedia uploads: 500/hour, 2,500/day, counted when an upload finishes\n(`/media/ID/complete`, a direct upload, or `/media/upload-from-url`),\nnot at presign.\n\nX: scheduled posts are limited to 100 a day per organisation. A post over\nthe limit is held and sent when the window reopens; it is not failed.\nDuring a free trial each X account can post 15 times a day.\n\n## Timestamps\nAll timestamps are ISO 8601. `scheduled_for` request values without an\nexplicit offset are interpreted as UTC. The `timezone` field is display\nmetadata only. It never changes when a post fires.\n",
    "contact": {
      "name": "PostEverywhere Developers",
      "url": "https://posteverywhere.ai/docs"
    }
  },
  "servers": [
    {
      "url": "https://app.posteverywhere.ai/api/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Introspection",
      "description": "Ask the API who you are: key scopes, organization, quota, and usage. Lets SDKs, CLIs, and AI agents self-configure from a bare API key."
    },
    {
      "name": "Accounts",
      "description": "List and inspect connected social accounts across all 13 platforms, including per-account publish health and reconnect status."
    },
    {
      "name": "Posts",
      "description": "Create, schedule, draft, retry, and inspect posts across 13 platforms: single posts, bulk batches of 50, and per-platform content overrides."
    },
    {
      "name": "Media",
      "description": "Upload images, video, and PDFs (direct, presigned three-step, or imported straight from a URL), then attach them to posts on any platform."
    },
    {
      "name": "AI",
      "description": "Generate platform-tuned social media captions and AI images from the API, using your organization's AI credit allowance."
    },
    {
      "name": "Analytics",
      "description": "Pull cross-platform performance summaries (impressions, likes, comments, and per-post results) for reporting and dashboards."
    },
    {
      "name": "Campaigns",
      "description": "Group posts into campaigns to tag, filter, and report on related content across platforms."
    },
    {
      "name": "Webhooks",
      "description": "Subscribe to real-time post lifecycle events (published, failed, updated) with signed deliveries and automatic retries."
    },
    {
      "name": "Auth",
      "description": "Device-grant login and browser OAuth handoff: connect social accounts from CLIs, servers, and AI agents without a dashboard session."
    },
    {
      "name": "Platform Rules",
      "description": "Per-platform composer rules (character limits, media constraints, and feature support) so clients can validate before publishing."
    }
  ],
  "paths": {
    "/me": {
      "get": {
        "operationId": "getMe",
        "x-scope": "read",
        "tags": [
          "Introspection"
        ],
        "summary": "Get current API key context, organization, quota and usage",
        "description": "Returns who the key belongs to, its scopes, the organization's\nsubscription state, quota usage (accounts, AI credits, storage,\nseats) and post counts. Lets SDK/MCP clients self-configure without\nbeing handed `organization_id` etc.\n",
        "responses": {
          "200": {
            "description": "Current context",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Me"
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/brand": {
      "get": {
        "operationId": "getBrand",
        "x-scope": "read",
        "tags": [
          "AI"
        ],
        "summary": "Get the workspace's brand",
        "description": "The workspace's Brand Kit (app.posteverywhere.ai/brand), built\nfrom the business website: what the business does, products, audience,\nvoice, language, rules (each with always_applied), banned words,\nrequired hashtags, colours and fonts. `brand` is null when none is set\nup. `/ai/generate-caption` writes in this brand automatically.\nScoped to the key's workspace.\n",
        "responses": {
          "200": {
            "description": "The brand (or null)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "brand": {
                          "type": "object",
                          "nullable": true,
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "about": {
                              "type": "string",
                              "nullable": true
                            },
                            "industry": {
                              "type": "string",
                              "nullable": true
                            },
                            "website": {
                              "type": "string",
                              "nullable": true
                            },
                            "products": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "audience": {
                              "type": "string",
                              "nullable": true
                            },
                            "voice": {
                              "type": "string",
                              "nullable": true
                            },
                            "voice_traits": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "voice_example": {
                              "type": "string",
                              "nullable": true
                            },
                            "language": {
                              "type": "string",
                              "nullable": true
                            },
                            "language_name": {
                              "type": "string",
                              "nullable": true
                            },
                            "facts": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "post_ideas": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "rules": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "rule": {
                                    "type": "string"
                                  },
                                  "always_applied": {
                                    "type": "boolean"
                                  }
                                }
                              }
                            },
                            "banned_words": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "required_hashtags": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "colors": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "fonts": {
                              "type": "object",
                              "properties": {
                                "heading": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "body": {
                                  "type": "string",
                                  "nullable": true
                                }
                              }
                            },
                            "has_logo": {
                              "type": "boolean"
                            }
                          }
                        },
                        "brands": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "is_default": {
                                "type": "boolean"
                              }
                            }
                          }
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          }
        }
      }
    },
    "/accounts": {
      "get": {
        "operationId": "listAccounts",
        "x-scope": "read",
        "tags": [
          "Accounts"
        ],
        "summary": "List connected social accounts",
        "description": "Returns all active social accounts in the organization with a brief\nhealth block per account. Not paginated. Facebook-flow Instagram rows\nthat have an Instagram-direct sibling are excluded (they are hidden in\nthe dashboard too).\n",
        "responses": {
          "200": {
            "description": "Accounts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "accounts"
                      ],
                      "properties": {
                        "accounts": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/SocialAccount"
                          }
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                },
                "examples": {
                  "accounts": {
                    "value": {
                      "data": {
                        "accounts": [
                          {
                            "id": 2280,
                            "platform": "instagram",
                            "account_name": "acme.co",
                            "avatar_url": "https://cdn.posteverywhere.ai/avatars/2280.jpg",
                            "is_active": true,
                            "created_at": "2026-05-01T10:00:00.000Z",
                            "health": {
                              "status": "healthy",
                              "can_post": true,
                              "needs_reconnection": false
                            }
                          }
                        ]
                      },
                      "error": null,
                      "meta": {
                        "request_id": "9f2c1a3b",
                        "timestamp": "2026-07-08T09:00:00.000Z"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/accounts/{id}": {
      "get": {
        "operationId": "getAccount",
        "x-scope": "read",
        "tags": [
          "Accounts"
        ],
        "summary": "Get a single connected social account",
        "description": "Account IDs are integers (as returned by `GET /accounts`), not UUIDs.\nNon-numeric IDs return `400 invalid_id`.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/AccountId"
          }
        ],
        "responses": {
          "200": {
            "description": "Account",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SocialAccount"
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/accounts/{id}/health": {
      "get": {
        "operationId": "getAccountHealth",
        "x-scope": "read",
        "tags": [
          "Accounts"
        ],
        "summary": "Get a detailed health report for an account",
        "description": "Tells clients whether an account is currently usable (token alive, no\nreconnection required, recent publish activity). `status` verdicts:\n`healthy` (post away), `warning` (`recent_permanent_failures` or\n`token_expiring_soon`; posting still allowed), `broken`\n(`account_inactive`, `needs_reconnection` or `token_expired`;\n`can_post` is false).\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/AccountId"
          }
        ],
        "responses": {
          "200": {
            "description": "Health report",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AccountHealthReport"
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/accounts/connect-link": {
      "post": {
        "operationId": "createConnectLink",
        "x-scope": "write",
        "tags": [
          "Accounts"
        ],
        "summary": "Mint an OAuth connect link for a new social account",
        "description": "Returns a short-lived (10 minute) authorization URL for connecting a\nNEW account on an OAuth platform: `x`, `instagram`, `facebook`,\n`youtube`, `pinterest`, `threads`, `linkedin`, `tiktok`,\n`google_business`. For `google_business` (Google Business Profile) the\nowner signs in with the Google account that owns or manages the\nbusiness; if it manages several businesses, they choose which to\nadd, and each one becomes its own account. Hand the URL\nto the account owner; they approve in any browser (logged in to\nPostEverywhere or not, identity is carried in the signed state), and\nthe account lands in this organization. Poll `GET /accounts` until it\nappears. For `telegram`, `discord`, `bluesky`, `wordpress` use\n`POST /accounts/connect-credential` instead, no browser needed.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "platform"
                ],
                "properties": {
                  "platform": {
                    "type": "string",
                    "enum": [
                      "x",
                      "instagram",
                      "facebook",
                      "youtube",
                      "pinterest",
                      "threads",
                      "linkedin",
                      "tiktok",
                      "google_business"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Connect link minted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "platform": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string",
                          "description": "Authorization URL to open in a browser"
                        },
                        "expires_in_seconds": {
                          "type": "integer",
                          "example": 600
                        },
                        "instructions": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/accounts/connect-credential": {
      "post": {
        "operationId": "connectCredentialAccount",
        "x-scope": "write",
        "tags": [
          "Accounts"
        ],
        "summary": "Connect telegram, discord, bluesky or wordpress directly with credentials",
        "description": "Connects a credential-based platform entirely through the API, no\nbrowser involved. Credentials are validated live against the platform\nbefore saving; invalid credentials return a 400 with the reason.\nRe-submitting credentials for an already-connected account updates it\nin place (this is also how these platforms reconnect).\nRequired fields by platform: telegram needs `bot_token` (from\n@BotFather; the bot must be an admin of the channel) and `channel`\n(@username or numeric chat id); discord needs `webhook_url`; bluesky\nneeds `handle` and `app_password` (an app password, never the main\naccount password); wordpress needs `site_url`, `username` and\n`app_password` (a WordPress Application Password from the WordPress user profile page,\nnever the login password; WordPress 5.6+). WordPress.com sites\nconnect in the PostEverywhere app (browser sign-in), not through\nthis endpoint.\nError codes: `missing_credentials` (a required field is empty),\n`invalid_platform` (not a credential platform),\n`credential_connect_failed` (the platform refused the credentials;\nthe message says why, e.g. a wrong Application Password or a site\nwith the REST API turned off).\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "platform"
                ],
                "properties": {
                  "platform": {
                    "type": "string",
                    "enum": [
                      "telegram",
                      "discord",
                      "bluesky",
                      "wordpress"
                    ]
                  },
                  "bot_token": {
                    "type": "string",
                    "description": "telegram only"
                  },
                  "channel": {
                    "type": "string",
                    "description": "telegram only: @username or chat id"
                  },
                  "webhook_url": {
                    "type": "string",
                    "description": "discord only"
                  },
                  "handle": {
                    "type": "string",
                    "description": "bluesky only, e.g. me.bsky.social"
                  },
                  "app_password": {
                    "type": "string",
                    "description": "bluesky or wordpress"
                  },
                  "site_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "wordpress only, e.g. https://example.com"
                  },
                  "username": {
                    "type": "string",
                    "description": "wordpress only: the WordPress login name"
                  }
                }
              },
              "examples": {
                "wordpress": {
                  "summary": "Self-hosted WordPress site",
                  "value": {
                    "platform": "wordpress",
                    "site_url": "https://example.com",
                    "username": "editor",
                    "app_password": "abcd efgh ijkl mnop qrst uvwx"
                  }
                },
                "bluesky": {
                  "summary": "Bluesky",
                  "value": {
                    "platform": "bluesky",
                    "handle": "me.bsky.social",
                    "app_password": "xxxx-xxxx-xxxx-xxxx"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Account connected",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "platform": {
                          "type": "string"
                        },
                        "connected": {
                          "type": "boolean"
                        },
                        "account": {
                          "type": "object",
                          "nullable": true
                        },
                        "instructions": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/accounts/{id}/reconnect": {
      "post": {
        "operationId": "createReconnectLink",
        "x-scope": "write",
        "tags": [
          "Accounts"
        ],
        "summary": "Mint an OAuth link to repair an existing broken account",
        "description": "Returns a short-lived (10 minute) authorization URL that repairs an\nEXISTING OAuth account whose token died (`needs_reconnection` or\n`token_expired` from the health endpoint). The owner must approve\nwhile logged in to the platform as that same profile; matching is by\nthe platform's account id, so authorizing as a different profile\ncreates a new account instead. Verify with\n`GET /accounts/ID/health` afterwards. Credential platforms\n(telegram, discord, bluesky, wordpress) reconnect by re-submitting credentials\nvia `POST /accounts/connect-credential`.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/AccountId"
          }
        ],
        "responses": {
          "200": {
            "description": "Reconnect link minted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "account_id": {
                          "type": "integer"
                        },
                        "platform": {
                          "type": "string"
                        },
                        "account_name": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string"
                        },
                        "expires_in_seconds": {
                          "type": "integer",
                          "example": 600
                        },
                        "instructions": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/posts": {
      "get": {
        "operationId": "listPosts",
        "x-scope": "read",
        "tags": [
          "Posts"
        ],
        "summary": "List posts with filters",
        "description": "Post status is derived live from per-destination statuses (the raw\n`posts.post_status` column is frozen at creation). Multi-value filters\n(`status`, `platform`) accept comma-separated lists. Invalid filter\nvalues are silently dropped, not rejected, except `approval`, which\nreturns `400 invalid_approval_filter` for an unknown value.\n",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "Comma-separated list of: draft, scheduled, publishing, published, partially_failed, failed",
            "schema": {
              "type": "string"
            },
            "example": "scheduled,publishing"
          },
          {
            "name": "platform",
            "in": "query",
            "description": "Comma-separated list of: instagram, facebook, x, twitter, linkedin, youtube, tiktok, threads, pinterest, bluesky, telegram, discord, wordpress, google_business",
            "schema": {
              "type": "string"
            },
            "example": "instagram,tiktok"
          },
          {
            "name": "account_id",
            "in": "query",
            "description": "Filter to posts targeting this social account (integer ID)",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "campaign_id",
            "in": "query",
            "description": "Filter to posts in this campaign (integer ID)",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "created_after",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "created_before",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "scheduled_after",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "scheduled_before",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "published_after",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "published_before",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "updated_after",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "Case-insensitive substring match on post content",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "created_at",
                "scheduled_for",
                "updated_at",
                "published_at"
              ],
              "default": "created_at"
            }
          },
          {
            "name": "order",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20,
              "maximum": 100,
              "minimum": 1
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0
            }
          },
          {
            "name": "approval",
            "in": "query",
            "required": false,
            "description": "Filter by approval workflow state. Separate axis from status; a pending post is also a draft, and an approved one may already be scheduled. An unknown value returns 400 invalid_approval_filter.",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "approved",
                "changes_requested"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated posts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "posts",
                        "pagination"
                      ],
                      "properties": {
                        "posts": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Post"
                          }
                        },
                        "pagination": {
                          "$ref": "#/components/schemas/Pagination"
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "post": {
        "operationId": "createPost",
        "x-scope": "write",
        "tags": [
          "Posts"
        ],
        "summary": "Create, schedule, or draft a post",
        "description": "Omit `scheduled_for` to publish immediately; provide it (ISO 8601,\nassumed UTC when no offset given) to schedule; or set `use_queue: true`\nto let the workspace's posting queue pick the time (see `GET /queue`).\nSet `draft: true` to save a native draft instead (no destinations are\ncreated and nothing publishes until `POST /posts/ID/schedule`).\n\nAttach media by id (see [media requirements per platform](/media-requirements)),\nand use `platform_content` for per-platform overrides; the\n[Platform Guides](/platforms/instagram) document every option.\n\nField-name handling: camelCase aliases (`accountIds`, `mediaIds`,\n`scheduledFor`, `platformContent`) and the deprecated `scheduled_at`\nalias are accepted. Fields whose names imply a different shape\n(`media`, `media_id`, `mediaId`, `attachments`) are rejected with\n`400 invalid_field_name`.\n\nContent rules: `content` may be omitted only when `platform_content`\nprovides at least one per-platform caption or media is attached.\nMax 10,000 characters. Max 50 `account_ids`. Instagram captions with\nmore than 30 hashtags are rejected\n(`instagram_hashtag_limit_exceeded`).\n\nWordPress blog posts use `platform_content.wordpress`\n(see `WordPressBlogPost`). Bad settings return\n`400 wordpress_post_invalid` with every problem in `details.errors`;\na WordPress target with no title returns\n`400 wordpress_title_required`. A long blog body goes in\n`platform_content.wordpress.content` (up to 200,000 characters), not\nin `content`.\n\nGoogle Business Profile posts use `platform_content.google_business`\n(see `GoogleBusinessPost`): text up to 1500 characters, at most 1\nphoto, no video. A post that breaks a rule returns\n`400 google_business_post_invalid` with every problem in\n`details.errors`.\n\nMedia referenced by `media_ids` must exist in the workspace and be\n`ready` (`media_not_found` / `media_not_ready` otherwise; media stuck\nin `uploading` is auto-finalized via the `/complete` flow when the\nfile was actually uploaded). Platform media requirements are\nvalidated pre-flight (`platform_requirement_violation`, e.g. video to\nPinterest).\n\nNot accepted: `schedule_at` (MCP only; the REST API returns\n`400 unsupported_schedule_at` instead of publishing now; call\n`GET /best-times` and send its time as `scheduled_for`), and\n`request_approval` without `draft: true`\n(`400 request_approval_needs_draft`). `timezone` is stored for\ndisplay only: `scheduled_for` without an offset is read as UTC.\n\nSettings: the snake_case spellings first_comment, alt_text, media_alt_text, reply_settings, privacy_level, disable_comment, disable_duet, disable_stitch, video_type, cover_photo_url, topic_tag, link_attachment, board_id, board_section_id, comment_status\nare accepted and stored as the camelCase keys the publishers read.\nFacebook `contentType` Reels posts a video as a Reel; Post or Video\nposts it as a regular video (a landscape video always posts as a\nregular video). First comments are not available on Instagram, Facebook, LinkedIn, Threads and YouTube yet. They work on X. A first comment sent for those\nplatforms is removed and the response `notes` say so. `notes` also\nwarns when a cover image from `cover_photo.media_id` is a 7-day link\nand the post goes out later than that.\n\nA circuit breaker refuses a request body that has already failed\n5+ times in 6 hours for the same key with\n`422 permanent_failure_circuit_breaker`. Change any field to reset.\n\nError codes: `invalid_json`, `wrong_content_type_for_endpoint`,\n`invalid_field_name`, `validation_error`, `content_too_long`,\n`account_ids_required`, `too_many_accounts`, `invalid_timezone`,\n`invalid_accounts`, `instagram_hashtag_limit_exceeded`,\n`invalid_datetime`, `past_schedule_time`, `media_not_found`,\n`media_not_ready`, `platform_requirement_violation`,\n`post_creation_failed`, `rate_limit_exceeded`,\n`permanent_failure_circuit_breaker`, `x_article_invalid`,\n`wordpress_post_invalid`, `wordpress_title_required`,\n`google_business_post_invalid`, `unsupported_schedule_at`,\n`request_approval_needs_draft`, `conflicting_schedule_mode`,\n`campaign_not_found`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePostRequest"
              },
              "examples": {
                "scheduled": {
                  "summary": "Schedule to two accounts",
                  "value": {
                    "content": "Big news dropping tomorrow 👀",
                    "account_ids": [
                      2280,
                      2291
                    ],
                    "scheduled_for": "2026-07-10T14:30:00Z",
                    "timezone": "America/New_York",
                    "media_ids": [
                      "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
                    ]
                  }
                },
                "publish_now": {
                  "summary": "Publish immediately",
                  "value": {
                    "content": "We're live!",
                    "account_ids": [
                      2280
                    ]
                  }
                },
                "draft": {
                  "summary": "Save a draft for review",
                  "value": {
                    "content": "Draft for the launch thread",
                    "draft": true,
                    "account_ids": [
                      2280
                    ]
                  }
                },
                "wordpress_blog_post": {
                  "summary": "WordPress blog post with a featured image",
                  "value": {
                    "content": "Our spring update is live on the blog.",
                    "account_ids": [
                      3104
                    ],
                    "media_ids": [
                      "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
                    ],
                    "platform_content": {
                      "wordpress": {
                        "content": "Intro paragraph.\n\n## What changed\n\n- Faster uploads\n- **New** calendar view\n\nRead the [full notes](https://example.com/notes).",
                        "settings": {
                          "title": "Our spring update",
                          "status": "publish",
                          "excerpt": "Faster uploads and a new calendar view.",
                          "tags": [
                            "product",
                            "news"
                          ],
                          "categories": [
                            "News"
                          ],
                          "featuredImage": "first"
                        }
                      }
                    }
                  }
                },
                "google_business_event": {
                  "summary": "Google Business Profile event post with a button",
                  "value": {
                    "content": "Join us for late-night shopping with live music.",
                    "account_ids": [
                      3120
                    ],
                    "media_ids": [
                      "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
                    ],
                    "platform_content": {
                      "google_business": {
                        "settings": {
                          "post_type": "event",
                          "event_title": "Late-night shopping",
                          "start_date": "2026-12-04T18:00",
                          "end_date": "2026-12-04T22:00",
                          "button": "learn_more",
                          "button_url": "https://example.com/late-night"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Post created. Regular creates return the full publishing topology\n(`destinations`); `draft: true` returns the smaller draft shape\nwith `next_steps`.\n",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/PostCreated"
                        },
                        {
                          "$ref": "#/components/schemas/DraftCreated"
                        }
                      ]
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "description": "Circuit breaker open for this exact request body",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/posts/{id}": {
      "get": {
        "operationId": "getPost",
        "x-scope": "read",
        "tags": [
          "Posts"
        ],
        "summary": "Get a post with destination statuses",
        "description": "For drafts, the chosen accounts and per-platform content are surfaced\nfrom the draft data and `scheduled_for` is `null` unless pre-set.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/PostId"
          }
        ],
        "responses": {
          "200": {
            "description": "Post",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Post"
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "patch": {
        "operationId": "updatePost",
        "x-scope": "write",
        "tags": [
          "Posts"
        ],
        "summary": "Update a scheduled or draft post",
        "description": "Only posts whose derived status is `scheduled` or `draft` can be\nedited (`400 invalid_post_status` otherwise). At least one field is\nrequired. On a scheduled post, changing `account_ids` rebuilds all\ndestinations. On a draft it only changes the draft's saved accounts:\nnothing is queued until `schedulePost`. Changing only\n`scheduled_for` shifts every queued destination by the same delta.\nSame alias and wrong-field-name rules as `createPost`.\n`platform_content` (same shape as `createPost`) is merged per\nplatform: the settings you send are added to the saved settings (a\nkey you send replaces that key, keys you leave out are kept), and\nthe platform caption, title, link and tags change only when you send\nnew ones. Snake_case setting aliases and the first comment rule work\nas in `createPost`; the response `notes` list anything removed.\nError codes: `validation_error`, `invalid_post_status`,\n`content_too_long`, `too_many_accounts`, `invalid_timezone`,\n`invalid_datetime`, `past_schedule_time`, `invalid_accounts`,\n`invalid_field_name`, `invalid_id`, `not_found`,\n`wordpress_post_invalid`, `google_business_post_invalid`.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/PostId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "minProperties": 1,
                "properties": {
                  "content": {
                    "type": "string",
                    "maxLength": 10000
                  },
                  "scheduled_for": {
                    "type": "string",
                    "format": "date-time",
                    "description": "New fire time (ISO 8601, assumed UTC without offset, must be future)"
                  },
                  "timezone": {
                    "type": "string",
                    "description": "IANA timezone (display only). It does not change when the post goes out."
                  },
                  "account_ids": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "integer"
                    },
                    "description": "On a draft, only the saved targets change."
                  },
                  "media_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    }
                  },
                  "platform_content": {
                    "$ref": "#/components/schemas/PlatformContent"
                  }
                }
              },
              "example": {
                "scheduled_for": "2026-07-11T09:00:00Z"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated post",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/UpdatedPost"
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "delete": {
        "operationId": "deletePost",
        "x-scope": "write",
        "tags": [
          "Posts"
        ],
        "summary": "Delete a post and all its destinations",
        "description": "Permanent. Fires the `post.deleted` webhook event. A post that has already published stays live on the social platforms unless you pass `delete_on_platforms=x`, which also deletes its published X copy (the result is reported in `x_deletion`).",
        "parameters": [
          {
            "$ref": "#/components/parameters/PostId"
          },
          {
            "name": "delete_on_platforms",
            "in": "query",
            "required": false,
            "description": "Comma-separated platforms whose PUBLISHED copies should also be deleted. Currently only `x` is supported. Omit to keep live posts live.",
            "schema": {
              "type": "string",
              "example": "x"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "deleted",
                        "id"
                      ],
                      "properties": {
                        "deleted": {
                          "type": "boolean",
                          "const": true
                        },
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "message": {
                          "type": "string"
                        },
                        "x_deletion": {
                          "type": "array",
                          "description": "Present when delete_on_platforms=x. One entry per published X copy.",
                          "items": {
                            "type": "object",
                            "properties": {
                              "xPostId": {
                                "type": "string"
                              },
                              "accountName": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "deleted": {
                                "type": "boolean"
                              },
                              "error": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/posts/{id}/results": {
      "get": {
        "operationId": "getPostResults",
        "x-scope": "read",
        "tags": [
          "Posts"
        ],
        "summary": "Get per-platform publish results for a post",
        "description": "Poll this after an immediate publish. Each destination's status moves\nfrom `queued` → `publishing` → `published` or `failed`;\n`platform_post_url` is set after a successful publish.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/PostId"
          }
        ],
        "responses": {
          "200": {
            "description": "Publish results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "post_id",
                        "post_status",
                        "results"
                      ],
                      "properties": {
                        "post_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "post_status": {
                          "$ref": "#/components/schemas/PostStatus"
                        },
                        "results": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/PostResult"
                          }
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/posts/{id}/retry": {
      "post": {
        "operationId": "retryPost",
        "x-scope": "write",
        "tags": [
          "Posts"
        ],
        "summary": "Retry all failed destinations of one post",
        "description": "Resets every `failed` destination of the post to `queued` with a fresh\nattempt budget and `scheduled_for = now` (publishes on the next\nscheduler cycle). Returns `400 no_failed_destinations` when nothing is\nin a failed state. Counts against the immediate-publish posting\nbudget.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/PostId"
          }
        ],
        "responses": {
          "200": {
            "description": "Destinations queued for retry",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "retried_count",
                        "destinations"
                      ],
                      "properties": {
                        "retried_count": {
                          "type": "integer"
                        },
                        "destinations": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "platform": {
                                "type": "string"
                              },
                              "new_status": {
                                "type": "string",
                                "const": "queued"
                              }
                            }
                          }
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/posts/{id}/schedule": {
      "post": {
        "operationId": "schedulePost",
        "x-scope": "write",
        "tags": [
          "Posts"
        ],
        "summary": "Schedule (publish) a draft",
        "description": "Turns a draft into a live scheduled/publishing post: flips the post to\n`scheduled`, clears draft data, and creates one queued destination per\naccount. Provide either `scheduled_for` (at least 1 minute in the\nfuture) or `publish_now: true` (queued to fire within ~1 scheduler\ncycle). `account_ids` overrides the draft's saved targets; required if\nthe draft has none. Non-drafts return `409 not_a_draft`; use\n`PATCH /posts/ID` to move an already-scheduled post.\nPlan post limits are enforced here\n(`429 post_limit_reached` / `daily_limit_reached`). A draft that\ntargets a WordPress account without a blog title returns\n`400 wordpress_title_required`. A draft that targets a Google\nBusiness Profile account and breaks its rules returns\n`400 google_business_post_invalid`. A destination row that is still\nwaiting for the same account is moved to the new time (it is not\ncounted twice). Fires the `post.scheduled` webhook event.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/PostId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "scheduled_for": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Required unless publish_now is true"
                  },
                  "publish_now": {
                    "type": "boolean"
                  },
                  "account_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  },
                  "timezone": {
                    "type": "string"
                  }
                }
              },
              "examples": {
                "schedule": {
                  "value": {
                    "scheduled_for": "2026-07-12T14:00:00Z"
                  }
                },
                "now": {
                  "value": {
                    "publish_now": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Draft scheduled",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "post_id",
                        "status",
                        "scheduled_for",
                        "destinations"
                      ],
                      "properties": {
                        "post_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "deprecated": true
                        },
                        "status": {
                          "type": "string",
                          "const": "scheduled"
                        },
                        "post_status": {
                          "type": "string",
                          "const": "scheduled"
                        },
                        "publish_now": {
                          "type": "boolean"
                        },
                        "scheduled_for": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "timezone": {
                          "type": "string"
                        },
                        "destinations": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "account_id": {
                                "type": "integer"
                              },
                              "account_name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "platform": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string",
                                "description": "queued, or failed if the destination row could not be created"
                              },
                              "error": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "destinations_count": {
                          "type": "integer"
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Post is not a draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/posts/{id}/approve": {
      "post": {
        "operationId": "approvePost",
        "x-scope": "write",
        "tags": [
          "Posts"
        ],
        "summary": "Approve a pending post",
        "description": "Clears a post that is awaiting approval. An API key is an organization\ncredential (only owners and admins can create one), so a key approving\nis an admin approving by proxy; a key made by a member gets\n`403 insufficient_role`. Approving does not publish: the draft is\ncleared, and scheduling it (`POST /posts/ID/schedule`) is what sends\nit out. One approval authorizes exactly one publish. The author is\nnotified by email. Fires the `post.approved` webhook event.\nErrors: `not_found` (404), `not_pending` (400, the post is not\nawaiting approval).\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/PostId"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 2000,
                    "description": "Optional message to the author"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Approved",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "post_id",
                        "approval_status"
                      ],
                      "properties": {
                        "post_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "approval_status": {
                          "type": "string",
                          "const": "approved"
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/posts/{id}/request-changes": {
      "post": {
        "operationId": "requestPostChanges",
        "x-scope": "write",
        "tags": [
          "Posts"
        ],
        "summary": "Send a pending post back with a note",
        "description": "Returns a post awaiting approval to its author with a required note\nsaying what to change. The post stays a draft; the author is notified\nby email. Same owner/admin rule as `approvePost`\n(`403 insufficient_role`). Fires the `post.changes_requested` webhook\nevent. Errors: `note_required` (400), `not_pending` (400, the post is\nnot awaiting approval), `not_found` (404).\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/PostId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "note"
                ],
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 2000,
                    "description": "What needs changing. Required; the author sees this."
                  }
                }
              },
              "example": {
                "note": "Please shorten the first line and add the launch link."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sent back to the author",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "post_id",
                        "approval_status"
                      ],
                      "properties": {
                        "post_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "approval_status": {
                          "type": "string",
                          "const": "changes_requested"
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/posts/bulk": {
      "post": {
        "operationId": "bulkCreatePosts",
        "x-scope": "write",
        "tags": [
          "Posts"
        ],
        "summary": "Create up to 50 posts in one call",
        "description": "Each item is dispatched through the same validation as `createPost`\n(sequentially, so posting rate limits stay deterministic). Each item\nis forwarded with your key, so each one counts against the API rate\nlimit and the posting budgets like a single `createPost` call.\nPartial success is normal: iterate `results`. An item with\n`schedule_at` fails with `unsupported_schedule_at` (resolve the time\nfirst and send `scheduled_for`).\nHTTP status: 201 all succeeded, 207 mixed, 422 all failed.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "posts"
                ],
                "properties": {
                  "posts": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 50,
                    "items": {
                      "$ref": "#/components/schemas/CreatePostRequest"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "All posts created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkResultEnvelope"
                }
              }
            }
          },
          "207": {
            "description": "Partial success, some items failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkResultEnvelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "description": "Every item failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkResultEnvelope"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/posts/retry-failed": {
      "post": {
        "operationId": "retryFailedPosts",
        "x-scope": "write",
        "tags": [
          "Posts"
        ],
        "summary": "Bulk-retry failed destinations by filter",
        "description": "Retries every failed destination matching the filter (at least one\nfilter is required; the API refuses to retry the entire failure\nhistory, `400 no_filter`). Matched destinations are reset to `queued`\nwith attempts zeroed and `scheduled_for = now`. `post_ids` is capped\nat 200 (`bulk_limit_exceeded`). `failed_after` / `failed_before`\ncompare against the destination's last update time. Counts against\nthe immediate-publish posting budget.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "At least one of post_ids, account_id, platform, failed_after, failed_before is required",
                "properties": {
                  "post_ids": {
                    "type": "array",
                    "maxItems": 200,
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    }
                  },
                  "account_id": {
                    "type": "integer"
                  },
                  "platform": {
                    "type": "string",
                    "enum": [
                      "instagram",
                      "facebook",
                      "x",
                      "twitter",
                      "linkedin",
                      "youtube",
                      "tiktok",
                      "threads",
                      "pinterest",
                      "bluesky",
                      "telegram",
                      "discord",
                      "wordpress",
                      "google_business"
                    ]
                  },
                  "failed_after": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "failed_before": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "max_attempts": {
                    "type": "integer",
                    "description": "Skip destinations that already have this many attempts or more"
                  }
                }
              },
              "example": {
                "platform": "tiktok",
                "failed_after": "2026-07-07T00:00:00Z"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Destinations queued for retry",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "retried_count",
                        "destinations"
                      ],
                      "properties": {
                        "retried_count": {
                          "type": "integer"
                        },
                        "destinations": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "destination_id": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "post_id": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "platform": {
                                "type": "string"
                              },
                              "new_status": {
                                "type": "string",
                                "const": "queued"
                              }
                            }
                          }
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/queue": {
      "get": {
        "operationId": "getQueue",
        "x-scope": "read",
        "tags": [
          "Posts"
        ],
        "summary": "Get the posting queue",
        "description": "The workspace's recurring posting openings, plus a preview of where\nthe next posts added to the queue will land (wall-clock times in the\nqueue's timezone, chronological). The preview is a forecast;\nallocation happens at create time via `POST /posts` with\n`use_queue: true`. When no queue is set up yet, `queue` is `null`,\n`upcoming` is empty and `message` says so. Queue management (editing\nopenings) is app-only by design. Scoped to the key's workspace.\n",
        "parameters": [
          {
            "name": "preview",
            "in": "query",
            "required": false,
            "description": "How many upcoming openings to preview",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 30,
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The queue and its upcoming openings, or queue null when none is set up",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "queue",
                        "upcoming"
                      ],
                      "properties": {
                        "queue": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "timezone": {
                              "type": "string",
                              "description": "IANA timezone the slots are in"
                            },
                            "slots": {
                              "type": "array",
                              "description": "The recurring openings",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "day_of_week": {
                                    "type": "integer",
                                    "description": "0 = Sunday ... 6 = Saturday"
                                  },
                                  "time": {
                                    "type": "string",
                                    "example": "09:00"
                                  }
                                }
                              }
                            }
                          }
                        },
                        "upcoming": {
                          "type": "array",
                          "description": "Where the next posts added to the queue will land, in the queue's timezone",
                          "items": {
                            "type": "object",
                            "properties": {
                              "date": {
                                "type": "string",
                                "example": "2026-08-31"
                              },
                              "time": {
                                "type": "string",
                                "example": "09:00"
                              }
                            }
                          }
                        },
                        "exhausted": {
                          "type": "boolean",
                          "description": "True when the horizon ran out before filling the preview. Absent when there is no queue."
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                },
                "examples": {
                  "queue": {
                    "value": {
                      "data": {
                        "queue": {
                          "id": "6f1c2a3b-0d4e-4f5a-9b8c-7d6e5f4a3b2c",
                          "name": "Main queue",
                          "timezone": "Europe/London",
                          "slots": [
                            {
                              "day_of_week": 1,
                              "time": "09:00"
                            },
                            {
                              "day_of_week": 3,
                              "time": "17:30"
                            }
                          ]
                        },
                        "upcoming": [
                          {
                            "date": "2026-10-26",
                            "time": "09:00"
                          },
                          {
                            "date": "2026-10-28",
                            "time": "17:30"
                          }
                        ],
                        "exhausted": false,
                        "message": "To take the next opening, POST /v1/posts with use_queue: true. The preview is a forecast; allocation happens at create time."
                      },
                      "error": null,
                      "meta": {
                        "request_id": "7b8c9d0e",
                        "timestamp": "2026-10-23T09:00:00.000Z"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/media": {
      "get": {
        "operationId": "listMedia",
        "x-scope": "read",
        "tags": [
          "Media"
        ],
        "summary": "List media library items",
        "description": "Newest first. `pagination` echoes `limit`/`offset` only (no total).\nThe convenience `media_ids` array can be copied straight into\n`createPost`. Viewable URLs are not included in the list response;\nuse `getMedia` for a per-item `url`.\n",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "image",
                "video",
                "document"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Media items",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "media",
                        "media_ids",
                        "pagination"
                      ],
                      "properties": {
                        "media": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/MediaItem"
                          }
                        },
                        "media_ids": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "format": "uuid"
                          }
                        },
                        "pagination": {
                          "type": "object",
                          "properties": {
                            "limit": {
                              "type": "integer"
                            },
                            "offset": {
                              "type": "integer"
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/media/upload": {
      "post": {
        "operationId": "initMediaUpload",
        "x-scope": "write",
        "tags": [
          "Media"
        ],
        "summary": "Upload media (direct or presigned)",
        "description": "TWO modes, selected by the request Content-Type.\n\n**DIRECT mode (images only, recommended for API clients).** Send\n`multipart/form-data` with the file in a field named `file` (optional\n`filename` field to override the name). The upload completes in this\nsingle request and the response returns `media_status: \"ready\"` with\n`upload_required: false`, no `upload_url`, no `/complete` call.\nMax 25 MB. Videos sent this way get `415` with instructions.\n\n**PRESIGNED mode (all types).** Send file METADATA as JSON. Returns an\n`upload_url` plus `upload_method` describing how to send the bytes:\n  - images → POST `multipart/form-data`, field name `file`\n    (Cloudflare Images direct upload)\n  - videos (MP4 only) and PDFs → PUT with the declared `Content-Type`\n    (R2 presigned URL)\n\nThen you MUST call `POST /media/ID/complete`, or the media stays\n`uploading` forever otherwise. `expires_at` is authoritative (image\nURLs last 6 hours, video/PDF URLs 1 hour). Size caps: 20 MB\nimages/PDFs, 4 GB video. Upload quota is only consumed at\n`/complete`, so retries here are free.\n\n**Presigned image caveat**: the image upload host runs an edge bot\nfilter outside our control. Send any custom `User-Agent` header;\nPython stdlib's default (`Python-urllib/x`) is rejected with HTTP 403\nerror 1010. `python-requests`, `curl`, node, Go and empty User-Agents\nall pass. DIRECT mode has no such restriction from any client.\n\nError codes: `validation_error`, `unsupported_media_type`,\n`file_too_large` (413), `length_required` (411, direct mode),\n`storage_quota_exceeded` (403), `rate_limit_exceeded`,\n`service_unavailable`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "filename",
                  "content_type",
                  "size"
                ],
                "properties": {
                  "filename": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "content_type": {
                    "type": "string",
                    "enum": [
                      "image/jpeg",
                      "image/png",
                      "image/gif",
                      "image/webp",
                      "image/heic",
                      "image/heif",
                      "video/mp4",
                      "application/pdf"
                    ]
                  },
                  "size": {
                    "type": "integer",
                    "description": "File size in bytes. `file_size` is accepted as a deprecated alias (used by SDK releases up to 1.6.0); send `size`."
                  },
                  "file_size": {
                    "type": "integer",
                    "deprecated": true,
                    "description": "Deprecated alias of size (bytes). Ignored when size is present."
                  },
                  "width": {
                    "type": "integer"
                  },
                  "height": {
                    "type": "integer"
                  },
                  "duration": {
                    "type": "number",
                    "description": "Video duration in seconds"
                  }
                }
              },
              "example": {
                "filename": "photo.jpg",
                "content_type": "image/jpeg",
                "size": 245361
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "The image itself (JPEG/PNG/GIF/WebP/HEIC, max 25 MB). Direct mode is image-only."
                  },
                  "filename": {
                    "type": "string",
                    "maxLength": 255,
                    "description": "Optional display-name override."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Presigned mode: an upload ticket (`upload_url` + `upload_method`, then call `/complete`).\nDirect mode: the finished media, `media_status: \"ready\"`, `upload_required: false`, `url` set; attach `media_ids` to a post immediately.\n",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/MediaUploadTicket"
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/media/upload-from-url": {
      "post": {
        "operationId": "uploadMediaFromUrl",
        "x-scope": "write",
        "tags": [
          "Media"
        ],
        "summary": "One-shot import of a public image or MP4 video URL",
        "description": "Fetches the URL server-side and stores it: no presign/PUT/complete\ndance.\n\n**Images** (JPEG/PNG/GIF/WebP/HEIC/HEIF, max 25 MB) import\nsynchronously: the response `media_id` is ready immediately.\n\n**Videos** (MP4 only, max 4 GB) import ASYNCHRONOUSLY: the response\nreturns instantly with `media_status: \"uploading\"` while the file\nstreams in server-side. Poll `GET /media/ID` until `media_status`\nis `ready` (typically seconds), then attach via `media_ids`. If it\nbecomes `failed`, the poll response's `error_message` states exactly\nwhy (too large, not actually an MP4, storage quota, source URL died).\nOversize videos with a Content-Length return `413` up front; storage\nquota returns `403 storage_quota_exceeded`.\n\n30 s fetch timeout to first byte, SSRF-guarded including redirects\n(no localhost/private addresses, `400 invalid_url`). Unreachable or\nslow URLs return `502`/`504` `fetch_failed`. Consumes the media\nupload quota.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Publicly fetchable http(s) image or MP4 video URL"
                  },
                  "filename": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "url": "https://example.com/images/launch-hero.png"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Imported. Images return media_status \"ready\"; videos return \"uploading\"; poll `GET /media/ID` until ready before attaching.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "media_id",
                        "media_status",
                        "type"
                      ],
                      "properties": {
                        "media_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "media_ids": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "format": "uuid"
                          }
                        },
                        "media_status": {
                          "type": "string",
                          "enum": [
                            "ready",
                            "uploading"
                          ]
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "image",
                            "video"
                          ]
                        },
                        "url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "filename": {
                          "type": "string"
                        },
                        "size": {
                          "type": "integer"
                        },
                        "content_type": {
                          "type": "string"
                        },
                        "source_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "next_step": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "413": {
            "description": "File too large (images over 25 MB, videos over 4 GB)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "The image could not be processed by the image service (unsupported_media_type); retrying the same image fails the same way",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "description": "Source URL unreachable or upstream image service unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "504": {
            "description": "Source URL timed out (over 30 s)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/media/{id}": {
      "get": {
        "operationId": "getMedia",
        "x-scope": "read",
        "tags": [
          "Media"
        ],
        "summary": "Get media status and details",
        "description": "`media_status` stays `uploading` until you call `/complete`; polling\nthis endpoint alone will never flip it to `ready`. `action_required`\ntells clients the next step when not ready. `url` is a permanent\nviewable URL, populated once ready.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/MediaId"
          }
        ],
        "responses": {
          "200": {
            "description": "Media details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/MediaDetail"
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "delete": {
        "operationId": "deleteMedia",
        "x-scope": "write",
        "tags": [
          "Media"
        ],
        "summary": "Delete a media file",
        "description": "If the media is attached to posts that have not gone out yet, the\ndelete is refused with `409 media_in_use` and nothing is deleted. With\n`?force=true` the file is deleted and those pending destinations are\ncancelled (marked failed with a cancellation note), so they never\npublish; `cancelled_post_count` reports how many. The MCP tool\n`delete_media` has a `force` option for this. Deletion is permanent and\nfrees storage. Fires the `media.deleted` webhook event.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/MediaId"
          },
          {
            "name": "force",
            "in": "query",
            "description": "Set to true to confirm deletion when the media is attached to scheduled posts",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "deleted",
                        "id"
                      ],
                      "properties": {
                        "deleted": {
                          "type": "boolean",
                          "const": true
                        },
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "cancelled_post_count": {
                          "type": "integer"
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Media attached to scheduled posts; retry with force=true",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/media/{id}/complete": {
      "post": {
        "operationId": "completeMediaUpload",
        "x-scope": "write",
        "tags": [
          "Media"
        ],
        "summary": "Finalize a media upload (step 3 of 3)",
        "description": "Call after uploading the file to the presigned `upload_url`. Verifies\nthe file actually exists (`400 file_not_uploaded` when it does not)\nand that its magic bytes match the declared content type\n(`400 file_type_mismatch`; the media is then marked failed). Videos\nget a thumbnail generated in the background. Idempotent: calling on\nalready-ready media returns 200. `400 upload_failed` when the media\nwas previously marked failed. No request body is required.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/MediaId"
          }
        ],
        "responses": {
          "200": {
            "description": "Media finalized (or already ready)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/MediaCompleted"
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/ai/generate-caption": {
      "post": {
        "operationId": "generateCaption",
        "x-scope": "ai",
        "tags": [
          "AI"
        ],
        "summary": "Generate social media captions with AI",
        "description": "Generates 1-5 captions for a topic, styled per platform/tone/length.\nCosts 1 AI credit per caption returned; credits are reserved\natomically before generation and refunded for captions that fail.\n`402 insufficient_credits` when the plan's monthly credit budget\n(plus bonus credits) cannot cover the request;\n`502 ai_no_content` when the model returns nothing.\nUnknown platform/tone/length values silently fall back to defaults.\nEvery caption fits the platform's character limit, counted the way\nthe platform counts (X weighted length, Bluesky graphemes): X 280,\nBluesky 300, Threads 500, Pinterest 500, Google Business Profile\n1500, Instagram and TikTok 2200, LinkedIn 3000, Facebook 5000,\nYouTube 5000 (the description). A caption the model writes too long\nis cut at a word break; `char_limit` gives the limit used and\n`trimmed_to_fit` how many captions were cut.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "topic"
                ],
                "properties": {
                  "topic": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "brand_id": {
                    "type": "string",
                    "description": "Which brand to write in: omitted or \"default\" = the workspace's Brand Kit (if any), \"none\" = no brand, or a brand id from GET /v1/brand. Unknown id = 404.\n"
                  },
                  "platform": {
                    "type": "string",
                    "enum": [
                      "instagram",
                      "facebook",
                      "x",
                      "twitter",
                      "linkedin",
                      "youtube",
                      "tiktok",
                      "threads",
                      "pinterest",
                      "bluesky",
                      "wordpress",
                      "google_business"
                    ],
                    "description": "Sets character limit and style. Omit for generic."
                  },
                  "tone": {
                    "type": "string",
                    "enum": [
                      "professional",
                      "casual",
                      "witty",
                      "enthusiastic",
                      "urgent",
                      "inspirational"
                    ],
                    "default": "professional"
                  },
                  "length": {
                    "type": "string",
                    "enum": [
                      "short",
                      "medium",
                      "long"
                    ],
                    "default": "medium"
                  },
                  "include_hashtags": {
                    "type": "boolean",
                    "default": true
                  },
                  "include_emojis": {
                    "type": "boolean",
                    "default": true
                  },
                  "count": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 5,
                    "default": 1
                  }
                }
              },
              "example": {
                "topic": "Announcing our summer sale, 30% off all plans",
                "platform": "instagram",
                "tone": "enthusiastic",
                "count": 2
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Captions generated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "captions",
                        "credits_used",
                        "credits_remaining"
                      ],
                      "properties": {
                        "captions": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "platform": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "tone": {
                          "type": "string"
                        },
                        "length": {
                          "type": "string"
                        },
                        "count_requested": {
                          "type": "integer"
                        },
                        "count_returned": {
                          "type": "integer"
                        },
                        "credits_used": {
                          "type": "integer"
                        },
                        "credits_remaining": {
                          "type": "integer"
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "description": "AI model returned no content (credits refunded)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/ai/generate-image": {
      "post": {
        "operationId": "generateImage",
        "x-scope": "ai",
        "tags": [
          "AI"
        ],
        "summary": "Generate an image with AI and store it in the media library",
        "description": "Generates one image via FAL AI, stores it in the media library and\nreturns a ready `media_id` for `createPost`. Credit cost depends on\nthe model; credits are reserved atomically and refunded on failure.\nFree-trial organizations without a paid subscription get\n`402 upgrade_required`. Prompts are safety-filtered\n(`400 prompt_rejected`). Additional AI burst limits apply on top of\nthe API-key limit. Error codes: `validation_error`, `prompt_rejected`,\n`upgrade_required`, `insufficient_credits`, `rate_limit_exceeded`,\n`generation_failed`, `internal_error`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "prompt"
                ],
                "properties": {
                  "add_logo": {
                    "type": "boolean",
                    "default": false,
                    "description": "Stamp the Brand Kit's real logo onto the finished image (exact, not redrawn by the model). Uses brand_id, else the workspace's default Brand Kit. Ignored when the Brand Kit has no logo; the response's logo_added says whether it was added.\n"
                  },
                  "logo_corner": {
                    "type": "string",
                    "enum": [
                      "bottom-right",
                      "bottom-left",
                      "top-right",
                      "top-left"
                    ],
                    "default": "bottom-right"
                  },
                  "prompt": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "aspect_ratio": {
                    "type": "string",
                    "enum": [
                      "1:1",
                      "16:9",
                      "9:16",
                      "4:3",
                      "3:4",
                      "4:5",
                      "5:4"
                    ],
                    "default": "1:1"
                  },
                  "model": {
                    "type": "string",
                    "enum": [
                      "nano-banana-pro",
                      "ideogram-v2",
                      "gemini-3-pro",
                      "flux-schnell"
                    ],
                    "default": "gemini-3-pro"
                  },
                  "brand_id": {
                    "type": "string",
                    "description": "Optional brand to apply (prefixes brand context to the prompt)"
                  }
                }
              },
              "example": {
                "prompt": "Flat-lay photo of a summer picnic with lemonade, bright pastel palette",
                "aspect_ratio": "4:5"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Image generated and stored",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/GeneratedImage"
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/analytics/summary": {
      "get": {
        "operationId": "getAnalyticsSummary",
        "x-scope": "read",
        "tags": [
          "Analytics"
        ],
        "summary": "Aggregate post counters and engagement metrics for a time window",
        "description": "Counts posts with activity in the window: published (by publish time), failed (by failure time), scheduled or publishing (by due time), and drafts (by creation time), the same window GET /v1/posts uses with published_after. Breaks down destinations per platform, and sums engagement of destinations published in the window. A metric with no reading on any of those destinations is null, never 0; metrics_coverage says how many were measured and which platforms were not. Audience covers every account in the organization. Periods are UTC-anchored rolling windows. Errors: `invalid_period`, `invalid_range` (custom period missing/invalid from/to).",
        "parameters": [
          {
            "name": "period",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "today",
                "week",
                "month",
                "all",
                "custom"
              ],
              "default": "month"
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "Required when period=custom",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Required when period=custom",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Summary",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AnalyticsSummary"
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/best-times": {
      "get": {
        "operationId": "getBestTimes",
        "x-scope": "read",
        "tags": [
          "Analytics"
        ],
        "summary": "Best times to post",
        "description": "When to post, for one or more accounts or for a platform. For an account with 30+ posts with stats in the last 90 days, times come from its own posts (each post compared with the account's typical post), filled out with platform-wide data. With fewer, they come from PostEverywhere users on that platform, in each poster's local time. Where neither has enough data (for example X, Telegram, Discord) the result is general guidance and says so. Several account_ids give one combined pick in `combined`. `next_best` is the soonest of the top three slots: use its `next.iso` as `scheduled_for` to post at the best time. Errors: `missing_parameter`, `invalid_id`, `invalid_platform`, `invalid_timezone`, `not_found` (account outside your organization or key scope).",
        "parameters": [
          {
            "name": "account_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "One account id, or several comma separated (up to 20). Alias: account_ids",
            "example": "123"
          },
          {
            "name": "platform",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "instagram",
                "facebook",
                "linkedin",
                "x",
                "threads",
                "bluesky",
                "tiktok",
                "youtube",
                "pinterest",
                "telegram",
                "discord",
                "wordpress"
              ]
            },
            "description": "Platform-wide times, when no account is given"
          },
          {
            "name": "timezone",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "IANA timezone for the slots. Default: the key owner's profile timezone",
            "example": "America/New_York"
          },
          {
            "name": "count",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10,
              "default": 5
            },
            "description": "Slots per result"
          }
        ],
        "responses": {
          "200": {
            "description": "Best times",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "timezone": {
                          "type": "string"
                        },
                        "best_times": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "account_id": {
                                "type": "integer",
                                "nullable": true
                              },
                              "account_name": {
                                "type": "string",
                                "nullable": true
                              },
                              "platform": {
                                "type": "string",
                                "description": "Platform, or `mixed` for a combined result across platforms"
                              },
                              "basis": {
                                "type": "string",
                                "enum": [
                                  "personal",
                                  "platform",
                                  "general"
                                ]
                              },
                              "confidence": {
                                "type": "string",
                                "enum": [
                                  "high",
                                  "medium",
                                  "low"
                                ],
                                "nullable": true
                              },
                              "sample_size": {
                                "type": "integer",
                                "description": "Posts the result is based on (exact for an account; rounded down to the nearest 500 for platform-wide data)"
                              },
                              "metric": {
                                "type": "string",
                                "enum": [
                                  "engagement",
                                  "views",
                                  "impressions"
                                ],
                                "nullable": true,
                                "description": "What the account's posts were ranked by"
                              },
                              "personal_progress": {
                                "type": "object",
                                "nullable": true,
                                "description": "When the account has too few posts with stats for its own times",
                                "properties": {
                                  "have": {
                                    "type": "integer"
                                  },
                                  "needed": {
                                    "type": "integer",
                                    "example": 30
                                  }
                                }
                              },
                              "timezone": {
                                "type": "string"
                              },
                              "slots": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "day_of_week": {
                                      "type": "integer",
                                      "description": "0 = Sunday ... 6 = Saturday"
                                    },
                                    "iso_weekday": {
                                      "type": "integer",
                                      "description": "ISO 8601 weekday: 1 = Monday ... 7 = Sunday"
                                    },
                                    "hour": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 23
                                    },
                                    "time": {
                                      "type": "string",
                                      "example": "09:00",
                                      "description": "Local time in `timezone`"
                                    },
                                    "label": {
                                      "type": "string",
                                      "example": "Tue 9:00 AM"
                                    },
                                    "basis": {
                                      "type": "string",
                                      "enum": [
                                        "personal",
                                        "platform",
                                        "general"
                                      ],
                                      "description": "What backs this slot: the account's own posts, PostEverywhere users on the platform, or general guidance (not measured)"
                                    },
                                    "score": {
                                      "type": "number",
                                      "nullable": true,
                                      "example": 1.25,
                                      "description": "Performance against a typical post (1.25 = about 25% better). null for general guidance"
                                    },
                                    "next": {
                                      "type": "object",
                                      "description": "The next time this slot comes round, at least 30 minutes from now",
                                      "properties": {
                                        "date": {
                                          "type": "string",
                                          "example": "2026-10-06"
                                        },
                                        "time": {
                                          "type": "string",
                                          "example": "09:00"
                                        },
                                        "iso": {
                                          "type": "string",
                                          "format": "date-time",
                                          "example": "2026-10-06T13:00:00.000Z"
                                        }
                                      }
                                    }
                                  }
                                }
                              },
                              "note": {
                                "type": "string",
                                "description": "Plain-English sentence saying what this is based on"
                              }
                            }
                          },
                          "description": "One result per account (or one for the platform)"
                        },
                        "combined": {
                          "type": "object",
                          "properties": {
                            "account_id": {
                              "type": "integer",
                              "nullable": true
                            },
                            "account_name": {
                              "type": "string",
                              "nullable": true
                            },
                            "platform": {
                              "type": "string",
                              "description": "Platform, or `mixed` for a combined result across platforms"
                            },
                            "basis": {
                              "type": "string",
                              "enum": [
                                "personal",
                                "platform",
                                "general"
                              ]
                            },
                            "confidence": {
                              "type": "string",
                              "enum": [
                                "high",
                                "medium",
                                "low"
                              ],
                              "nullable": true
                            },
                            "sample_size": {
                              "type": "integer",
                              "description": "Posts the result is based on (exact for an account; rounded down to the nearest 500 for platform-wide data)"
                            },
                            "metric": {
                              "type": "string",
                              "enum": [
                                "engagement",
                                "views",
                                "impressions"
                              ],
                              "nullable": true,
                              "description": "What the account's posts were ranked by"
                            },
                            "personal_progress": {
                              "type": "object",
                              "nullable": true,
                              "description": "When the account has too few posts with stats for its own times",
                              "properties": {
                                "have": {
                                  "type": "integer"
                                },
                                "needed": {
                                  "type": "integer",
                                  "example": 30
                                }
                              }
                            },
                            "timezone": {
                              "type": "string"
                            },
                            "slots": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "day_of_week": {
                                    "type": "integer",
                                    "description": "0 = Sunday ... 6 = Saturday"
                                  },
                                  "iso_weekday": {
                                    "type": "integer",
                                    "description": "ISO 8601 weekday: 1 = Monday ... 7 = Sunday"
                                  },
                                  "hour": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 23
                                  },
                                  "time": {
                                    "type": "string",
                                    "example": "09:00",
                                    "description": "Local time in `timezone`"
                                  },
                                  "label": {
                                    "type": "string",
                                    "example": "Tue 9:00 AM"
                                  },
                                  "basis": {
                                    "type": "string",
                                    "enum": [
                                      "personal",
                                      "platform",
                                      "general"
                                    ],
                                    "description": "What backs this slot: the account's own posts, PostEverywhere users on the platform, or general guidance (not measured)"
                                  },
                                  "score": {
                                    "type": "number",
                                    "nullable": true,
                                    "example": 1.25,
                                    "description": "Performance against a typical post (1.25 = about 25% better). null for general guidance"
                                  },
                                  "next": {
                                    "type": "object",
                                    "description": "The next time this slot comes round, at least 30 minutes from now",
                                    "properties": {
                                      "date": {
                                        "type": "string",
                                        "example": "2026-10-06"
                                      },
                                      "time": {
                                        "type": "string",
                                        "example": "09:00"
                                      },
                                      "iso": {
                                        "type": "string",
                                        "format": "date-time",
                                        "example": "2026-10-06T13:00:00.000Z"
                                      }
                                    }
                                  }
                                }
                              }
                            },
                            "note": {
                              "type": "string",
                              "description": "Plain-English sentence saying what this is based on"
                            }
                          },
                          "nullable": true,
                          "description": "Joint pick when several accounts were given, else null"
                        },
                        "next_best": {
                          "type": "object",
                          "properties": {
                            "day_of_week": {
                              "type": "integer",
                              "description": "0 = Sunday ... 6 = Saturday"
                            },
                            "iso_weekday": {
                              "type": "integer",
                              "description": "ISO 8601 weekday: 1 = Monday ... 7 = Sunday"
                            },
                            "hour": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 23
                            },
                            "time": {
                              "type": "string",
                              "example": "09:00",
                              "description": "Local time in `timezone`"
                            },
                            "label": {
                              "type": "string",
                              "example": "Tue 9:00 AM"
                            },
                            "basis": {
                              "type": "string",
                              "enum": [
                                "personal",
                                "platform",
                                "general"
                              ],
                              "description": "What backs this slot: the account's own posts, PostEverywhere users on the platform, or general guidance (not measured)"
                            },
                            "score": {
                              "type": "number",
                              "nullable": true,
                              "example": 1.25,
                              "description": "Performance against a typical post (1.25 = about 25% better). null for general guidance"
                            },
                            "next": {
                              "type": "object",
                              "description": "The next time this slot comes round, at least 30 minutes from now",
                              "properties": {
                                "date": {
                                  "type": "string",
                                  "example": "2026-10-06"
                                },
                                "time": {
                                  "type": "string",
                                  "example": "09:00"
                                },
                                "iso": {
                                  "type": "string",
                                  "format": "date-time",
                                  "example": "2026-10-06T13:00:00.000Z"
                                }
                              }
                            }
                          },
                          "nullable": true,
                          "description": "The soonest of the top three slots"
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/campaigns": {
      "get": {
        "operationId": "listCampaigns",
        "x-scope": "read",
        "tags": [
          "Campaigns"
        ],
        "summary": "List campaigns in the workspace",
        "description": "Returns every campaign in the workspace with name, color, status,\nand post counts. Use `status` to filter active vs archived.\n",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "archived"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Campaigns",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "campaigns",
                        "pagination"
                      ],
                      "properties": {
                        "campaigns": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Campaign"
                          }
                        },
                        "pagination": {
                          "$ref": "#/components/schemas/Pagination"
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "post": {
        "operationId": "createCampaign",
        "x-scope": "write",
        "tags": [
          "Campaigns"
        ],
        "summary": "Create a campaign",
        "description": "Campaigns group related posts (assign via `campaign_id` when listing\nposts; the dashboard sets it on posts). Default color is `#3b82f6`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "color": {
                    "type": "string",
                    "pattern": "^#[0-9a-fA-F]{6}$"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "archived"
                    ],
                    "default": "active"
                  }
                }
              },
              "example": {
                "name": "Q3 Launch",
                "description": "Everything for the July product launch",
                "color": "#3b82f6"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Campaign created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Campaign"
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/campaigns/{id}": {
      "get": {
        "operationId": "getCampaign",
        "x-scope": "read",
        "tags": [
          "Campaigns"
        ],
        "summary": "Get a campaign",
        "description": "Fetch one campaign by id: name, description, color, status, and\nits `post_count`.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CampaignId"
          }
        ],
        "responses": {
          "200": {
            "description": "Campaign",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Campaign"
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "patch": {
        "operationId": "updateCampaign",
        "x-scope": "write",
        "tags": [
          "Campaigns"
        ],
        "summary": "Update a campaign",
        "description": "At least one of name, description, color, status is required.",
        "parameters": [
          {
            "$ref": "#/components/parameters/CampaignId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "minProperties": 1,
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "color": {
                    "type": "string",
                    "pattern": "^#[0-9a-fA-F]{6}$"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "archived"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated campaign",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Campaign"
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "delete": {
        "operationId": "deleteCampaign",
        "x-scope": "write",
        "tags": [
          "Campaigns"
        ],
        "summary": "Delete a campaign",
        "description": "Posts in the campaign survive; their campaign_id is set to null.",
        "parameters": [
          {
            "$ref": "#/components/parameters/CampaignId"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "id",
                        "deleted"
                      ],
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "deleted": {
                          "type": "boolean",
                          "const": true
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "x-scope": "read",
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhook subscriptions",
        "description": "The signing secret is never included; it is returned only on creation.",
        "responses": {
          "200": {
            "description": "Webhooks",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "webhooks"
                      ],
                      "properties": {
                        "webhooks": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Webhook"
                          }
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "post": {
        "operationId": "createWebhook",
        "x-scope": "write",
        "tags": [
          "Webhooks"
        ],
        "summary": "Create a webhook subscription",
        "description": "PostEverywhere POSTs event payloads to your URL, signed with\nHMAC-SHA256 in the `X-PostEverywhere-Signature` header (the value is\n`sha256=` followed by the hex HMAC of the raw body, keyed with the\nreturned `secret`).\nDelivery headers also include `X-PostEverywhere-Event`,\n`X-PostEverywhere-Event-Id`, `X-PostEverywhere-Timestamp` and\n`X-PostEverywhere-Delivery-Id`. The `secret` is returned ONLY on\ncreation. URLs are SSRF-validated (no localhost/private/metadata\naddresses). Max 25 webhooks per organization\n(`400 limit_reached`). Unknown events → `400 invalid_event_type`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url",
                  "events"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "events": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "$ref": "#/components/schemas/WebhookEventType"
                    }
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              },
              "example": {
                "url": "https://example.com/hooks/posteverywhere",
                "events": [
                  "post.published",
                  "post.failed"
                ],
                "name": "Production notifier"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created. Includes the one-time signing secret",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/Webhook"
                        },
                        {
                          "type": "object",
                          "required": [
                            "secret"
                          ],
                          "properties": {
                            "secret": {
                              "type": "string",
                              "description": "whsec_-prefixed signing secret, shown exactly once"
                            },
                            "secret_warning": {
                              "type": "string"
                            }
                          }
                        }
                      ]
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/webhooks/{id}": {
      "get": {
        "operationId": "getWebhook",
        "x-scope": "read",
        "tags": [
          "Webhooks"
        ],
        "summary": "Get a webhook subscription (without secret)",
        "description": "Fetch one webhook subscription: URL, subscribed events, active\nstate, and delivery stats. The signing secret is only returned at\ncreation time.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Webhook"
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "patch": {
        "operationId": "updateWebhook",
        "x-scope": "write",
        "tags": [
          "Webhooks"
        ],
        "summary": "Update a webhook subscription",
        "description": "At least one of url, events, name, description, is_active is required.\nSetting `is_active: true` on a disabled webhook clears the\nauto-disabled marker and resets its failure counter. URL changes are\nre-validated with the same SSRF rules as creation.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "minProperties": 1,
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "events": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "$ref": "#/components/schemas/WebhookEventType"
                    }
                  },
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 100
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500
                  },
                  "is_active": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated webhook",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Webhook"
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "delete": {
        "operationId": "deleteWebhook",
        "x-scope": "write",
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a webhook subscription",
        "description": "Cascades to stored deliveries.",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "id",
                        "deleted"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "deleted": {
                          "type": "boolean",
                          "const": true
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/webhooks/{id}/test": {
      "post": {
        "operationId": "testWebhook",
        "x-scope": "write",
        "tags": [
          "Webhooks"
        ],
        "summary": "Send a signed test payload to a webhook URL",
        "description": "Sends a synthetic ping (payload has `data.test: true`) so you can\nverify signature validation end-to-end. The delivery result is\nreturned inline; no delivery row is stored. Always responds 200;\ncheck `data.ok` for the delivery outcome.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          }
        ],
        "responses": {
          "200": {
            "description": "Test delivery result (ok=false means your endpoint failed)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "ok"
                      ],
                      "properties": {
                        "ok": {
                          "type": "boolean"
                        },
                        "status": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "HTTP status your endpoint returned"
                        },
                        "duration_ms": {
                          "type": "integer"
                        },
                        "error": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/auth/device": {
      "post": {
        "operationId": "startDeviceAuth",
        "x-scope": "none",
        "security": [],
        "tags": [
          "Auth"
        ],
        "summary": "Start a device-grant login (RFC 8628 style)",
        "description": "UNAUTHENTICATED. Show the returned `user_code` and\n`verification_uri` to the user; they approve in a logged-in browser.\nThen poll `POST /auth/device/token` every `interval` seconds. Codes\nexpire after `expires_in` seconds (15 min). Per-IP rate limited.\n",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_name": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Shown as the API key name, e.g. \"CLI on jamie-macbook\""
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Device code allocated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "device_code",
                        "user_code",
                        "verification_uri",
                        "expires_in",
                        "interval"
                      ],
                      "properties": {
                        "device_code": {
                          "type": "string"
                        },
                        "user_code": {
                          "type": "string",
                          "description": "Human-typable code, format XXXX-XXXX"
                        },
                        "verification_uri": {
                          "type": "string",
                          "format": "uri"
                        },
                        "verification_uri_complete": {
                          "type": "string",
                          "format": "uri"
                        },
                        "expires_in": {
                          "type": "integer",
                          "const": 900
                        },
                        "interval": {
                          "type": "integer",
                          "const": 5
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/auth/device/token": {
      "post": {
        "operationId": "pollDeviceToken",
        "x-scope": "none",
        "security": [],
        "tags": [
          "Auth"
        ],
        "summary": "Poll a device login and mint the API key on approval",
        "description": "UNAUTHENTICATED. Poll every 5 s with the `device_code`. Non-terminal\nstates return 200 with `status` of `pending` or `slow_down`\n(includes `interval`). Terminal: `expired`, `denied`, or\n`authorized`. On the first poll after browser approval the response\ncarries the plaintext `api_key` (scopes read/write/ai, no expiry)\nEXACTLY ONCE. Persist it immediately; subsequent polls return\n`expired`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "device_code"
                ],
                "properties": {
                  "device_code": {
                    "type": "string",
                    "minLength": 32
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Poll result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "status"
                      ],
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "pending",
                            "slow_down",
                            "expired",
                            "denied",
                            "authorized"
                          ]
                        },
                        "interval": {
                          "type": "integer",
                          "description": "Present with slow_down"
                        },
                        "api_key": {
                          "type": "string",
                          "description": "pe_live_... plaintext key, returned once, only with status=authorized"
                        },
                        "api_key_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "scopes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "organization_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "user": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "integer"
                            },
                            "email": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/auth/social-connect/start": {
      "post": {
        "operationId": "startSocialConnect",
        "x-scope": "write",
        "tags": [
          "Auth"
        ],
        "summary": "Start a browser OAuth connect session",
        "description": "Requires an API key (session fallback rejected with\n`401 api_key_required`). For the browser-OAuth platforms (instagram,\nfacebook, threads, x, linkedin, tiktok, youtube, pinterest) this\nreturns the dashboard's OAuth-start `authorize_url` to open in a\nlogged-in browser, plus a `session_id` to poll. Headless platforms\n(bluesky, telegram, discord) are rejected with\n`400 use_headless_endpoint`; POST credentials to their dedicated\nendpoints instead. `mode: reconnect` requires `account_id`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "platform"
                ],
                "properties": {
                  "platform": {
                    "type": "string",
                    "enum": [
                      "instagram",
                      "facebook",
                      "threads",
                      "x",
                      "linkedin",
                      "tiktok",
                      "youtube",
                      "pinterest",
                      "google_business"
                    ]
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "connect",
                      "reconnect"
                    ],
                    "default": "connect"
                  },
                  "account_id": {
                    "type": "integer",
                    "description": "Required for mode=reconnect"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Session started",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "session_id",
                        "authorize_url",
                        "expires_in",
                        "interval"
                      ],
                      "properties": {
                        "session_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "authorize_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "expires_in": {
                          "type": "integer",
                          "const": 900
                        },
                        "interval": {
                          "type": "integer",
                          "const": 3
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/auth/social-connect/poll/{session_id}": {
      "get": {
        "operationId": "pollSocialConnect",
        "x-scope": "read",
        "tags": [
          "Auth"
        ],
        "summary": "Poll a connect session until the browser OAuth completes",
        "description": "Requires the SAME API key that started the session. Resolves to\n`completed` (with the connected `account`) once an account for the\nsession's platform appears (or, for reconnect, the target account's\ntoken refreshes) after the session started. Other statuses:\n`pending`, `expired`, `cancelled`.\n",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Session status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "status"
                      ],
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "pending",
                            "completed",
                            "expired",
                            "cancelled"
                          ]
                        },
                        "account": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "properties": {
                            "id": {
                              "type": "integer"
                            },
                            "platform": {
                              "type": "string"
                            },
                            "account_name": {
                              "type": "string"
                            },
                            "avatar_url": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/auth/social-connect/bluesky": {
      "post": {
        "operationId": "connectBluesky",
        "x-scope": "write",
        "tags": [
          "Auth"
        ],
        "summary": "Connect a Bluesky account (headless, app password)",
        "description": "Requires an API key. Use an App Password (Bluesky Settings → App\nPasswords), not the login password (`401 auth_failed` otherwise).\nErrors: `validation_error`, `account_limit_reached` (403),\n`already_connected` (409: account belongs to another organization).\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "handle",
                  "app_password"
                ],
                "properties": {
                  "handle": {
                    "type": "string",
                    "description": "e.g. alice.bsky.social (leading @ tolerated)"
                  },
                  "app_password": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Connected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectCompletedEnvelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "description": "Account already connected to another organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/auth/social-connect/telegram": {
      "post": {
        "operationId": "connectTelegram",
        "x-scope": "write",
        "tags": [
          "Auth"
        ],
        "summary": "Connect a Telegram channel (headless, bot token)",
        "description": "Requires an API key. The bot (from @BotFather) must be an\nadministrator of the channel with Post Messages enabled\n(`400 bot_not_admin` otherwise, with setup instructions). `channel`\naccepts \"@name\" or a numeric chat ID. Provider errors are mapped to\nspecific codes; upstream Telegram failures return 502.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "bot_token",
                  "channel"
                ],
                "properties": {
                  "bot_token": {
                    "type": "string"
                  },
                  "channel": {
                    "type": "string",
                    "description": "@mychannel or numeric chat id"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Connected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectCompletedEnvelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "description": "Channel already connected to another organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "description": "Telegram API unreachable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/auth/social-connect/discord": {
      "post": {
        "operationId": "connectDiscord",
        "x-scope": "write",
        "tags": [
          "Auth"
        ],
        "summary": "Connect a Discord channel (headless, webhook URL)",
        "description": "Requires an API key. Create the webhook in Discord under Server\nSettings → Integrations → Webhooks and paste its URL. Invalid URLs\nreturn `401 auth_failed`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "webhook_url"
                ],
                "properties": {
                  "webhook_url": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Connected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectCompletedEnvelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "description": "Channel already connected to another organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/platform-rules": {
      "get": {
        "operationId": "getPlatformRules",
        "x-scope": "read",
        "x-status": "planned",
        "tags": [
          "Platform Rules"
        ],
        "summary": "Get platform composer rules",
        "description": "Server-authoritative composer rules for every supported platform:\ncharacter limits, image/video constraints, and feature support\n(threads, carousels, reels, alt text, blog posts). WordPress also\ncarries `blog`: the platform_content.wordpress fields, their limits\nand defaults. Google Business Profile carries `local_post`: the\nplatform_content.google_business fields (post types, buttons, event\nand offer fields). Check before composing for an\nunfamiliar platform; limits span 300 characters (Bluesky) to 63,206\n(Facebook), and some constraints are enforced platform-side only.\nServed with an ETag; a newly supported platform appears here with no\nclient update. Live since 2026-08-17.\n",
        "responses": {
          "200": {
            "description": "Map of platform → rules",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "description": "Keys are platform identifiers (instagram, facebook, x, ...)",
                      "additionalProperties": {
                        "$ref": "#/components/schemas/PlatformRule"
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                },
                "examples": {
                  "rules": {
                    "value": {
                      "data": {
                        "x": {
                          "characterLimit": 280,
                          "mediaTypes": [
                            "image",
                            "video",
                            "gif"
                          ],
                          "maxImages": 4,
                          "maxVideoBytes": 536870912,
                          "features": [
                            "threads",
                            "polls"
                          ]
                        },
                        "instagram": {
                          "characterLimit": 2200,
                          "mediaTypes": [
                            "image",
                            "video"
                          ],
                          "maxImages": 10,
                          "maxVideoBytes": 104857600,
                          "features": [
                            "carousels",
                            "reels",
                            "cover_photo"
                          ]
                        }
                      },
                      "error": null,
                      "meta": {
                        "request_id": "5d6e7f8a",
                        "timestamp": "2026-07-08T09:00:00.000Z"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "pe_live_...",
        "description": "API key created in the dashboard (Developers) or via the device-login\nflow. Keys start with `pe_live_` and carry scopes (read, write, ai);\nonly a SHA-256 hash is stored server-side. See each operation's\n`x-scope` for the scope it requires.\n"
      }
    },
    "parameters": {
      "PostId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "Post UUID (non-UUIDs return 400 invalid_id)",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "MediaId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "Media UUID",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "AccountId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "Social account ID (integer, as returned by listAccounts)",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "CampaignId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "Campaign ID (integer)",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "WebhookId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "Webhook UUID",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Validation error; see error.code and error.details",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "data": null,
              "error": {
                "message": "account_ids is required and must be a non-empty array. Use GET /accounts to find your account IDs.",
                "code": "account_ids_required",
                "retryable": false
              },
              "meta": {
                "request_id": "1a2b3c4d",
                "timestamp": "2026-07-08T09:00:00.000Z"
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing/invalid/revoked/expired API key (codes invalid_api_key,\napi_key_revoked, api_key_expired, api_key_required, auth_failed).\nAuth-layer 401s omit error.retryable and meta.request_id.\n",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "data": null,
              "error": {
                "message": "Invalid API key format. Expected: Bearer pe_live_...",
                "code": "invalid_api_key"
              },
              "meta": {
                "timestamp": "2026-07-08T09:00:00.000Z"
              }
            }
          }
        }
      },
      "PaymentRequired": {
        "description": "No active subscription (code subscription_required; the error object\nalso carries subscription_status), or insufficient AI credits\n(insufficient_credits) / paid plan required (upgrade_required).\n",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "data": null,
              "error": {
                "message": "Your free trial has ended. Please upgrade to a paid plan to continue using the API.",
                "code": "subscription_required",
                "subscription_status": "expired"
              },
              "meta": {
                "timestamp": "2026-07-08T09:00:00.000Z"
              }
            }
          }
        }
      },
      "Forbidden": {
        "description": "API key missing the required scope (insufficient_scope), storage quota exceeded (storage_quota_exceeded), or account limit reached (account_limit_reached)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "data": null,
              "error": {
                "message": "API key missing required scope: 'write'. Your key has scopes: [read]",
                "code": "insufficient_scope",
                "retryable": false,
                "details": {
                  "required_scope": "write",
                  "current_scopes": [
                    "read"
                  ]
                }
              },
              "meta": {
                "request_id": "1a2b3c4d",
                "timestamp": "2026-07-08T09:00:00.000Z"
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "Resource not found in your organization/workspace (not_found)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "data": null,
              "error": {
                "message": "Post not found. Verify the post ID belongs to your organization.",
                "code": "not_found",
                "retryable": false
              },
              "meta": {
                "request_id": "1a2b3c4d",
                "timestamp": "2026-07-08T09:00:00.000Z"
              }
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limit exceeded (rate_limit_exceeded, or plan budgets\npost_limit_reached / daily_limit_reached on schedulePost). All 429s\ncarry Retry-After. The API-key limiter additionally sets the\nX-RateLimit-* headers and error.details (limit, remaining, reset_at).\n",
        "headers": {
          "Retry-After": {
            "description": "Seconds to wait before retrying",
            "schema": {
              "type": "integer"
            }
          },
          "X-RateLimit-Limit": {
            "description": "Requests allowed in the window (API-key limiter only)",
            "schema": {
              "type": "integer"
            }
          },
          "X-RateLimit-Remaining": {
            "description": "Requests remaining (API-key limiter only)",
            "schema": {
              "type": "integer"
            }
          },
          "X-RateLimit-Reset": {
            "description": "Unix seconds when the window resets (API-key limiter only)",
            "schema": {
              "type": "integer"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "data": null,
              "error": {
                "message": "API rate limit exceeded (60 requests/min). Please slow down.",
                "code": "rate_limit_exceeded",
                "retryable": true,
                "details": {
                  "limit": 60,
                  "remaining": 0,
                  "reset_at": "2026-07-08T09:01:00.000Z"
                }
              },
              "meta": {
                "request_id": "1a2b3c4d",
                "timestamp": "2026-07-08T09:00:00.000Z"
              }
            }
          }
        }
      },
      "ServerError": {
        "description": "Internal error (internal_error and endpoint-specific 5xx codes). Retryable.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "data": null,
              "error": {
                "message": "Failed to create post. Verify content, account_ids, and optional media_ids/scheduled_for are valid, then retry.",
                "code": "internal_error",
                "retryable": true
              },
              "meta": {
                "request_id": "1a2b3c4d",
                "timestamp": "2026-07-08T09:00:00.000Z"
              }
            }
          }
        }
      }
    },
    "schemas": {
      "Meta": {
        "type": "object",
        "description": "Response metadata. request_id is an 8-char correlation id (absent on auth-layer 401/402).",
        "properties": {
          "request_id": {
            "type": "string"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "timestamp"
        ]
      },
      "ErrorBody": {
        "type": "object",
        "required": [
          "message"
        ],
        "properties": {
          "message": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "description": "Machine-readable error code (e.g. validation_error, not_found, rate_limit_exceeded)"
          },
          "retryable": {
            "type": "boolean",
            "description": "true for transient failures (5xx, 429). Absent on auth-layer 401/402 errors."
          },
          "details": {
            "description": "Optional structured context specific to the error code"
          },
          "subscription_status": {
            "type": "string",
            "description": "Present only on 402 subscription_required"
          }
        },
        "additionalProperties": true
      },
      "ErrorEnvelope": {
        "type": "object",
        "required": [
          "data",
          "error",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "null"
          },
          "error": {
            "$ref": "#/components/schemas/ErrorBody"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "Pagination": {
        "type": "object",
        "required": [
          "limit",
          "offset"
        ],
        "properties": {
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "has_more": {
            "type": "boolean"
          }
        }
      },
      "PostStatus": {
        "type": "string",
        "description": "Derived from live destination statuses (the stored post_status column is frozen at creation)",
        "enum": [
          "draft",
          "scheduled",
          "publishing",
          "published",
          "partially_failed",
          "failed"
        ]
      },
      "DestinationMetrics": {
        "type": [
          "object",
          "null"
        ],
        "description": "Engagement metrics fetched from the platform (null until first fetch; only some platforms have metric fetchers)",
        "properties": {
          "views": {
            "type": [
              "integer",
              "null"
            ]
          },
          "likes": {
            "type": [
              "integer",
              "null"
            ]
          },
          "comments": {
            "type": [
              "integer",
              "null"
            ]
          },
          "shares": {
            "type": [
              "integer",
              "null"
            ]
          },
          "impressions": {
            "type": [
              "integer",
              "null"
            ]
          },
          "saves": {
            "type": [
              "integer",
              "null"
            ]
          },
          "clicks": {
            "type": [
              "integer",
              "null"
            ]
          },
          "fetched_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "PostDestination": {
        "type": "object",
        "description": "One platform/account target of a post",
        "required": [
          "destination_id",
          "platform",
          "destination_status"
        ],
        "properties": {
          "destination_id": {
            "type": "string",
            "format": "uuid"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "deprecated": true,
            "description": "Deprecated alias of destination_id"
          },
          "account_id": {
            "type": [
              "integer",
              "null"
            ]
          },
          "account_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Present on getPost, createPost and results responses (not in listPosts)"
          },
          "account_avatar_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "Present on createPost response only"
          },
          "platform": {
            "type": "string"
          },
          "destination_status": {
            "type": "string",
            "enum": [
              "queued",
              "preparing",
              "uploading",
              "publishing",
              "verifying",
              "retry_scheduled",
              "done",
              "failed",
              "draft"
            ],
            "description": "Lifecycle of THIS destination. A successful publish is `done`; there is no `published` value at the destination level (that name belongs to the post-level status vocabulary, which is a different taxonomy). In flight: `preparing`, `uploading`, `publishing`, `verifying`. Waiting: `queued`, `retry_scheduled`. Terminal: `done`, `failed`.\n"
          },
          "status": {
            "type": "string",
            "deprecated": true,
            "description": "Deprecated alias of destination_status"
          },
          "scheduled_for": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When THIS destination fires (the scheduler uses this, not the post-level value)"
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "platform_post_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "platform_post_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "Present on createPost and results responses after a successful publish"
          },
          "error": {
            "description": "Last error (string or structured object), null when none"
          },
          "attempts": {
            "type": "integer"
          },
          "next_retry_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "metrics": {
            "$ref": "#/components/schemas/DestinationMetrics"
          },
          "warnings": {
            "type": "array",
            "description": "Present on getPost. Warnings on a destination that still published (empty when none).",
            "items": {
              "$ref": "#/components/schemas/DestinationWarning"
            }
          }
        }
      },
      "DestinationWarning": {
        "type": "object",
        "description": "A warning on a destination that published. The destination status is unchanged. `tiktok_published_private`: TikTok has not made the post public about 2 hours after publishing (still in TikTok review, or restricted). Cleared automatically if it becomes public.\n",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "example": "tiktok_published_private"
          },
          "message": {
            "type": "string"
          },
          "detected_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Post": {
        "type": "object",
        "description": "Post as returned by listPosts / getPost",
        "required": [
          "post_id",
          "post_status",
          "content",
          "account_ids",
          "timezone",
          "media_ids",
          "destinations",
          "destinations_count",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "post_id": {
            "type": "string",
            "format": "uuid"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "deprecated": true,
            "description": "Deprecated alias of post_id"
          },
          "post_status": {
            "$ref": "#/components/schemas/PostStatus"
          },
          "status": {
            "deprecated": true,
            "description": "Deprecated alias of post_status",
            "$ref": "#/components/schemas/PostStatus"
          },
          "content": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_ids": {
            "type": "array",
            "description": "For drafts, taken from the draft's saved account selection",
            "items": {
              "type": "integer"
            }
          },
          "platform_content": {
            "type": "object",
            "description": "Per-platform caption overrides (present on drafts that have them)",
            "additionalProperties": true
          },
          "scheduled_for": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "null for drafts without a pre-set time"
          },
          "timezone": {
            "type": "string",
            "default": "UTC"
          },
          "media_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "media": {
            "description": "Hydrated media JSONB (array of media objects), response only"
          },
          "campaign_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Present in listPosts responses"
          },
          "thread_posts": {
            "description": "Thread segments (getPost only), null when not a thread"
          },
          "destinations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PostDestination"
            }
          },
          "destinations_count": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "UpdatedPost": {
        "type": "object",
        "description": "Post as returned by updatePost (a slimmer shape than getPost)",
        "required": [
          "id",
          "status",
          "account_ids",
          "scheduled_for",
          "timezone",
          "media_ids",
          "destinations",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "content": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/PostStatus"
          },
          "account_ids": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "scheduled_for": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "timezone": {
            "type": "string"
          },
          "media_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "media": {},
          "destinations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "platform": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "account_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "account_id": {
                  "type": [
                    "integer",
                    "null"
                  ]
                }
              }
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Plain notes about settings that were removed, for example a first comment on a platform that cannot post one yet."
          }
        }
      },
      "PostResult": {
        "type": "object",
        "description": "Per-destination publish result (getPostResults)",
        "required": [
          "id",
          "platform",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "platform": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "queued → publishing → published or failed"
          },
          "account_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_id": {
            "type": [
              "integer",
              "null"
            ]
          },
          "scheduled_for": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "platform_post_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "platform_post_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "error": {},
          "attempts": {
            "type": [
              "integer",
              "null"
            ]
          },
          "next_retry_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "warnings": {
            "type": "array",
            "description": "Warnings on a destination that still published (empty when none)",
            "items": {
              "$ref": "#/components/schemas/DestinationWarning"
            }
          }
        }
      },
      "CreatePostRequest": {
        "type": "object",
        "description": "Body for createPost (and each item of bulkCreatePosts). camelCase\naliases (accountIds, mediaIds, scheduledFor, platformContent,\ncoverPhoto) and the deprecated scheduled_at alias are also accepted.\n",
        "properties": {
          "thread_posts": {
            "type": "array",
            "maxItems": 25,
            "items": {
              "type": "string"
            },
            "description": "The parts that follow content, in order. The post goes out as a linked thread on X and Bluesky (each part replies to the one before; Threads gets the first part only for now) and as follow-up messages on Telegram and Discord. Other accounts get content only. Up to 25 parts, each checked against the platform's text limit before anything is posted. Not with an X Article. threadPosts is accepted as an alias."
          },
          "content": {
            "type": "string",
            "maxLength": 25000,
            "description": "Required unless platform_content has a caption or media_ids is non-empty. Max 10,000 characters, or 25,000 for an X Article (platform_content.x.settings.post_type = \"article\"). A long WordPress blog body goes in platform_content.wordpress.content instead."
          },
          "account_ids": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "integer"
            },
            "description": "Required unless draft=true (drafts may pick accounts at schedule time)"
          },
          "scheduled_for": {
            "type": "string",
            "format": "date-time",
            "description": "Omit to publish immediately. Assumed UTC when no offset. Must be in the future."
          },
          "timezone": {
            "type": "string",
            "default": "UTC",
            "description": "IANA timezone, stored for display only. It does not change when the post goes out. scheduled_for without an offset is read as UTC."
          },
          "use_queue": {
            "type": "boolean",
            "default": false,
            "description": "Let the workspace's posting queue pick the time. The server allocates the next free opening at create time and the response carries the resulting scheduled_for and the queue's timezone. Mutually exclusive with scheduled_for (400 conflicting_schedule_mode when both are sent). Requires a queue to exist (set one up in the app under Settings, Posting Queue, or read it with GET /queue); the request returns 400 with a clear message when the queue is missing, has no openings, or is full."
          },
          "schedule_at": {
            "type": "string",
            "description": "Not accepted by the REST API. Any value returns 400 unsupported_schedule_at, so a post is never published now by mistake. The MCP tools accept schedule_at best_time and send scheduled_for for you; here, call GET /best-times and send its time as scheduled_for."
          },
          "campaign_id": {
            "type": "integer",
            "description": "Put the post in a campaign of this workspace. Kept on drafts, so it stays when the draft is scheduled. A draft with an unknown campaign returns 400 campaign_not_found."
          },
          "media_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Media UUIDs from the upload flow. Do NOT send `media`/`media_id`/`attachments`."
          },
          "platform_content": {
            "$ref": "#/components/schemas/PlatformContent"
          },
          "cover_photo": {
            "type": "object",
            "description": "Video cover photo. On YouTube it is the video's custom thumbnail (YouTube allows custom thumbnails on verified channels only). Give url or media_id.",
            "properties": {
              "url": {
                "type": "string",
                "format": "uri",
                "description": "Public https link to a JPG or PNG."
              },
              "media_id": {
                "type": "string",
                "description": "An image uploaded through the media endpoints. Some stored images can only be shared as a 7-day link; when the post goes out later than that, the response notes say so and you should send url instead."
              },
              "timestamp": {
                "type": "number",
                "default": 0
              },
              "is_custom": {
                "type": "boolean",
                "default": true
              }
            }
          },
          "draft": {
            "type": "boolean",
            "default": false,
            "description": "Save as a reviewable draft instead of scheduling/publishing"
          },
          "request_approval": {
            "type": "boolean",
            "default": false,
            "description": "Only with draft true. Sends the draft to the workspace's reviewers (approval_status becomes pending, owners and admins are notified, and the post.approval_requested webhook event fires). Without draft true the request returns 400 request_approval_needs_draft and nothing is created."
          }
        }
      },
      "PlatformContent": {
        "type": "object",
        "description": "Per-platform overrides keyed by platform name. Each entry may set content (that platform's own text) and settings. X settings include made_with_ai, paid_partnership and community_id. X Article (X Premium accounts): under x, set settings.post_type to article and settings.title (up to 100 characters), with the article body in content; X accounts only, up to 5 images (the first is the cover), no video, 2 published articles per X account per 24 hours; invalid articles return x_article_invalid. WordPress blog post: see WordPressBlogPost. Google Business Profile post: see GoogleBusinessPost. Setting keys are camelCase; these snake_case spellings are also accepted and stored as camelCase: first_comment, alt_text, media_alt_text, reply_settings, privacy_level, disable_comment, disable_duet, disable_stitch, video_type, cover_photo_url, topic_tag, link_attachment, board_id, board_section_id, comment_status. Facebook contentType Reels posts a video as a Reel, Post or Video as a regular video (a landscape video always posts as a regular video). First comments are not available on Instagram, Facebook, LinkedIn, Threads and YouTube yet. They work on X. A first comment for those platforms is removed and the response notes say so.",
        "properties": {
          "wordpress": {
            "$ref": "#/components/schemas/WordPressBlogPost"
          },
          "google_business": {
            "$ref": "#/components/schemas/GoogleBusinessPost"
          },
          "youtube": {
            "$ref": "#/components/schemas/YouTubePost"
          }
        },
        "additionalProperties": true
      },
      "YouTubePost": {
        "type": "object",
        "description": "YouTube options (platform_content.youtube). Field names are camelCase;\nsnake_case versions (made_for_kids, privacy_status and so on) are also\naccepted. A wrong value returns `400 youtube_settings_invalid`.\nYouTube decides what is a Short (square or vertical, up to 3 minutes).\nAge restriction, paid promotion, comments on or off, Shorts remixing\nand caption certification cannot be set through YouTube's API; they are YouTube\nStudio only, and the response lists them under `notes` when sent.\n",
        "properties": {
          "content": {
            "type": "string",
            "description": "Text for YouTube only (used as the description when settings.description is not set)."
          },
          "settings": {
            "$ref": "#/components/schemas/YouTubeSettings"
          }
        }
      },
      "YouTubeSettings": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 100,
            "description": "Defaults to the first line of the caption."
          },
          "description": {
            "type": "string",
            "maxLength": 5000,
            "description": "Defaults to the caption."
          },
          "tags": {
            "description": "A list of tags, or one comma-separated string. Up to 500 characters in total as YouTube counts them.",
            "oneOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "string"
              }
            ]
          },
          "categoryId": {
            "type": "string",
            "default": "22",
            "description": "YouTube category number, e.g. 22 People and Blogs, 23 Comedy, 24 Entertainment, 26 Howto and Style, 27 Education, 28 Science and Technology."
          },
          "privacyStatus": {
            "type": "string",
            "enum": [
              "public",
              "unlisted",
              "private"
            ],
            "default": "public"
          },
          "madeForKids": {
            "type": "boolean",
            "default": false
          },
          "containsSyntheticMedia": {
            "type": "boolean",
            "description": "Discloses realistic altered or synthetic (AI) content."
          },
          "notifySubscribers": {
            "type": "boolean",
            "default": true
          },
          "license": {
            "type": "string",
            "enum": [
              "youtube",
              "creativeCommon"
            ],
            "default": "youtube"
          },
          "embeddable": {
            "type": "boolean",
            "default": true
          },
          "publicStatsViewable": {
            "type": "boolean",
            "default": true
          },
          "defaultLanguage": {
            "type": "string",
            "example": "en",
            "description": "Language of the title and description."
          },
          "playlistIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Not available yet. It needs a wider YouTube permission, and then each channel reconnects once."
          },
          "firstComment": {
            "type": "string",
            "maxLength": 10000,
            "description": "Not available yet. It is removed from the post and the response notes say so."
          },
          "coverPhotoUrl": {
            "type": "string",
            "format": "uri",
            "description": "Custom thumbnail for YouTube only (public https JPG or PNG). Same as the top-level cover_photo. Verified channels only."
          }
        }
      },
      "GoogleBusinessPost": {
        "type": "object",
        "description": "A Google Business Profile post (platform_content.google_business). It\nshows on the business's listing on Google Search and Maps. Media: at\nmost 1 photo (JPG or PNG) in `media_ids`, no video. Do not put phone\nnumbers in the text: Google may reject those posts. A post that breaks a\nrule returns `400 google_business_post_invalid`.\n",
        "properties": {
          "content": {
            "type": "string",
            "maxLength": 1500,
            "description": "Text for Google only. Defaults to the top-level `content`."
          },
          "settings": {
            "$ref": "#/components/schemas/GoogleBusinessPostSettings"
          }
        }
      },
      "GoogleBusinessPostSettings": {
        "type": "object",
        "description": "All optional. camelCase names (postType, buttonUrl, eventTitle, startDate, endDate, couponCode, redeemUrl) are also accepted.",
        "properties": {
          "post_type": {
            "type": "string",
            "enum": [
              "update",
              "event",
              "offer"
            ],
            "default": "update"
          },
          "button": {
            "type": "string",
            "enum": [
              "none",
              "book",
              "order",
              "shop",
              "learn_more",
              "sign_up",
              "call"
            ],
            "default": "none",
            "description": "The button under the post. Offer posts have no button."
          },
          "button_url": {
            "type": "string",
            "format": "uri",
            "description": "Required for every button except none and call."
          },
          "event_title": {
            "type": "string",
            "maxLength": 58,
            "description": "Required for event and offer posts."
          },
          "start_date": {
            "type": "string",
            "description": "Required for event and offer posts. YYYY-MM-DD or YYYY-MM-DDTHH:mm, in the business's own time zone."
          },
          "end_date": {
            "type": "string",
            "description": "Required for event and offer posts. Same format. Must not be before start_date."
          },
          "coupon_code": {
            "type": "string",
            "maxLength": 58,
            "description": "Offer posts only."
          },
          "redeem_url": {
            "type": "string",
            "format": "uri",
            "description": "Offer posts only. Where the offer is used online."
          },
          "terms": {
            "type": "string",
            "maxLength": 5000,
            "description": "Offer posts only. Terms and conditions."
          }
        }
      },
      "WordPressBlogPost": {
        "type": "object",
        "description": "A WordPress blog post (platform_content.wordpress). Other platforms in\nthe same request use the top-level `content`. Media: up to 20 images\nand 1 video in `media_ids`. The first image is the featured image\n(unless settings.featuredImage is \"none\"); the others go where\n`![caption](image:N)` places them, else at the end. A video goes at\nthe top. The post needs a title (settings.title, a leading\n`# Heading`, or the first line of the body), else\n`400 wordpress_title_required`.\n",
        "properties": {
          "content": {
            "type": "string",
            "maxLength": 200000,
            "description": "The post body. Markdown-style: # headings, **bold**, *italic*,\n[links](https://...), - lists, quote lines (greater-than sign), --- dividers,\n```code```, | tables |, ![caption](image:N). Raw HTML is kept\nas-is. Defaults to the top-level `content`.\n"
          },
          "settings": {
            "$ref": "#/components/schemas/WordPressBlogSettings"
          }
        }
      },
      "WordPressBlogSettings": {
        "type": "object",
        "description": "Blog post settings. All optional. A bad value returns `400 wordpress_post_invalid`.",
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 200,
            "description": "Defaults to a leading \"# Heading\" line, else the first line of the body."
          },
          "status": {
            "type": "string",
            "enum": [
              "publish",
              "draft",
              "pending",
              "private"
            ],
            "default": "publish",
            "description": "WordPress post status. \"draft\" saves it on the site without publishing."
          },
          "excerpt": {
            "type": "string",
            "maxLength": 1000
          },
          "slug": {
            "type": "string",
            "maxLength": 190,
            "description": "URL slug; lowercased, other characters become -"
          },
          "tags": {
            "description": "Tag names. Missing tags are created.",
            "oneOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "string",
                "description": "Comma-separated names"
              }
            ]
          },
          "categories": {
            "description": "Category names or numeric ids. Unknown names are skipped with a warning.",
            "oneOf": [
              {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "integer"
                    }
                  ]
                }
              },
              {
                "type": "string",
                "description": "Comma-separated names or ids"
              }
            ]
          },
          "featuredImage": {
            "type": "string",
            "enum": [
              "first",
              "none"
            ],
            "default": "first",
            "description": "\"first\" uses the first attached image as the featured image."
          },
          "post_type": {
            "type": "string",
            "enum": [
              "blog"
            ],
            "description": "Optional marker. The web composer sets it."
          }
        },
        "additionalProperties": true
      },
      "PostCreated": {
        "type": "object",
        "description": "createPost response for a scheduled/immediate post",
        "required": [
          "post_id",
          "post_status",
          "publish_mode",
          "account_ids",
          "destinations",
          "created_at"
        ],
        "properties": {
          "post_id": {
            "type": "string",
            "format": "uuid"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "deprecated": true
          },
          "post_status": {
            "$ref": "#/components/schemas/PostStatus"
          },
          "status": {
            "deprecated": true,
            "$ref": "#/components/schemas/PostStatus"
          },
          "publish_mode": {
            "type": "string",
            "enum": [
              "immediate",
              "scheduled"
            ]
          },
          "content": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_ids": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "scheduled_for": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "timezone": {
            "type": "string"
          },
          "media_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "platform_content": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "destinations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PostDestination"
            }
          },
          "destinations_count": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "accounts_count": {
            "type": "integer",
            "deprecated": true
          },
          "message": {
            "type": "string"
          },
          "next_step": {
            "type": "string"
          },
          "validation_warnings": {
            "type": "object",
            "description": "Non-blocking per-platform warnings (e.g. suboptimal aspect ratio)",
            "additionalProperties": true
          },
          "results": {
            "type": "array",
            "deprecated": true,
            "description": "Deprecated alias of destinations",
            "items": {
              "$ref": "#/components/schemas/PostDestination"
            }
          }
        }
      },
      "DraftCreated": {
        "type": "object",
        "description": "createPost response when draft: true",
        "required": [
          "post_id",
          "status",
          "created_at"
        ],
        "properties": {
          "post_id": {
            "type": "string",
            "format": "uuid"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "deprecated": true
          },
          "status": {
            "type": "string",
            "const": "draft"
          },
          "post_status": {
            "type": "string",
            "const": "draft"
          },
          "content": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_ids": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "media_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "scheduled_for": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Pre-filled schedule if one was supplied, else null"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "message": {
            "type": "string"
          },
          "next_steps": {
            "type": "object",
            "properties": {
              "review": {
                "type": "string"
              },
              "schedule": {
                "type": "string"
              }
            }
          }
        }
      },
      "BulkResultEnvelope": {
        "type": "object",
        "required": [
          "data",
          "error",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "summary",
              "results"
            ],
            "properties": {
              "summary": {
                "type": "object",
                "required": [
                  "total",
                  "succeeded",
                  "failed"
                ],
                "properties": {
                  "total": {
                    "type": "integer"
                  },
                  "succeeded": {
                    "type": "integer"
                  },
                  "failed": {
                    "type": "integer"
                  }
                }
              },
              "results": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "index",
                    "ok"
                  ],
                  "properties": {
                    "index": {
                      "type": "integer"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "post": {
                      "description": "The createPost response data (when ok=true)",
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/PostCreated"
                        },
                        {
                          "$ref": "#/components/schemas/DraftCreated"
                        }
                      ]
                    },
                    "error": {
                      "type": "object",
                      "description": "Present when ok=false",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "error": {
            "type": "null"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "SocialAccount": {
        "type": "object",
        "required": [
          "id",
          "platform",
          "account_name",
          "is_active",
          "created_at",
          "health"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "description": "Integer account ID. Use this in account_ids and path params"
          },
          "platform": {
            "type": "string",
            "description": "Known values: instagram, facebook, x, linkedin, youtube, tiktok, threads, pinterest, bluesky, telegram, discord, wordpress, google_business"
          },
          "account_name": {
            "type": "string"
          },
          "avatar_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_active": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "health": {
            "type": "object",
            "required": [
              "status",
              "can_post"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "healthy",
                  "unhealthy",
                  "expired",
                  "needs_reconnection"
                ],
                "description": "needs_reconnection appears only in listAccounts (getAccount reports healthy/unhealthy/expired)"
              },
              "can_post": {
                "type": "boolean"
              },
              "needs_reconnection": {
                "type": "boolean",
                "description": "Present in listAccounts only"
              }
            }
          },
          "wordpress_site": {
            "type": "object",
            "description": "getAccount only, WordPress accounts only. The site blog posts publish to (never credentials).",
            "properties": {
              "url": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "kind": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "self_hosted (Application Password) or wpcom (WordPress.com)"
              }
            }
          },
          "google_business": {
            "type": "object",
            "description": "getAccount only, Google Business Profile accounts only. The business posts publish to (never tokens).",
            "properties": {
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "address": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "maps_uri": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri"
              },
              "verified": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "can_post": {
                "type": [
                  "boolean",
                  "null"
                ],
                "description": "false when Google does not allow posts on this business yet (usually not verified)."
              }
            }
          }
        }
      },
      "AccountHealthReport": {
        "type": "object",
        "required": [
          "account_id",
          "platform",
          "status",
          "can_post",
          "reasons",
          "is_active",
          "needs_reconnection",
          "token",
          "activity"
        ],
        "properties": {
          "account_id": {
            "type": "integer"
          },
          "platform": {
            "type": "string"
          },
          "account_name": {
            "type": "string"
          },
          "platform_account_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The account's ID on the platform itself"
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "warning",
              "broken"
            ]
          },
          "can_post": {
            "type": "boolean"
          },
          "reasons": {
            "type": "array",
            "description": "Why status is not healthy",
            "items": {
              "type": "string",
              "enum": [
                "account_inactive",
                "needs_reconnection",
                "token_expired",
                "recent_permanent_failures",
                "token_expiring_soon"
              ]
            }
          },
          "is_active": {
            "type": "boolean"
          },
          "needs_reconnection": {
            "type": "boolean"
          },
          "needs_reconnection_since": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "token": {
            "type": "object",
            "properties": {
              "expires_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "last_refresh": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "expired": {
                "type": "boolean"
              },
              "expiring_soon": {
                "type": "boolean",
                "description": "Expires within 7 days"
              }
            }
          },
          "activity": {
            "type": "object",
            "properties": {
              "last_published_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "failures_last_7d": {
                "type": "integer"
              },
              "permanent_failures_last_7d": {
                "type": "integer"
              },
              "queued_count": {
                "type": "integer"
              }
            }
          },
          "connected_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MediaStatus": {
        "type": "string",
        "description": "uploading until /complete is called; it never flips to ready on its own",
        "enum": [
          "uploading",
          "ready",
          "failed"
        ]
      },
      "MediaItem": {
        "type": "object",
        "description": "Media library item (listMedia shape)",
        "required": [
          "media_id",
          "media_status",
          "type",
          "created_at"
        ],
        "properties": {
          "media_id": {
            "type": "string",
            "format": "uuid"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "deprecated": true,
            "description": "Deprecated alias of media_id"
          },
          "media_status": {
            "$ref": "#/components/schemas/MediaStatus"
          },
          "type": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "document"
            ]
          },
          "mime_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "file_size": {
            "type": [
              "integer",
              "null"
            ],
            "deprecated": true
          },
          "file_size_bytes": {
            "type": [
              "integer",
              "null"
            ]
          },
          "original_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "dimensions": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "width": {
                "type": "integer"
              },
              "height": {
                "type": "integer"
              }
            }
          },
          "width": {
            "type": [
              "integer",
              "null"
            ]
          },
          "height": {
            "type": [
              "integer",
              "null"
            ]
          },
          "aspect_ratio": {
            "type": [
              "number",
              "null"
            ]
          },
          "orientation": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "portrait",
              "landscape",
              "square",
              null
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MediaDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/MediaItem"
          },
          {
            "type": "object",
            "description": "Additional fields on getMedia",
            "properties": {
              "duration_seconds": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Video duration (null for non-video)"
              },
              "url": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri",
                "description": "Permanent viewable URL (populated once ready)"
              },
              "thumbnail_url": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri"
              },
              "updated_at": {
                "type": "string",
                "format": "date-time"
              },
              "ready": {
                "type": "boolean"
              },
              "action_required": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "Next step when not ready (step=complete or step=reupload)",
                "properties": {
                  "step": {
                    "type": "string",
                    "enum": [
                      "complete",
                      "reupload"
                    ]
                  },
                  "method": {
                    "type": "string"
                  },
                  "endpoint": {
                    "type": "string"
                  },
                  "why": {
                    "type": "string"
                  }
                }
              },
              "message": {
                "type": "string"
              },
              "next_step": {
                "type": "string"
              }
            }
          }
        ]
      },
      "MediaUploadTicket": {
        "type": "object",
        "description": "initMediaUpload response: where and how to send the file bytes",
        "required": [
          "media_id",
          "media_status",
          "type",
          "upload_url",
          "upload_method",
          "expires_at"
        ],
        "properties": {
          "media_id": {
            "type": "string",
            "format": "uuid"
          },
          "media_ids": {
            "type": "array",
            "description": "Round-trip convenience: copy into createPost after /complete",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "media_status": {
            "type": "string",
            "const": "uploading"
          },
          "type": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "document"
            ]
          },
          "upload_url": {
            "type": "string",
            "format": "uri",
            "description": "Presigned URL to send the file to (Cloudflare Images for images, R2 for video/PDF)"
          },
          "upload_method": {
            "type": "object",
            "description": "Images: method POST, content_type multipart/form-data, field_name file. Video/PDF: method PUT with a Content-Type header set to the declared type.",
            "properties": {
              "method": {
                "type": "string",
                "enum": [
                  "POST",
                  "PUT"
                ]
              },
              "content_type": {
                "type": "string"
              },
              "field_name": {
                "type": "string"
              },
              "headers": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              }
            }
          },
          "provider": {
            "type": "string",
            "enum": [
              "images",
              "files"
            ]
          },
          "expires_in": {
            "type": "integer",
            "deprecated": true,
            "description": "Seconds (use expires_at)"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "max_size": {
            "type": "integer",
            "deprecated": true,
            "description": "Bytes (use max_size_bytes)"
          },
          "max_size_bytes": {
            "type": "integer"
          },
          "next_step": {
            "type": "string"
          },
          "complete_url": {
            "type": "string",
            "description": "Path to POST after uploading, e.g. /v1/media/ID/complete"
          }
        }
      },
      "MediaCompleted": {
        "type": "object",
        "description": "completeMediaUpload response",
        "required": [
          "media_id",
          "media_status",
          "type"
        ],
        "properties": {
          "media_id": {
            "type": "string",
            "format": "uuid"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "deprecated": true
          },
          "media_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "media_status": {
            "type": "string",
            "const": "ready"
          },
          "type": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "document"
            ]
          },
          "message": {
            "type": "string"
          },
          "next_step": {
            "type": "string"
          }
        }
      },
      "GeneratedImage": {
        "type": "object",
        "description": "generateImage response; the image is already in the media library",
        "required": [
          "media_id",
          "media_status",
          "type",
          "credits_used",
          "credits_remaining"
        ],
        "properties": {
          "media_id": {
            "type": "string",
            "format": "uuid"
          },
          "media_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "media_status": {
            "type": "string",
            "const": "ready"
          },
          "type": {
            "type": "string",
            "const": "image"
          },
          "mime_type": {
            "type": "string",
            "const": "image/png"
          },
          "dimensions": {
            "type": "object",
            "properties": {
              "width": {
                "type": "integer"
              },
              "height": {
                "type": "integer"
              }
            }
          },
          "width": {
            "type": "integer"
          },
          "height": {
            "type": "integer"
          },
          "aspect_ratio": {
            "type": "string"
          },
          "orientation": {
            "type": "string",
            "enum": [
              "portrait",
              "landscape",
              "square"
            ]
          },
          "file_size_bytes": {
            "type": "integer"
          },
          "ai": {
            "type": "object",
            "properties": {
              "model": {
                "type": "string"
              },
              "prompt": {
                "type": "string"
              },
              "aspect_ratio": {
                "type": "string"
              },
              "generation_time_ms": {
                "type": "integer"
              }
            }
          },
          "model": {
            "type": "string",
            "deprecated": true,
            "description": "Use ai.model"
          },
          "credits_used": {
            "type": "integer"
          },
          "credits_remaining": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "next_step": {
            "type": "string"
          }
        }
      },
      "AnalyticsSummary": {
        "type": "object",
        "required": [
          "period",
          "range",
          "posts",
          "by_platform",
          "metrics",
          "ai_credits"
        ],
        "properties": {
          "audience": {
            "type": "object",
            "description": "Followers per connected account in the organization (daily snapshots since 31 August 2026). change_in_period is null until there are two readings in the period.",
            "properties": {
              "total_followers": {
                "type": "integer"
              },
              "accounts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "social_account_id": {
                      "type": "integer"
                    },
                    "platform": {
                      "type": "string"
                    },
                    "account_name": {
                      "type": "string"
                    },
                    "followers": {
                      "type": "integer"
                    },
                    "change_in_period": {
                      "type": "integer",
                      "nullable": true
                    },
                    "days_measured": {
                      "type": "integer"
                    },
                    "captured_on": {
                      "type": "string"
                    }
                  }
                }
              },
              "accounts_without_follower_history": {
                "type": "array",
                "description": "Connected accounts with no follower reading yet. total_followers does not include them.",
                "items": {
                  "type": "object",
                  "properties": {
                    "social_account_id": {
                      "type": "integer"
                    },
                    "platform": {
                      "type": "string"
                    },
                    "account_name": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "period": {
            "type": "string",
            "enum": [
              "today",
              "week",
              "month",
              "all",
              "custom"
            ]
          },
          "range": {
            "type": "object",
            "properties": {
              "from": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "null for period=all"
              },
              "to": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "posts": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer"
              },
              "draft": {
                "type": "integer"
              },
              "scheduled": {
                "type": "integer"
              },
              "publishing": {
                "type": "integer"
              },
              "published": {
                "type": "integer"
              },
              "partially_failed": {
                "type": "integer"
              },
              "failed": {
                "type": "integer"
              }
            }
          },
          "by_platform": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "platform": {
                  "type": "string"
                },
                "total": {
                  "type": "integer"
                },
                "scheduled": {
                  "type": "integer"
                },
                "published": {
                  "type": "integer"
                },
                "failed": {
                  "type": "integer"
                }
              }
            }
          },
          "metrics": {
            "description": "Aggregate engagement for published destinations in the window. Coverage varies by platform because each social API returns a different subset. Views: YouTube, TikTok, Instagram, Threads, Pinterest, and Facebook video views. Impressions: Instagram, Threads, LinkedIn company pages, Pinterest, and X. Likes and comments: most platforms. Shares: Facebook, Threads, TikTok, LinkedIn, Bluesky, X, and Pinterest outbound clicks. Clicks: Facebook, LinkedIn, Pinterest. Some need extra permissions (Instagram and Facebook insights, Threads insights) or account types (LinkedIn company pages, Pinterest Business or Creator). X metrics fill only after an on-demand refresh. Telegram, Discord, WordPress and Google Business Profile report none. A metric with no reading on any published destination in the window is null here (not measured), and null on the individual destination too; a real 0 stays 0. See metrics_coverage. There is no reach metric. Follower counts are in audience. Full table: https://posteverywhere.ai/docs/analytics-summary",
            "type": "object",
            "properties": {
              "views": {
                "type": "integer",
                "nullable": true
              },
              "likes": {
                "type": "integer",
                "nullable": true
              },
              "comments": {
                "type": "integer",
                "nullable": true
              },
              "shares": {
                "type": "integer",
                "nullable": true
              },
              "impressions": {
                "type": "integer",
                "nullable": true
              },
              "clicks": {
                "type": "integer",
                "nullable": true
              }
            }
          },
          "ai_credits": {
            "type": "object",
            "properties": {
              "used_this_period": {
                "type": "integer"
              },
              "bonus": {
                "type": "integer"
              }
            }
          },
          "metrics_coverage": {
            "type": "object",
            "description": "How much of the engagement above was measured. not_measured_by_platform counts published destinations with no metrics yet, per platform (X fills only after an on-demand refresh).",
            "properties": {
              "published_destinations": {
                "type": "integer"
              },
              "measured_destinations": {
                "type": "integer"
              },
              "not_measured_by_platform": {
                "type": "object",
                "additionalProperties": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "Campaign": {
        "type": "object",
        "required": [
          "id",
          "name",
          "status",
          "post_count",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "color": {
            "type": [
              "string",
              "null"
            ],
            "description": "Hex color, e.g. #3b82f6"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "archived"
            ]
          },
          "post_count": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WebhookEventType": {
        "type": "string",
        "description": "Events you can subscribe to. These fire today: post.scheduled (a post was created in the app or through the API, to publish now or later, or a draft was scheduled), post.published, post.failed, post.partially_failed, post.warning, post.deleted, post.approval_requested, post.approved, post.changes_requested, account.disconnected, account.reconnect_needed, media.uploaded (a direct upload finished with POST /media/ID/complete; not sent for upload-from-url) and media.deleted. post.publishing, post.updated and account.connected are accepted but never sent yet.",
        "enum": [
          "post.scheduled",
          "post.publishing",
          "post.published",
          "post.failed",
          "post.partially_failed",
          "post.warning",
          "post.updated",
          "post.deleted",
          "account.connected",
          "account.disconnected",
          "account.reconnect_needed",
          "media.uploaded",
          "media.deleted",
          "post.approval_requested",
          "post.approved",
          "post.changes_requested"
        ]
      },
      "Webhook": {
        "type": "object",
        "required": [
          "id",
          "url",
          "events",
          "is_active",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEventType"
            }
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_active": {
            "type": "boolean"
          },
          "consecutive_failures": {
            "type": "integer"
          },
          "auto_disabled_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Set when repeated delivery failures auto-disabled the webhook"
          },
          "last_delivery_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_success_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_failure_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ConnectedAccountResult": {
        "type": "object",
        "required": [
          "status",
          "account"
        ],
        "properties": {
          "status": {
            "type": "string",
            "const": "completed"
          },
          "account": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "platform": {
                "type": "string"
              },
              "account_name": {
                "type": "string"
              },
              "avatar_url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "is_update": {
                "type": "boolean",
                "description": "true when an existing connection was refreshed rather than newly created"
              }
            }
          }
        }
      },
      "ConnectCompletedEnvelope": {
        "type": "object",
        "required": [
          "data",
          "error",
          "meta"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/ConnectedAccountResult"
          },
          "error": {
            "type": "null"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "Me": {
        "type": "object",
        "required": [
          "scopes",
          "user",
          "organization",
          "workspace",
          "quota",
          "stats"
        ],
        "properties": {
          "api_key": {
            "type": [
              "object",
              "null"
            ],
            "description": "null when authenticated via session cookie",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "key_prefix": {
                "type": "string"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "last_used_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "expires_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            }
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "read",
                "write",
                "ai"
              ]
            }
          },
          "user": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "email": {
                "type": "string"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "organization": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "subscription_plan": {
                "type": "string",
                "description": "Uppercased internal plan key: LITE, SOLO (display name Starter), STARTER (display name Growth), GROWTH (display name Scale) or TRIAL; PRO only on legacy organisations"
              },
              "subscription_status": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "subscription_source": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "trial_end": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "current_period_end": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "cancel_at_period_end": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "entitled": {
                "type": "boolean",
                "description": "true when subscription_status is active or trialing"
              }
            }
          },
          "workspace": {
            "type": "object",
            "properties": {
              "id": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "quota": {
            "type": "object",
            "properties": {
              "accounts": {
                "type": "object",
                "properties": {
                  "used": {
                    "type": "integer"
                  },
                  "limit": {
                    "type": "integer"
                  }
                }
              },
              "ai_credits": {
                "type": "object",
                "properties": {
                  "used": {
                    "type": "integer"
                  },
                  "limit": {
                    "type": "integer"
                  },
                  "bonus": {
                    "type": "integer"
                  }
                }
              },
              "storage_bytes": {
                "type": "object",
                "properties": {
                  "used": {
                    "type": "integer"
                  },
                  "limit": {
                    "type": "integer"
                  }
                }
              },
              "team_seats": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer"
                  }
                }
              }
            }
          },
          "stats": {
            "type": "object",
            "properties": {
              "posts_last_30d": {
                "type": "integer"
              },
              "total_posts": {
                "type": "integer"
              }
            }
          }
        }
      },
      "PlatformRule": {
        "type": "object",
        "description": "Composer rules for one platform",
        "required": [
          "characterLimit",
          "mediaTypes",
          "maxImages",
          "maxVideoBytes",
          "features"
        ],
        "properties": {
          "characterLimit": {
            "type": "integer"
          },
          "mediaTypes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "maxImages": {
            "type": "integer"
          },
          "maxVideoBytes": {
            "type": "integer"
          },
          "features": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "WordPress: blog_posts, featured_image, inline_images, tags, categories, post_status. Google Business Profile: local_posts, event_posts, offer_posts, call_to_action_button."
          },
          "blog": {
            "type": "object",
            "description": "WordPress only. The blog post fields (platform_content.wordpress), their limits and defaults.",
            "additionalProperties": true
          },
          "local_post": {
            "type": "object",
            "description": "Google Business Profile only. The post fields (platform_content.google_business), their limits and defaults.",
            "additionalProperties": true
          }
        }
      }
    }
  }
}
