{"openapi":"3.1.0","info":{"title":"Postgale Publishing API","version":"1.13.0","description":"Authenticate with `Authorization: Bearer sk_...`. Keys are rate limited (default 60 requests/minute). Every key acts for its organization only; ids of other organizations answer 404.\n\n**Approval.** Posts may be held for human approval (`pending_approval`) when enabled for the organization, an account or the API key (or connected app); approving is dashboard-only. While approval applies, agent actions are queued for a person instead of running: comment replies and moderation (create, reply, hide, delete, like), direct messages and WhatsApp sends, changes to published posts (edit, unpublish, comment settings), X engagement and starting X conversations answer **202** `{id, status: \"pending_approval\", kind, ...}` and nothing reaches the platform yet. A member then approves (the exact stored call runs, as your key), edits the text (the payload is re-hashed and needs approval again) or rejects it in the dashboard. Follow it with `GET /actions/{id}` or the `action.pending_approval`, `action.approved`, `action.rejected`, `action.executed` and `action.failed` webhooks; the executed action carries the operation's result. Retrying the same call while it is pending returns the same action (`replayed: true`). Validation, ownership and the messaging window are checked before queueing. Ads writes are still refused with 403 `approval_required`. Reads (and marking conversations read, archiving, syncing) are never gated.\n\n**Errors** are `{\"error\":{\"message\":\"...\",\"code\":\"...\"}}`. Codes: `missing_permission` (403: the account did not grant the Meta permission the feature needs; reconnect after the Meta app has it; no request is made to Meta), `approval_required` (403, ads writes while approval applies), `reconnect_required` (409: token invalid or account flagged needs_reconnect), `rate_limited` (429: platform rate limit), `not_supported` (400: the platform has no such feature), `invalid_request` (400: the platform rejected the parameters), `platform_error` (502: other platform failure), `pending_expired` (410), `outside_messaging_window` (409: the direct-message window is closed), `recipient_unavailable` (409: the person cannot receive messages from the account), `sync_required` (409: sync the account's conversations first). WhatsApp adds `template_error` (400: template name, language, parameters or status), `unsupported_message_type` (400), `recipient_not_allowed` (403: not in the test number's allowed list), `account_restricted` (403: WABA restricted or payment issue), `marketing_limit` (429), `phone_number_not_registered` (409: POST /whatsapp/accounts/{id}/register) and `invalid_token` (400: manual connect token refused). Post conflicts use 409 with codes such as `APPROVAL_REQUIRED` or `ALREADY_PUBLISHED`.\n\n**Platforms.** Instagram (Instagram API with Instagram Login), Facebook Pages (one account per Page, Facebook Login for Business), Threads, TikTok, X (X API v2 with OAuth 2.0; posts, threads, polls, media, replies, metrics and DMs; see /docs/x), Telegram (channels and groups through Postgale's bot, connected with a one-time /connect code; text, media and albums, edits and deletes; see /docs/telegram), Discord (Postgale's bot, installed in a server through OAuth2, one account per channel; text, attachments, embeds, polls, forum posts, threads, crossposts, edits and deletes, plus pins, roles, members, scheduled events and outbound DMs under /discord; see /docs/discord), Bluesky (AT Protocol, connected with the handle and an app password; posts, threads, replies, images, video, link cards, deletes, replies as comments, post engagement counts and text DMs; see /docs/bluesky), Mastodon (any server, OAuth with an app registered per server; statuses, media with alt text, content warnings, visibility, threads, deletes; see /docs/mastodon), LinkedIn (coming soon; OAuth for the member's profile and the organization pages they administer, one account each; text, images, video, documents, first comment, mentions, comments and reactions, analytics; see /docs/linkedin) and WhatsApp (Cloud API, one account per business phone number; messaging only, no posts). Without live credentials (`PROVIDER_LIVE_<PLATFORM>=1`) platforms run in mock mode with deterministic data. **Meta Ads** (`/ads/**`, tag Ads): spend-capable calls require `confirm: true` (else 400 `confirmation_required`) and create objects PAUSED unless `status: ACTIVE`; `PROVIDER_LIVE_ADS=1` enables live calls, otherwise a mock answers. Per-platform options go in `platforms[].platformSpecificData` (see the InstagramOptions, FacebookOptions, ThreadsOptions, XOptions, TikTokOptions, TelegramOptions, DiscordOptions, BlueskyOptions and MastodonOptions schemas).\n\n**Webhooks** (see the `webhooks` section): POST with body `{id, event, createdAt, data}`. Verify `X-SocialAPI-Signature` = hex HMAC-SHA256(secret, `${X-SocialAPI-Timestamp}.${rawBody}`) and reject timestamps older than 5 minutes. `X-Idempotency-Key` (= body id) is the original delivery id and stays the same across retries and manual redeliveries: deduplicate on it. `X-SocialAPI-Delivery` is the id of this attempt row, `X-SocialAPI-Event` the event name. Non-2xx answers are retried up to 6 attempts with exponential backoff (1, 2, 4, 8, 16 minutes). Events: post.published, post.failed, post.pending_approval, post.approved, post.rejected, action.pending_approval, action.approved, action.rejected, action.executed, action.failed, comment.received, mention.received, message.received, message.sent, message.read, message.delivered, message.reaction, message.status, message.edited, message.deleted, message.failed, reaction.received, template.status, template.quality, account.quality, account.connected, account.disconnected, connection.pending, phone_number.provisioned, phone_number.release_scheduled, phone_number.released, phone_number.failed, webhook.test (webhook.test only via POST /webhooks/{id}/test).\n\n**Inbound Meta webhooks** (operators): Meta calls `/api/webhooks/meta/{instagram|facebook|threads|whatsapp}` — GET verification handshake with META_WEBHOOK_VERIFY_TOKEN, POST signed with X-Hub-Signature-256 by the product's app secret. Matching comments and mentions become inbound events (GET /inbox/events) and comment.received / mention.received webhooks. Direct messages (`messaging[]` events and messaging fields) become inbound events of kind `message`, are stored as conversations and messages (GET /inbox/conversations) and are emitted as message.received / message.sent / message.read / message.delivered / message.reaction.\n\n**Direct messages** (tag Messages): Instagram (`instagram_business_manage_messages`) and Facebook Page Messenger (`pages_messaging`) conversations. Meta only lets a business reply to someone who wrote first: free-form messages within 24 hours of the participant's last message, tag `HUMAN_AGENT` (a human reply; needs Meta's Human Agent permission) within 7 days. Outside the window sending answers 409 `outside_messaging_window` before anything is sent to Meta; each conversation reports its `messagingWindow`. Sending is a live message to a real person.\n\n**WhatsApp** (tag WhatsApp): connect a number with Embedded Signup (`GET /connect/whatsapp` returns a Postgale page that runs Meta's signup) or manually with a token (`POST /whatsapp/connect`). Send text, media, templates, interactive messages, locations and reactions with `POST /whatsapp/accounts/{id}/messages` (or `POST /inbox/conversations/{id}/messages`). Free-form messages are only allowed within 24 hours of the person's last message; templates are always allowed (409 `outside_messaging_window` otherwise, before calling Meta). Statuses arrive as message.status; templates as template.status / template.quality; the number's quality as account.quality.\n\n**WhatsApp numbers** (tag WhatsApp; only when the instance sets `WHATSAPP_NUMBERS_ENABLED=1`, otherwise 403 `numbers_disabled`): `GET /whatsapp/numbers/available`, then `POST /whatsapp/numbers` buys a number from the carrier (Telnyx or Twilio), adds it to the WABA of a connected WhatsApp account, captures the voice verification code and connects it as a new WhatsApp account. Per-organization limit (403 `number_limit_reached`); numbers without production messages for 30 days are released (`phone_number.release_scheduled` 3 days before, then `phone_number.released`), failed ones after `WHATSAPP_NUMBERS_FAILED_RELEASE_DAYS` (7). Buying, retrying and releasing (and deleting a template) are queued for approval (202) while approval applies; registering a number is refused (403 `approval_required`).\n\nAI agents can use the same operations through the hosted MCP server at /mcp (Streamable HTTP, same Bearer key); see /docs/mcp and /docs/api."},"servers":[{"url":"/api/v1"}],"security":[{"BearerAuth":[]}],"tags":[{"name":"Accounts"},{"name":"Connect"},{"name":"Media"},{"name":"Posts"},{"name":"Published posts"},{"name":"Comments"},{"name":"Messages"},{"name":"Approvals"},{"name":"WhatsApp"},{"name":"Telegram"},{"name":"TikTok"},{"name":"X","description":"Coming soon: X (Twitter) is not available yet and X accounts cannot be connected in production."},{"name":"Ads"},{"name":"Analytics"},{"name":"Webhooks"},{"name":"Dashboard"},{"name":"Inbound"},{"name":"Meta"},{"name":"Broadcasts"},{"name":"Contacts"},{"name":"Discord","description":"Postgale's Discord bot: channels and settings, pins, roles, members, scheduled events, threads, crossposts and outbound DMs (see /docs/discord)"},{"name":"LinkedIn","description":"Coming soon: LinkedIn accounts only connect where the LinkedIn provider is live (PROVIDER_LIVE_LINKEDIN with LinkedIn app credentials)."}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key sk_..."},"SessionCookie":{"type":"apiKey","in":"cookie","name":"session","description":"Dashboard session"}},"schemas":{"XPost":{"type":"object","properties":{"id":{"type":"string"},"text":{"type":"string"},"username":{"type":"string"},"authorId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"parentId":{"type":"string","description":"Post replied to"},"conversationId":{"type":"string"},"url":{"type":"string"},"metrics":{"type":"object","properties":{"impressions":{"type":"integer"},"likes":{"type":"integer"},"replies":{"type":"integer"},"reposts":{"type":"integer"},"quotes":{"type":"integer"},"bookmarks":{"type":"integer"}}},"platform":{"type":"string","enum":["x"]}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","description":"Machine-readable code, when there is one","enum":["confirmation_required","missing_permission","approval_required","reconnect_required","rate_limited","not_supported","invalid_request","platform_error","pending_expired","outside_messaging_window","recipient_unavailable","sync_required","recipient_not_allowed","template_error","unsupported_message_type","marketing_limit","phone_number_not_registered","account_restricted","invalid_token","numbers_disabled","numbers_unavailable","number_limit_reached","number_unavailable","number_busy","not_failed","carrier_error","APPROVAL_REQUIRED","APPROVAL_HASH_MISMATCH","REJECTED","ALREADY_PUBLISHING","ALREADY_PUBLISHED","NOT_EDITABLE","NOT_PENDING_APPROVAL","invalid_state","no_recipients","language_required","calling_disabled","call_permission_required","outbound_calling_unavailable","not_ad_originated","phone_number_unknown","sandbox_unavailable"]}},"required":["message"]}},"required":["error"]},"InstagramOptions":{"type":"object","properties":{"mediaUrl":{"type":"string","description":"Public https URL of the image (JPEG) or video; e.g. an uploaded media publicUrl"},"mediaUrls":{"type":"array","items":{"type":"string"},"description":"CAROUSEL: 2-20 public https URLs (images and/or videos)"},"mediaKinds":{"type":"array","items":{"type":"string","enum":["image","video"]},"description":"image or video per URL, aligned with mediaUrls (default: the file extension, else the uploaded media type). Needed for URLs without an extension that are not Postgale uploads"},"mediaType":{"type":"string","description":"Default: CAROUSEL for several URLs, REELS for .mp4/.mov, else IMAGE. VIDEO is published as a Reel","enum":["IMAGE","VIDEO","REELS","STORIES","CAROUSEL"]},"contentType":{"type":"string","description":"Alias of mediaType","enum":["feed","reel","story","carousel"]},"firstComment":{"type":"string","description":"Comment posted right after publishing (not stories). Needs instagram_business_manage_comments; a failure is only a warning","maxLength":2200},"collaborators":{"type":"array","items":{"type":"string"},"description":"Up to 3 usernames (leading @ stripped); not stories"},"userTags":{"type":"array","items":{"type":"object","properties":{"username":{"type":"string"},"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1},"mediaIndex":{"type":"integer","minimum":0,"description":"Carousel item (default 0)"}},"required":["username"]},"description":"People tags. Photos need x and y in [0,1] (tags without them are skipped with a warning); videos only the username; not stories"},"locationId":{"type":"string","description":"Location page id; not stories"},"altText":{"type":"string","description":"Alt text of a single image","maxLength":1000},"altTexts":{"type":"array","items":{"type":"string","maxLength":1000},"description":"Carousel: alt text per item, aligned with mediaUrls (images only)"},"shareToFeed":{"type":"boolean","description":"Reels: also show in the main feed"},"thumbOffset":{"type":"integer","minimum":0,"description":"Reels: cover frame offset in milliseconds"},"coverUrl":{"type":"string","description":"Reels: public https cover image URL"},"audioName":{"type":"string","description":"Reels: audio track name"},"trialParams":{"type":"object","properties":{"graduationStrategy":{"type":"string","enum":["MANUAL","SS_PERFORMANCE"]}},"required":["graduationStrategy"],"description":"Reels only: trial reel (shown to non-followers first)"},"commentsEnabled":{"type":"boolean","description":"false turns comments off right after publishing"}},"title":"Instagram","description":"Caption = post content (max 2200 characters, 30 hashtags, 20 @ tags). One URL unless CAROUSEL. Stories take no caption, firstComment, collaborators or location. 100 API-published posts per 24 hours (see /accounts/{id}/publishing-limit)."},"FacebookOptions":{"type":"object","properties":{"contentType":{"type":"string","description":"Default feed","enum":["feed","reel","story"]},"mediaUrl":{"type":"string","description":"Public https URL of one photo or video"},"mediaUrls":{"type":"array","items":{"type":"string"},"description":"Feed: 2-10 photos (no videos) in one post"},"mediaType":{"type":"string","description":"Overrides detection from the URL extension","enum":["IMAGE","VIDEO"]},"link":{"type":"string","description":"Text posts without media: https link to share"},"title":{"type":"string","description":"Videos and reels: title","maxLength":255},"firstComment":{"type":"string","description":"Feed posts and reels (not stories): comment posted after publishing; a failure is only a warning","maxLength":8000},"draft":{"type":"boolean","description":"Text, link or multi-photo feed posts: create an unpublished draft on the Page (unverified Meta behaviour)"}},"title":"Facebook Pages","description":"Message = post content (max 63206 characters). Reels need exactly one video; stories one photo or video and no text. Videos and reels finish processing asynchronously (target stays publishing until ready)."},"ThreadsOptions":{"type":"object","properties":{"mediaUrl":{"type":"string","description":"Public https URL of one image or video"},"mediaUrls":{"type":"array","items":{"type":"string"},"description":"CAROUSEL: 2-20 public https URLs"},"mediaKinds":{"type":"array","items":{"type":"string","enum":["image","video"]},"description":"image or video per URL, aligned with mediaUrls (default: the file extension, else the uploaded media type)"},"mediaType":{"type":"string","description":"Default: detected from the media","enum":["TEXT","IMAGE","VIDEO","CAROUSEL"]},"topicTag":{"type":"string","description":"Topic tag, 1-50 characters, no \".\" or \"&\" (alias topic_tag)","minLength":1,"maxLength":50},"replyControl":{"type":"string","description":"Who can reply","enum":["everyone","accounts_you_follow","mentioned_only","parent_post_author_only","followers_only"]},"altText":{"type":"string","description":"Image/video alt text (unverified Meta behaviour)","maxLength":1000},"altTexts":{"type":"array","items":{"type":"string","maxLength":1000},"description":"Carousel alt texts aligned with mediaUrls"},"linkAttachment":{"type":"string","description":"Text posts only: https URL shown as a link preview (unverified Meta behaviour)"},"firstComment":{"type":"string","description":"Published as a reply to the root post afterwards","maxLength":500},"threadItems":{"type":"array","items":{"type":"object","properties":{"content":{"type":"string","maxLength":500},"mediaUrl":{"type":"string"},"mediaUrls":{"type":"array","items":{"type":"string"}},"mediaKinds":{"type":"array","items":{"type":"string","enum":["image","video"]}},"mediaType":{"type":"string","enum":["TEXT","IMAGE","VIDEO","CAROUSEL"]},"altText":{"type":"string"},"altTexts":{"type":"array","items":{"type":"string"}}}},"description":"Reply chain of 1-20 items: item 0 is the root (the post content is then not published separately), each next item replies to the previous one. platformPostId is the root id"}},"title":"Threads","description":"Text max 500 characters (each emoji counts its UTF-8 bytes) and 5 links. 250 posts and 1000 replies per 24 hours (checked before publishing; a chain uses one post plus a reply per further item)."},"XOptions":{"type":"object","properties":{"customContent":{"type":"string","description":"Text used for X instead of the post content"},"mediaUrl":{"type":"string","description":"Public https URL of one image, GIF or video"},"mediaUrls":{"type":"array","items":{"type":"string"},"description":"Up to 4 images (a GIF or a video must be alone)"},"mediaType":{"type":"string","description":"Default: from the URL extension","enum":["text","image","gif","video"]},"altText":{"type":"string","description":"Alt text of the first image (≤1000)"},"altTexts":{"type":"array","items":{"type":"string"},"description":"Alt text per image, aligned with mediaUrls"},"threadItems":{"type":"array","items":{"type":"object","properties":{"content":{"type":"string"},"mediaUrl":{"type":"string"},"mediaUrls":{"type":"array","items":{"type":"string"}},"mediaType":{"type":"string"},"altText":{"type":"string"},"altTexts":{"type":"array","items":{"type":"string"}}},"required":["content"]},"description":"A thread (≤25 posts) published as a reply chain; replaces the post content"},"replyToTweetId":{"type":"string","description":"Post id or URL to reply to (X only allows API replies when its author mentioned or quoted the account)"},"quoteTweetId":{"type":"string","description":"Post id or URL to quote (not with media or a poll)"},"replySettings":{"type":"string","description":"Who can reply (default everyone)","enum":["following","mentionedUsers","subscribers","verified"]},"poll":{"type":"object","properties":{"options":{"type":"array","items":{"type":"string","maxLength":25},"description":"2-4 options"},"duration_minutes":{"type":"integer","minimum":5,"maximum":10080,"default":1440}},"required":["options"]},"longVideo":{"type":"boolean","description":"Upload as amplify_video (long videos, eligible accounts)"},"geoRestriction":{"type":"object","properties":{"countries":{"type":"array","items":{"type":"string"},"description":"1-25 ISO 3166-1 alpha-2 codes"}},"required":["countries"]},"paidPartnership":{"type":"boolean"},"madeWithAi":{"type":"boolean"},"sensitiveMedia":{"type":"object","properties":{"adultContent":{"type":"boolean"},"graphicViolence":{"type":"boolean"},"other":{"type":"boolean"}}}},"title":"X","description":"Text up to 280 weighted characters (URLs count 23, emoji 2; 25,000 for X Premium accounts). Media: up to 4 images (5 MB), or 1 GIF (15 MB), or 1 video (512 MB). Videos still processing leave the target publishing until the worker finishes it."},"TikTokOptions":{"type":"object","properties":{"privacyLevel":{"type":"string","description":"Required for direct posts; one of the creator's levels from GET /accounts/{id}/tiktok/creator-info (SELF_ONLY until the app is audited). Not needed with draft","enum":["PUBLIC_TO_EVERYONE","MUTUAL_FOLLOW_FRIENDS","FOLLOWER_OF_CREATOR","SELF_ONLY"]},"draft":{"type":"boolean","description":"Send to the creator's TikTok inbox (Creator Inbox draft, needs video.upload) instead of posting; the creator finishes and posts it in the TikTok app. The target is published once TikTok delivers it to the inbox (warning notes it)"},"mediaUrl":{"type":"string","description":"The video: public https URL (e.g. an uploaded media publicUrl). One video per post"},"mediaUrls":{"type":"array","items":{"type":"string"},"description":"Photo carousel: 1-35 JPEG or WebP image URLs under a verified URL prefix"},"mediaType":{"type":"string","description":"video (default) or photo/image for a photo carousel","enum":["video","photo","image"]},"title":{"type":"string","description":"Photo posts: title (max 90; defaults to content)"},"description":{"type":"string","description":"Photo posts: long caption (max 4000; defaults to content)"},"allowComment":{"type":"boolean","description":"Allow comments. Interactions are off unless true, and off when the creator disabled them (disableComment: false is equivalent)"},"allowDuet":{"type":"boolean","description":"Videos: allow duets (default off)"},"allowStitch":{"type":"boolean","description":"Videos: allow stitches (default off)"},"disableComment":{"type":"boolean","description":"Legacy inverse of allowComment"},"disableDuet":{"type":"boolean","description":"Legacy inverse of allowDuet"},"disableStitch":{"type":"boolean","description":"Legacy inverse of allowStitch"},"commercialContentType":{"type":"string","description":"Commercial content disclosure: brand_organic (your own brand) or brand_content (paid partnership, not with SELF_ONLY)","enum":["none","brand_organic","brand_content"]},"brandContent":{"type":"boolean","description":"Paid partnership (not with SELF_ONLY)"},"brandOrganic":{"type":"boolean","description":"Promotes the creator's own business"},"autoAddMusic":{"type":"boolean","description":"Photo posts: let TikTok add music"},"photoCoverIndex":{"type":"integer","minimum":0,"maximum":34,"description":"Photo posts: cover image index (default 0)"},"videoCoverTimestampMs":{"type":"integer","minimum":0,"description":"Videos: cover frame in milliseconds"},"isAigc":{"type":"boolean","description":"Videos: AI-generated content disclosure"},"uploadMode":{"type":"string","description":"Videos: PULL_FROM_URL (TikTok downloads mediaUrl; its domain or URL prefix must be verified for the app) or FILE_UPLOAD (Postgale uploads the file in 5-64 MB chunks). Default: PULL_FROM_URL when the URL is under TIKTOK_VERIFIED_URL_PREFIXES (or none are configured), else FILE_UPLOAD. Photos are always PULL_FROM_URL","enum":["PULL_FROM_URL","FILE_UPLOAD"]},"tiktokSettings":{"type":"object","description":"The same options in Zernio's form (snake_case accepted: privacy_level, allow_comment, allow_duet, allow_stitch, draft, media_type, photo_cover_index, description, auto_add_music, video_cover_timestamp_ms, video_made_with_ai, commercialContentType, content_preview_confirmed, express_consent_given); keys here win"}},"title":"TikTok","description":"Video caption = post content (max 2200). Publishing is asynchronous: the target stays publishing until status/fetch reports PUBLISH_COMPLETE (public posts get the TikTok video id and URL; SELF_ONLY posts keep the publish_id). Unaudited apps: SELF_ONLY only, private TikTok accounts, at most 5 posting creators per 24 hours."},"TelegramOptions":{"type":"object","properties":{"mediaUrl":{"type":"string","description":"One photo, video or document: public https URL (e.g. an uploaded media publicUrl). Postgale uploads the file to Telegram"},"mediaUrls":{"type":"array","items":{"type":"string"},"description":"An album of 2-10 items (sendMediaGroup); photos and videos can be mixed, documents only with documents. One URL = a single media post"},"mediaType":{"type":"string","description":"Default: from the URL extension (jpg/png/webp photo, mp4/mov video, anything else document)","enum":["text","photo","image","video","document"]},"parseMode":{"type":"string","description":"Format the text or caption; default plain text. Edits reuse it","enum":["MarkdownV2","HTML"]},"disableNotification":{"type":"boolean","description":"Deliver silently"},"disableLinkPreview":{"type":"boolean","description":"Text posts: no link preview"}},"title":"Telegram","description":"The post content is the message (max 4096 characters) or, with media, the caption of the photo, video, document or the first album item (max 1024), counted after parseMode markup. Files are uploaded by Postgale: photos up to 10 MB, videos and documents up to 50 MB. platformPostId is text:<message_id>, media:<message_id> or group:<id>.<id>…; url is the t.me link (public chats, or t.me/c/... for private supergroups and channels)."},"DiscordOptions":{"type":"object","properties":{"mediaUrl":{"type":"string","description":"One attachment: public https URL (e.g. an uploaded media publicUrl). Postgale uploads the file to Discord"},"mediaUrls":{"type":"array","maxItems":10,"items":{"type":"string"},"description":"Up to 10 attachments (any file type), uploaded as multipart files"},"embeds":{"type":"array","maxItems":10,"items":{"type":"object","properties":{"title":{"type":"string","maxLength":256},"description":{"type":"string","maxLength":4096},"url":{"type":"string","description":"https URL"},"color":{"type":"integer","minimum":0,"maximum":16777215,"description":"0xRRGGBB"},"timestamp":{"type":"string","format":"date-time"},"footer":{"type":"object","properties":{"text":{"type":"string","maxLength":2048},"icon_url":{"type":"string"}},"required":["text"]},"image":{"type":"object","properties":{"url":{"type":"string","description":"https URL or attachment://<file name>"}},"required":["url"]},"thumbnail":{"type":"object","properties":{"url":{"type":"string","description":"https URL or attachment://<file name>"}},"required":["url"]},"author":{"type":"object","properties":{"name":{"type":"string","maxLength":256},"url":{"type":"string"},"icon_url":{"type":"string"}},"required":["name"]},"fields":{"type":"array","maxItems":25,"items":{"type":"object","properties":{"name":{"type":"string","maxLength":256},"value":{"type":"string","maxLength":1024},"inline":{"type":"boolean"}},"required":["name","value"]}}},"description":"Discord's embed object (the keys a webhook may set; unknown keys are refused). Needs at least one of title, description, fields, image, thumbnail, author, footer"},"description":"Up to 10 embeds, 6000 characters in all"},"username":{"type":"string","description":"Post under this name instead of the webhook's (1-80 characters, cannot contain \"discord\" or \"clyde\")","maxLength":80},"avatarUrl":{"type":"string","description":"https URL of the avatar to post with"},"silent":{"type":"boolean","description":"No push notification (@silent)"},"mentionEveryone":{"type":"boolean","description":"Let @everyone and @here in the text ping (default false; user and role mentions always ping)"},"channelId":{"type":"string","description":"The account's channel id (optional check: each account posts to its own channel)"},"tts":{"type":"boolean","description":"Text-to-speech message"},"webhookUsername":{"type":"string","description":"Same as username (Zernio's name). Overrides the account default (PATCH /accounts/{id}/discord-settings)","maxLength":80},"webhookAvatarUrl":{"type":"string","description":"Same as avatarUrl (Zernio's name)"},"poll":{"type":"object","properties":{"question":{"type":"object","properties":{"text":{"type":"string","maxLength":300}},"required":["text"]},"answers":{"type":"array","minItems":1,"maxItems":10,"items":{"type":"object","properties":{"poll_media":{"type":"object","properties":{"text":{"type":"string","maxLength":55},"emoji":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}}},"required":["text"]}},"required":["poll_media"]}},"duration":{"type":"integer","minimum":1,"maximum":768,"default":24,"description":"Hours"},"allow_multiselect":{"type":"boolean","default":false}},"required":["question","answers"],"description":"A native poll. Cannot carry attachments"},"forumThreadName":{"type":"string","description":"Forum channels (required there): the forum post title; content is the starter message","maxLength":100},"forumAppliedTags":{"type":"array","maxItems":5,"items":{"type":"string"},"description":"Forum tag ids (read them from the forum channel's settings in Discord)"},"threadFromMessage":{"type":"object","properties":{"name":{"type":"string","maxLength":100},"autoArchiveDuration":{"type":"integer","enum":[60,1440,4320,10080],"description":"Minutes"},"rateLimitPerUser":{"type":"integer","minimum":0,"maximum":21600,"description":"Slow mode, seconds"}},"required":["name"],"description":"Open a public thread under the published message (bot-connected channels; a failure is a warning)"},"crosspost":{"type":"boolean","description":"Announcement channels: publish to every following server (no-op on other channels; a failure is a warning)"}},"title":"Discord","description":"The post content is the message (max 2000 characters). Files are uploaded by Postgale: up to 10 MB per file and 25 MB per message. platformPostId is the Discord message id; url is the discord.com/channels link. A message needs content, an attachment, an embed or a poll."},"BlueskyOptions":{"type":"object","properties":{"mediaUrl":{"type":"string","description":"One image or one MP4 video: public https URL (e.g. an uploaded media publicUrl). Postgale uploads it as a blob"},"mediaUrls":{"type":"array","maxItems":4,"items":{"type":"string"},"description":"Up to 4 images (JPEG, PNG, WebP, GIF; ≤1,000,000 bytes each) or one MP4 video (≤100 MB, ≤3 minutes); images and video cannot be mixed"},"mediaType":{"type":"string","description":"Default: from the URL extension (.mp4 video, otherwise image)","enum":["text","image","video"]},"altText":{"type":"string","description":"Alt text of the image or video","maxLength":2000},"altTexts":{"type":"array","items":{"type":"string","maxLength":2000},"description":"Alt text per image, in order"},"threadItems":{"type":"array","minItems":1,"maxItems":25,"items":{"type":"object","properties":{"content":{"type":"string"},"mediaUrl":{"type":"string"},"mediaUrls":{"type":"array","items":{"type":"string"}},"altText":{"type":"string"},"altTexts":{"type":"array","items":{"type":"string"}}},"description":"One post of the thread (≤300 graphemes, same media rules)"},"description":"A thread: each item replies to the previous one; replaces the post text"},"replyTo":{"type":"string","description":"Reply to this post: at://did/app.bsky.feed.post/rkey or a https://bsky.app/profile/<handle>/post/<id> link"},"langs":{"type":"array","maxItems":3,"items":{"type":"string"},"description":"Language tags, e.g. [\"en\"]; default: the account's defaultLangs (GET/PATCH /accounts/{id}/bluesky-settings)"},"disableLinkPreview":{"type":"boolean","description":"No link card for the first link"}},"title":"Bluesky","description":"The post content is the text, up to 300 graphemes (an emoji counts once). Links, @mentions (resolved to DIDs; unknown handles stay plain text) and #hashtags become facets. Without media the first link gets a link card (best effort). platformPostId is the post's at:// URI; url the bsky.app link. Bluesky posts cannot be edited."},"MastodonOptions":{"type":"object","properties":{"mediaUrl":{"type":"string","description":"One attachment: public https URL (e.g. an uploaded media publicUrl). Postgale uploads it"},"mediaUrls":{"type":"array","items":{"type":"string"},"description":"Attachments: up to the server's maximum (default 4) images, or one video or audio file. Size limits are the server's"},"altText":{"type":"string","description":"Alt text (description) of the attachment","maxLength":1500},"altTexts":{"type":"array","items":{"type":"string","maxLength":1500},"description":"Alt text per attachment, in order"},"visibility":{"type":"string","description":"Who sees the status (default public)","enum":["public","unlisted","private","direct"]},"spoilerText":{"type":"string","description":"Content warning shown before the text (counts toward the limit; media is marked sensitive)"},"sensitive":{"type":"boolean","description":"Mark the media sensitive"},"language":{"type":"string","description":"ISO 639 code of the text, e.g. en"},"threadItems":{"type":"array","minItems":1,"maxItems":25,"items":{"type":"object","properties":{"content":{"type":"string"},"mediaUrl":{"type":"string"},"mediaUrls":{"type":"array","items":{"type":"string"}},"altText":{"type":"string"},"altTexts":{"type":"array","items":{"type":"string"}}},"description":"One status of the thread (same limits)"},"description":"A thread: each item replies to the previous one with the same visibility; replaces the post text"},"inReplyToId":{"type":"string","description":"Reply to this status id on the account's server"}},"title":"Mastodon","description":"The post content is the status text, up to the server's max_characters (default 500; links count 23, @user@server counts as @user, the content warning counts too). Media is uploaded with its alt text and the status is posted once the server has processed it; each status is sent with an Idempotency-Key. platformPostId is the status id; url its link on the server."},"BlueskyConnect":{"type":"object","properties":{"platform":{"type":"string","enum":["bluesky"]},"account":{"$ref":"#/components/schemas/ConnectedAccount"}},"required":["platform","account"],"description":"Bluesky connects right away: the connected account"},"TelegramConnect":{"type":"object","properties":{"platform":{"type":"string","enum":["telegram"]},"code":{"type":"string","description":"One-time code (10 characters, single use)"},"command":{"type":"string","description":"What to post in the chat: /connect <code>"},"botUsername":{"type":"string","description":"Postgale's bot, without @"},"botUrl":{"type":"string"},"instructions":{"type":"array","items":{"type":"string"},"description":"Steps to show the person who runs the chat"},"expiresAt":{"type":"string","format":"date-time"},"expiresInSeconds":{"type":"integer"},"mock":{"type":"boolean","description":"Mock mode: no real bot"}}},"Target":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id"},"platform":{"type":"string","description":"Optional; must match the account","enum":["instagram","tiktok","x","linkedin","facebook","threads","whatsapp","telegram","discord","bluesky","mastodon"]},"platformSpecificData":{"description":"Options for the account's platform; keys for other platforms are ignored","anyOf":[{"$ref":"#/components/schemas/InstagramOptions"},{"$ref":"#/components/schemas/FacebookOptions"},{"$ref":"#/components/schemas/ThreadsOptions"},{"$ref":"#/components/schemas/XOptions"},{"$ref":"#/components/schemas/TikTokOptions"},{"$ref":"#/components/schemas/TelegramOptions"},{"$ref":"#/components/schemas/DiscordOptions"},{"$ref":"#/components/schemas/BlueskyOptions"},{"$ref":"#/components/schemas/MastodonOptions"},{"$ref":"#/components/schemas/LinkedInOptions"}]}},"required":["accountId"]},"Account":{"type":"object","properties":{"id":{"type":"string"},"platform":{"type":"string","enum":["instagram","tiktok","x","linkedin","facebook","threads","whatsapp","telegram","discord","bluesky","mastodon"]},"accountName":{"type":"string"},"platformAccountId":{"type":"string","description":"Platform id: IG professional account id, Facebook Page id, Threads user id..."},"requireApproval":{"type":"boolean"},"externalId":{"type":["string","null"],"maxLength":200,"description":"Your own reference for the account"},"status":{"type":"string","description":"needs_reconnect after the platform rejected the token (account.disconnected is emitted)","enum":["active","needs_reconnect"]},"lastError":{"type":["string","null"]},"tokenExpiresAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"}}},"PublishingLimit":{"type":"object","properties":{"quotaUsage":{"type":"integer"},"quotaTotal":{"type":"integer","description":"Instagram 100, Threads 250"},"windowSeconds":{"type":"integer"},"replyQuotaUsage":{"type":"integer","description":"Threads"},"replyQuotaTotal":{"type":"integer","description":"Threads (1000)"}}},"AccountHealth":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string"},"accountName":{"type":"string"},"externalId":{"type":["string","null"]},"status":{"type":"string","enum":["active","needs_reconnect"]},"lastError":{"type":["string","null"]},"tokenValid":{"type":"boolean"},"tokenExpiresAt":{"type":["string","null"],"format":"date-time"},"expiresInDays":{"type":["integer","null"]},"scopes":{"type":["array","null"],"items":{"type":"string"},"description":"Granted permissions; null when unknown"},"scopesAssumed":{"type":"boolean","description":"Threads does not report granted scopes; the requested ones are assumed"},"missingPermissions":{"type":"array","items":{"type":"object","properties":{"permission":{"type":"string"},"features":{"type":"array","items":{"type":"string"}}}},"description":"Permissions not granted and the features they block"},"publishingLimit":{"$ref":"#/components/schemas/PublishingLimit"},"profile":{"type":"object","description":"Platform profile (username, followers...)"},"error":{"type":"object","properties":{"category":{"type":"string","enum":["auth","permission","rate_limit","invalid","transient","other"]},"message":{"type":"string"}}},"recommendations":{"type":"array","items":{"type":"string"}},"checkedAt":{"type":"string","format":"date-time"},"cached":{"type":"boolean"}}},"PendingConnection":{"type":"object","properties":{"id":{"type":"string","description":"64 hex characters"},"platform":{"type":"string"},"kind":{"type":"string","description":"e.g. facebook_page"},"externalId":{"type":["string","null"]},"expiresAt":{"type":"string","format":"date-time"},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Option id (e.g. Page id)"},"name":{"type":"string"},"category":{"type":"string"},"pictureUrl":{"type":"string"},"tasks":{"type":"array","items":{"type":"string"}}}}}}},"ConnectedAccount":{"type":"object","properties":{"id":{"type":"string"},"platform":{"type":"string"},"accountName":{"type":"string"},"platformAccountId":{"type":"string"},"externalId":{"type":["string","null"]}}},"Media":{"type":"object","properties":{"id":{"type":"string"},"postId":{"type":["string","null"]},"fileName":{"type":"string"},"mimeType":{"type":"string"},"size":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"publicUrl":{"type":["string","null"],"description":"Public https URL when object storage is configured. Pass it as platformSpecificData.mediaUrl/mediaUrls."}}},"NewPost":{"type":"object","properties":{"content":{"type":"string","maxLength":40000},"platforms":{"type":"array","minItems":1,"maxItems":20,"items":{"$ref":"#/components/schemas/Target"}},"scheduledFor":{"type":"string","description":"ISO 8601 with time zone","format":"date-time"},"publishNow":{"type":"boolean","description":"Publish live now (subject to approval). Without publishNow or scheduledFor the post is a draft"}},"required":["content","platforms"]},"PostTarget":{"type":"object","properties":{"id":{"type":"string"},"accountId":{"type":"string"},"platform":{"type":"string"},"status":{"type":"string","enum":["pending","publishing","published","failed"]},"platformPostId":{"type":["string","null"]},"url":{"type":["string","null"]},"error":{"type":["string","null"]},"attempts":{"type":"integer"},"platformSpecificData":{"type":["string","null"],"description":"JSON of the options"},"publishedAt":{"type":["string","null"],"format":"date-time"},"extra":{"type":["string","null"],"description":"JSON: {warnings[], firstCommentId?, afterPublishDone?, unpublishedAt?}"},"metrics":{"type":["string","null"],"description":"JSON of the latest insights"},"metricsAt":{"type":["string","null"],"format":"date-time"}}},"Profile":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"color":{"type":["string","null"]},"timezone":{"type":["string","null"]},"externalId":{"type":["string","null"]},"isDefault":{"type":"boolean"},"accountCount":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}},"AccountGroup":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"accountIds":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}},"Post":{"type":"object","properties":{"id":{"type":"string"},"content":{"type":"string"},"status":{"type":"string","enum":["draft","scheduled","pending_approval","queued","publishing","published","partial","failed","rejected"]},"scheduledFor":{"type":["string","null"],"format":"date-time"},"targets":{"type":"array","items":{"$ref":"#/components/schemas/PostTarget"}}}},"TargetResult":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string"},"platformPostId":{"type":"string"},"ok":{"type":"boolean"},"code":{"type":"string"},"error":{"type":"string"}}},"Comment":{"type":"object","properties":{"id":{"type":"string"},"text":{"type":"string"},"username":{"type":"string"},"authorId":{"type":"string"},"timestamp":{"type":"string"},"likeCount":{"type":"integer"},"replyCount":{"type":"integer"},"hidden":{"type":"boolean"},"parentId":{"type":"string","description":"Set on replies"},"platform":{"type":"string"},"accountId":{"type":"string"},"platformPostId":{"type":"string"},"cid":{"type":"string","description":"Bluesky: content id, needed to like the comment"},"likeUri":{"type":"string","description":"Bluesky: the account's like of the comment (pass it to unlike)"}},"required":["id","text","platform"]},"Mention":{"type":"object","properties":{"id":{"type":"string"},"caption":{"type":"string"},"mediaType":{"type":"string"},"mediaUrl":{"type":"string"},"permalink":{"type":"string"},"timestamp":{"type":"string"},"username":{"type":"string"}}},"InsightSeries":{"type":"object","properties":{"name":{"type":"string"},"period":{"type":"string"},"title":{"type":"string"},"total":{"type":"number"},"values":{"type":"array","items":{"type":"object","properties":{"value":{},"endTime":{"type":"string"}}}},"breakdowns":{}},"required":["name"]},"BestTimeSlot":{"type":"object","properties":{"dayOfWeek":{"type":["integer","null"],"minimum":0,"maximum":6,"description":"0 = Sunday (UTC); null for online_followers slots"},"hour":{"type":"integer","minimum":0,"maximum":23},"avgEngagement":{"type":["number","null"]},"posts":{"type":"integer"},"onlineFollowers":{"type":"integer"}}},"BestTime":{"type":"object","properties":{"days":{"type":"integer"},"timezone":{"type":"string","enum":["UTC"]},"basedOnPosts":{"type":"integer"},"accountId":{"type":"string"},"source":{"type":"string","description":"history needs at least 3 published posts with metrics; then Instagram online followers; then defaults","enum":["history","online_followers","default"]},"onlineFollowersAccountId":{"type":"string"},"slots":{"type":"array","items":{"$ref":"#/components/schemas/BestTimeSlot"},"description":"Top 5 slots"}}},"InboundEvent":{"type":"object","properties":{"id":{"type":"string"},"platform":{"type":"string","enum":["instagram","facebook","threads","whatsapp","x","telephony"]},"kind":{"type":"string","enum":["comment","mention","reply","feed","message","template","quality","otp","other"]},"accountId":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"payload":{"type":"object","properties":{"field":{"type":"string","description":"Meta webhook field"},"verb":{"type":"string"},"entryId":{"type":"string"},"platformPostId":{"type":"string"},"comment":{"type":"object","properties":{"id":{"type":"string"},"text":{"type":"string"},"username":{"type":"string"},"authorId":{"type":"string"},"parentId":{"type":"string"}}},"time":{"type":"integer"},"value":{"description":"Raw change value from Meta"}}}}},"MessagingWindow":{"type":"object","properties":{"open":{"type":"boolean","description":"Free-form messages are allowed now (within 24 hours of the participant's last message)"},"closesAt":{"type":["string","null"],"format":"date-time","description":"End of the standard 24-hour window; null when no message from the participant is known"},"humanAgentClosesAt":{"type":["string","null"],"format":"date-time","description":"End of the HUMAN_AGENT window (7 days); tag HUMAN_AGENT needs Meta's Human Agent permission"}},"required":["open","closesAt","humanAgentClosesAt"],"description":"Meta's messaging window, computed from the participant's latest message"},"FacebookPageInfo":{"type":"object","properties":{"about":{"type":["string","null"]},"description":{"type":["string","null"]},"website":{"type":["string","null"]},"phone":{"type":["string","null"]},"emails":{"type":"array","items":{"type":"string"}},"hours":{"type":"object","description":"Keys {day}_{slot}_{open|close}, e.g. mon_1_open: \"09:00\"; empty when none"}},"required":["about","description","website","phone","emails","hours"]},"Conversation":{"type":"object","properties":{"id":{"type":"string"},"accountId":{"type":"string"},"platform":{"type":"string","enum":["instagram","facebook","whatsapp","x","telegram"]},"platformConversationId":{"type":["string","null"],"description":"Graph conversation id; known after a sync"},"participant":{"type":"object","properties":{"id":{"type":"string","description":"Instagram-scoped id (IGSID), Page-scoped id (PSID), or WhatsApp phone (wa_id) / BSUID"},"username":{"type":["string","null"]},"name":{"type":["string","null"]},"pictureUrl":{"type":["string","null"]},"phone":{"type":["string","null"],"description":"WhatsApp: wa_id"},"userId":{"type":["string","null"],"description":"WhatsApp: business-scoped user id (BSUID)"},"parentUserId":{"type":["string","null"],"description":"WhatsApp: parent BSUID"}}},"lastMessage":{"type":["object","null"],"properties":{"text":{"type":["string","null"],"description":"Preview (≤200 characters) or [attachment type]"},"direction":{"type":"string","enum":["inbound","outbound"]},"at":{"type":"string","format":"date-time"}}},"unreadCount":{"type":"integer"},"lastReadAt":{"type":["string","null"],"format":"date-time","description":"Marked read through Postgale"},"participantReadAt":{"type":["string","null"],"format":"date-time","description":"The participant has read the account's messages up to here"},"status":{"type":"string","description":"A new inbound message makes an archived conversation active again","enum":["active","archived"]},"messagingWindow":{"$ref":"#/components/schemas/MessagingWindow"},"syncedAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"Message":{"type":"object","properties":{"id":{"type":"string"},"conversationId":{"type":"string"},"platformMessageId":{"type":["string","null"],"description":"Meta message id (mid)"},"direction":{"type":"string","enum":["inbound","outbound"]},"type":{"type":"string","description":"WhatsApp messages use the WhatsApp type (image, template, interactive, button, reaction, location, contacts, ...)","enum":["text","attachment","postback","unsupported","image","video","audio","document","sticker","template","interactive","button","reaction","location","contacts","order","system"]},"text":{"type":["string","null"]},"attachments":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","description":"image, video, audio, file, story_mention, share, ..."},"url":{"type":"string"}}}},"postback":{"type":["object","null"],"properties":{"title":{"type":"string"},"payload":{"type":"string"}}},"reactions":{"type":"array","items":{"type":"object","properties":{"emoji":{"type":["string","null"]},"by":{"type":"string","enum":["participant","account"]}}}},"replyToMid":{"type":["string","null"]},"isEcho":{"type":"boolean","description":"Outbound message reported by Meta's echo (e.g. sent from the Instagram app or Meta Business Suite)"},"isDeleted":{"type":"boolean","description":"Unsent by the participant (content removed)"},"status":{"type":"string","enum":["received","sent","delivered","read","failed"]},"tag":{"type":["string","null"],"enum":["HUMAN_AGENT",null]},"sentAt":{"type":"string","format":"date-time"},"deliveredAt":{"type":["string","null"],"format":"date-time"},"readAt":{"type":["string","null"],"format":"date-time"},"source":{"type":"string","description":"webhook (inbound Meta webhook), sync (backfill), poll (X inbox poll) or api (sent through Postgale)","enum":["webhook","sync","poll","api"]},"content":{"description":"WhatsApp: the type-specific object (template, interactive, location, contacts, media ids...)"},"pricing":{"description":"WhatsApp: pricing from the latest status"},"error":{"type":["string","null"]},"failedAt":{"type":["string","null"],"format":"date-time"}}},"PhoneNumberInfo":{"type":"object","properties":{"displayPhoneNumber":{"type":["string","null"]},"verifiedName":{"type":["string","null"]},"qualityRating":{"type":["string","null"],"description":"GREEN, YELLOW, RED or UNKNOWN"},"messagingLimitTier":{"type":["string","null"],"description":"e.g. TIER_250, TIER_1K, TIER_10K, TIER_UNLIMITED"},"nameStatus":{"type":["string","null"]},"platformType":{"type":["string","null"],"description":"CLOUD_API, ON_PREMISE, NOT_APPLICABLE"},"codeVerificationStatus":{"type":["string","null"]},"status":{"type":["string","null"],"description":"CONNECTED, PENDING, DISCONNECTED, ..."},"checkedAt":{"type":["string","null"],"format":"date-time","description":"Last refresh from Meta"},"throughput":{"description":"Only with refresh=true: Meta's throughput level"}}},"ProvisionedNumber":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string","enum":["telnyx","twilio","mock"]},"phoneNumber":{"type":"string","description":"E.164"},"countryCode":{"type":"string"},"verifiedName":{"type":"string","description":"WhatsApp display name"},"status":{"type":"string","enum":["purchasing","purchased","adding_to_waba","code_requested","verifying","registering","active","failed","releasing","released"]},"wabaId":{"type":["string","null"]},"phoneNumberId":{"type":["string","null"],"description":"Cloud API phone number id once added to the WABA"},"accountId":{"type":["string","null"],"description":"The WhatsApp account created for the number (active)"},"sourceAccountId":{"type":["string","null"],"description":"The account whose WABA and token were used"},"codeMethod":{"type":["string","null"],"enum":["VOICE","SMS",null]},"codeRequestedAt":{"type":["string","null"],"format":"date-time"},"codeAttempts":{"type":"integer"},"priceCents":{"type":"integer","description":"Monthly price"},"currency":{"type":"string"},"activatedAt":{"type":["string","null"],"format":"date-time"},"lastProductionMessageAt":{"type":["string","null"],"format":"date-time"},"releaseWarnedAt":{"type":["string","null"],"format":"date-time"},"releaseAt":{"type":["string","null"],"format":"date-time","description":"Idle release time if no message is sent or received before"},"releasedAt":{"type":["string","null"],"format":"date-time"},"error":{"type":["string","null"],"description":"<step>_failed: message (purchase, add, request_code, verify, register, connect, release) or otp_timeout"},"nextActionAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"lastCode":{"type":["object","null"],"description":"Only in GET /whatsapp/numbers/{id}: the verification code captured in the last 10 minutes {code, capturedAt, expiresAt}","properties":{"code":{"type":"string"},"capturedAt":{"type":"string"},"expiresAt":{"type":"string"}}}}},"WhatsAppAccount":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string","enum":["whatsapp"]},"accountName":{"type":"string"},"phoneNumberId":{"type":"string","description":"Cloud API phone number id (= platformAccountId)"},"wabaId":{"type":["string","null"]},"businessId":{"type":["string","null"]},"externalId":{"type":["string","null"]},"status":{"type":"string"},"phoneNumber":{"$ref":"#/components/schemas/PhoneNumberInfo"},"onboarding":{"type":"object","properties":{"connection":{"type":["string","null"],"enum":["embedded_signup","manual","mock",null]},"onboarding":{"type":["string","null"],"enum":["cloud_api","coexistence","waba_only",null]},"subscribed":{"type":["boolean","null"]},"subscribeError":{"type":["string","null"]},"registered":{"type":["boolean","null"]},"registerError":{"type":["string","null"],"description":"Retry with POST /whatsapp/accounts/{id}/register"},"registerSkipped":{"type":["string","null"]},"onboardedAt":{"type":["string","null"],"format":"date-time"}}}}},"WhatsAppOutbound":{"description":"One message: type plus its fields. Everything except template needs an open 24-hour window","oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"text"},"text":{"type":"string","maxLength":4096},"previewUrl":{"type":"boolean"}},"required":["type","text"],"title":"Text"},{"type":"object","properties":{"type":{"type":"string","enum":["image","video","audio","document","sticker"]},"mediaUrl":{"type":"string","description":"Public https URL"},"whatsappMediaId":{"type":"string","description":"Id from POST /whatsapp/accounts/{id}/media"},"mediaId":{"type":"string","description":"Postgale media id with a publicUrl"},"caption":{"type":"string","description":"Not audio or sticker","maxLength":1024},"filename":{"type":"string","description":"document"}},"required":["type"],"title":"Media","description":"Exactly one of mediaUrl, whatsappMediaId or mediaId"},{"type":"object","properties":{"type":{"type":"string","const":"template"},"template":{"type":"object","properties":{"name":{"type":"string"},"language":{"type":"string","description":"e.g. en_US"},"components":{"type":"array","items":{"type":"object"},"description":"Meta components with parameters, e.g. [{type:\"body\",parameters:[{type:\"text\",text:\"Ana\"}]}]"}},"required":["name","language"]}},"required":["type","template"],"title":"Template","description":"Allowed outside the 24-hour window; charged by Meta"},{"type":"object","properties":{"type":{"type":"string","const":"interactive"},"interactive":{"type":"object","properties":{"type":{"type":"string","enum":["button","list","cta_url"]},"body":{"type":"string","maxLength":1024},"header":{"description":"Text, or {type: text|image|video|document, text|link|id}"},"footer":{"type":"string","maxLength":60},"buttons":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":256},"title":{"type":"string","maxLength":20}},"required":["id","title"]},"description":"button: 1-3 reply buttons"},"buttonText":{"type":"string","description":"list: button label","maxLength":20},"sections":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string","maxLength":24},"description":{"type":"string","maxLength":72}},"required":["id","title"]}}}},"description":"list: up to 10 rows in total"},"displayText":{"type":"string","description":"cta_url: button label","maxLength":20},"url":{"type":"string","description":"cta_url: https link"}},"required":["type","body"]}},"required":["type","interactive"],"title":"Interactive"},{"type":"object","properties":{"type":{"type":"string","const":"location"},"location":{"type":"object","properties":{"latitude":{"type":"number"},"longitude":{"type":"number"},"name":{"type":"string"},"address":{"type":"string"}},"required":["latitude","longitude"]}},"required":["type","location"],"title":"Location"},{"type":"object","properties":{"type":{"type":"string","const":"reaction"},"reaction":{"type":"object","properties":{"messageId":{"type":"string","description":"wamid of the message"},"emoji":{"type":"string","description":"One emoji; \"\" removes the reaction"}},"required":["messageId","emoji"]}},"required":["type","reaction"],"title":"Reaction"}]},"WhatsAppSend":{"allOf":[{"$ref":"#/components/schemas/WhatsAppOutbound"},{"type":"object","properties":{"to":{"type":"string","description":"Phone number in international format"},"recipient":{"type":"string","description":"Business-scoped user id (BSUID)"},"conversationId":{"type":"string","description":"WhatsApp conversation of this account"},"replyTo":{"type":"string","description":"wamid of the quoted message"}},"description":"Exactly one of to, recipient or conversationId"}]},"Template":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"language":{"type":"string"},"category":{"type":"string","enum":["MARKETING","UTILITY","AUTHENTICATION"]},"status":{"type":"string","description":"APPROVED, PENDING, REJECTED, PAUSED, DISABLED, ..."},"components":{"type":"array","items":{"type":"object"},"description":"Meta components (HEADER, BODY, FOOTER, BUTTONS)"},"qualityScore":{"description":"Meta quality score"},"rejectedReason":{"type":"string"},"parameterFormat":{"type":"string","enum":["POSITIONAL","NAMED"]}},"required":["id","name"]},"MediaInfo":{"type":"object","properties":{"id":{"type":"string","description":"WhatsApp media id"},"mimeType":{"type":["string","null"]},"sha256":{"type":["string","null"]},"size":{"type":["integer","null"],"description":"Bytes"}}},"Webhook":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"events":{"description":"JSON array (list) or array (create)","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"createdAt":{"type":"string","format":"date-time"},"secret":{"type":"string","description":"Only in the direct create response (never in an approved action's result)"}}},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string"},"webhookId":{"type":"string"},"event":{"type":"string","enum":["post.published","post.failed","post.pending_approval","post.approved","post.rejected","action.pending_approval","action.approved","action.rejected","action.executed","action.failed","comment.received","mention.received","message.received","message.sent","message.read","message.delivered","message.reaction","message.status","message.edited","message.deleted","message.failed","reaction.received","template.status","template.quality","account.quality","account.connected","account.disconnected","connection.pending","phone_number.provisioned","phone_number.release_scheduled","phone_number.released","phone_number.failed","webhook.test"]},"status":{"type":"string","enum":["pending","sending","delivered","failed"]},"responseCode":{"type":["integer","null"]},"attempts":{"type":"integer"},"nextAttemptAt":{"type":["string","null"],"format":"date-time"},"lastError":{"type":["string","null"]},"deliveredAt":{"type":["string","null"],"format":"date-time"},"redeliveryOf":{"type":["string","null"]},"idempotencyKey":{"type":"string","description":"X-Idempotency-Key of this delivery (the original delivery id)"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"payload":{"type":"object"}}},"QueuedAction":{"type":"object","properties":{"id":{"type":"string","description":"Pending action id (GET /actions/{id})"},"status":{"type":"string","enum":["pending_approval"]},"kind":{"type":"string","description":"comment.reply, comment.create, comment.hide, comment.unhide, comment.delete, comment.like, comment.unlike, post.edit_published, post.unpublish, post.comments_settings, message.send, conversation.start, x.repost, x.like, x.bookmark, x.follow (x.un... to undo)"},"accountIds":{"type":"array","items":{"type":"string"}},"payloadSha256":{"type":"string","description":"SHA-256 of the stored call"},"createdAt":{"type":"string","format":"date-time"},"replayed":{"type":"boolean","description":"The same call from this key was already pending: this is that action"},"message":{"type":"string"}},"required":["id","status","kind"]},"PendingAction":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string"},"status":{"type":"string","description":"pending_approval → approved → executed | failed, or rejected","enum":["pending_approval","approved","rejected","executed","failed"]},"accountIds":{"type":"array","items":{"type":"string"}},"operation":{"type":"string","description":"The service operation that runs on approval"},"args":{"type":"array","items":{},"description":"Its exact arguments (the request as validated by the endpoint)"},"text":{"type":["string","null"],"description":"The text that will be sent (reply, comment, DM, published-post edit), as possibly edited by the reviewer"},"editable":{"type":"boolean"},"edited":{"type":"boolean","description":"A member changed the text before approving"},"payloadSha256":{"type":"string"},"approvedSha256":{"type":["string","null"],"description":"Hash of the version a member approved"},"proposedBy":{"type":"object","properties":{"type":{"type":"string","enum":["api_key","oauth"]},"via":{"type":"string","enum":["api","mcp"]},"keyId":{"type":["string","null"]},"oauthGrantId":{"type":["string","null"]},"clientId":{"type":["string","null"]},"name":{"type":["string","null"]},"userId":{"type":["string","null"]}}},"review":{"type":"object","properties":{"reviewedAt":{"type":["string","null"],"format":"date-time"},"reviewedByUserId":{"type":["string","null"]},"rejectReason":{"type":["string","null"]},"editedAt":{"type":["string","null"],"format":"date-time"},"editedByUserId":{"type":["string","null"]}}},"executedAt":{"type":["string","null"],"format":"date-time"},"result":{"description":"executed: the operation's response body (what the endpoint would have returned)"},"error":{"type":["object","null"],"properties":{"message":{"type":"string"},"code":{"type":"string"}}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"WebhookEnvelope":{"type":"object","properties":{"id":{"type":"string","description":"Idempotency key (= X-Idempotency-Key)"},"event":{"type":"string","enum":["post.published","post.failed","post.pending_approval","post.approved","post.rejected","action.pending_approval","action.approved","action.rejected","action.executed","action.failed","comment.received","mention.received","message.received","message.sent","message.read","message.delivered","message.reaction","message.status","message.edited","message.deleted","message.failed","reaction.received","template.status","template.quality","account.quality","account.connected","account.disconnected","connection.pending","phone_number.provisioned","phone_number.release_scheduled","phone_number.released","phone_number.failed","webhook.test"]},"createdAt":{"type":"string","format":"date-time"},"data":{"type":"object"}},"required":["id","event","createdAt","data"]},"Targeting":{"type":"object","properties":{"countries":{"type":"array","items":{"type":"string"},"description":"ISO country codes. A location (countries, regions, cities or zips) is required: there is no default"},"regions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"}}}},"cities":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"radius":{"type":"number"},"distance_unit":{"type":"string","enum":["mile","kilometer"]}}}},"zips":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"}}}},"ageMin":{"type":"integer","minimum":13,"maximum":65},"ageMax":{"type":"integer","minimum":13,"maximum":65},"genders":{"type":"array","items":{"type":"integer","enum":[1,2]},"description":"1 male, 2 female"},"interests":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}},"description":"From GET /ads/targeting/search"},"customAudiences":{"type":"array","items":{"type":"string"}},"excludedCustomAudiences":{"type":"array","items":{"type":"string"}},"publisherPlatforms":{"type":"array","items":{"type":"string","enum":["facebook","instagram","messenger","audience_network"]}},"raw":{"type":"object","description":"A Meta targeting spec used as is"}},"description":"Simplified targeting, mapped to Meta's targeting spec"},"AdUpdate":{"type":"object","properties":{"accountId":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["ACTIVE","PAUSED","ARCHIVED","DELETED"]},"dailyBudget":{"type":"integer","minimum":1,"description":"Daily budget: an integer in the ad account currency's API units (currencyOffset 100: cents, 1500 = 15.00 USD; currencyOffset 1, e.g. JPY, KRW, CLP, COP: whole units, 1500 = 1500 CLP)"},"lifetimeBudget":{"type":"integer","minimum":1,"description":"Lifetime budget: an integer in the ad account currency's API units (currencyOffset 100: cents, 1500 = 15.00 USD; currencyOffset 1, e.g. JPY, KRW, CLP, COP: whole units, 1500 = 1500 CLP)"},"spendCap":{"oneOf":[{"type":"integer","minimum":1,"description":"Campaign spend cap: an integer in the ad account currency's API units (currencyOffset 100: cents, 1500 = 15.00 USD; currencyOffset 1, e.g. JPY, KRW, CLP, COP: whole units, 1500 = 1500 CLP)"},{"type":"string","enum":["none"]}],"description":"Campaign spend cap, or \"none\" to remove it"},"bidAmount":{"type":"integer","minimum":1,"description":"Ad set bid cap: an integer in the ad account currency's API units (currencyOffset 100: cents, 1500 = 15.00 USD; currencyOffset 1, e.g. JPY, KRW, CLP, COP: whole units, 1500 = 1500 CLP)"},"endTime":{"type":"string","description":"Ad set end","format":"date-time"},"stopTime":{"type":"string","description":"Campaign end","format":"date-time"},"targeting":{"$ref":"#/components/schemas/Targeting"},"confirm":{"type":"boolean","description":"Required (true) for anything that can spend: creates (campaign, ad set, ad, boost), status ACTIVE, budget, bid, schedule or targeting changes; and for what cannot be undone (status DELETED or ARCHIVED, deleting an audience). Without it: 400 confirmation_required, nothing is created"}},"required":["accountId"]},"Boost":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected Facebook Page account id"},"adAccountId":{"type":"string","description":"Ad account id (act_...)"},"confirm":{"type":"boolean","description":"Required (true) for anything that can spend: creates (campaign, ad set, ad, boost), status ACTIVE, budget, bid, schedule or targeting changes; and for what cannot be undone (status DELETED or ARCHIVED, deleting an audience). Without it: 400 confirmation_required, nothing is created"},"postId":{"type":"string","description":"Postgale post id with a published Facebook or Instagram target"},"platformPostId":{"type":"string","description":"Or the Meta post id (Page post id or Instagram media id)"},"platform":{"type":"string","enum":["facebook","instagram"]},"instagramUserId":{"type":"string","description":"Instagram: business account id linked to the Page"},"name":{"type":"string"},"goal":{"type":"string","enum":["engagement","traffic","awareness","video_views","lead_generation","conversions","app_promotion"],"default":"engagement"},"budget":{"type":"object","properties":{"amount":{"type":"integer","minimum":1,"description":"Budget: an integer in the ad account currency's API units (currencyOffset 100: cents, 1500 = 15.00 USD; currencyOffset 1, e.g. JPY, KRW, CLP, COP: whole units, 1500 = 1500 CLP)"},"type":{"type":"string","enum":["daily","lifetime"]}},"required":["amount"]},"promotedObject":{"type":"object","description":"Meta promoted_object: lead_generation defaults to the Page; conversions need {pixel_id, custom_event_type}, app_promotion {application_id, object_store_url}"},"schedule":{"type":"object","properties":{"startDate":{"type":"string","format":"date-time"},"endDate":{"type":"string","description":"Required with a lifetime budget","format":"date-time"}}},"targeting":{"$ref":"#/components/schemas/Targeting"},"linkUrl":{"type":"string","description":"https link (with callToAction)"},"callToAction":{"type":"string","description":"LEARN_MORE, SHOP_NOW, SIGN_UP, MESSAGE_PAGE, WHATSAPP_MESSAGE, ..."},"specialAdCategories":{"type":"array","items":{"type":"string"}},"status":{"type":"string","description":"PAUSED (default) or ACTIVE (only together with confirm: true)","enum":["PAUSED","ACTIVE"]}},"required":["accountId","adAccountId","budget","confirm"]},"TikTokVideo":{"type":"object","properties":{"id":{"type":"string","description":"TikTok video id"},"title":{"type":"string"},"description":{"type":"string"},"createTime":{"type":"string","format":"date-time"},"durationSec":{"type":"number"},"coverImageUrl":{"type":"string"},"shareUrl":{"type":"string"},"embedLink":{"type":"string"},"width":{"type":"integer"},"height":{"type":"integer"},"metrics":{"type":"object","properties":{"views":{"type":"integer"},"likes":{"type":"integer"},"comments":{"type":"integer"},"shares":{"type":"integer"}}}}},"TikTokProfile":{"type":"object","properties":{"openId":{"type":"string"},"unionId":{"type":"string"},"displayName":{"type":"string"},"username":{"type":"string"},"avatarUrl":{"type":"string"},"bio":{"type":"string"},"profileUrl":{"type":"string"},"isVerified":{"type":"boolean"},"followerCount":{"type":"integer"},"followingCount":{"type":"integer"},"likesCount":{"type":"integer"},"videoCount":{"type":"integer"}}},"DiscordRole":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"color":{"type":"integer","description":"Decimal color (0 = none)"},"position":{"type":"integer","description":"Higher = more authority"},"permissions":{"type":"string","description":"Permissions bitfield as a string"},"managed":{"type":"boolean"},"mentionable":{"type":"boolean"},"hoist":{"type":"boolean"}}},"DiscordGuildMember":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"username":{"type":"string"},"discriminator":{"type":"string"},"avatar":{"type":["string","null"]},"global_name":{"type":["string","null"]}}},"nick":{"type":["string","null"]},"roles":{"type":"array","items":{"type":"string"}},"joined_at":{"type":"string"},"premium_since":{"type":["string","null"]}},"description":"Discord's guild member object, verbatim"},"DiscordScheduledEvent":{"type":"object","properties":{"id":{"type":"string"},"guild_id":{"type":"string"},"channel_id":{"type":["string","null"]},"creator_id":{"type":["string","null"]},"name":{"type":"string"},"description":{"type":["string","null"]},"scheduled_start_time":{"type":"string"},"scheduled_end_time":{"type":["string","null"]},"privacy_level":{"type":"integer","enum":[2]},"status":{"type":"integer","enum":[1,2,3,4],"description":"1 scheduled, 2 active, 3 completed, 4 cancelled"},"entity_type":{"type":"integer","enum":[1,2,3],"description":"1 stage, 2 voice, 3 external"},"entity_id":{"type":["string","null"]},"entity_metadata":{"type":["object","null"]},"user_count":{"type":"integer"},"image":{"type":["string","null"]}},"description":"Discord's scheduled event, verbatim"},"DiscordSettings":{"type":"object","properties":{"_id":{"type":"string"},"id":{"type":"string"},"platform":{"type":"string","enum":["discord"]},"connection":{"type":"string","description":"bot, or webhook for accounts connected with webhook.incoming","enum":["bot","webhook"]},"username":{"type":["string","null"]},"displayName":{"type":"string"},"profilePicture":{"type":["string","null"]},"channelId":{"type":["string","null"]},"channelName":{"type":["string","null"]},"channelType":{"type":["string","null"],"description":"0 text, 5 announcement, 15 forum"},"guildId":{"type":["string","null"]},"webhookUsername":{"type":["string","null"]},"webhookAvatarUrl":{"type":["string","null"]}}},"LinkedInOptions":{"type":"object","properties":{"mediaItems":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","description":"Default: from the URL extension","enum":["image","video","document"]},"url":{"type":"string","description":"Public https URL"},"thumbnail":{"type":"string","description":"Videos: custom cover image URL (best effort)"},"title":{"type":"string","description":"Video or document title"},"altText":{"type":"string","description":"Image alt text"}},"required":["url"]},"description":"Up to 20 images, or one video, or one document (PDF, PPT, PPTX, DOC, DOCX; ≤100 MB, ≤300 pages); never mixed"},"mediaUrl":{"type":"string","description":"Shorthand for one media item (type from the extension or mediaType)"},"mediaUrls":{"type":"array","items":{"type":"string"},"description":"Shorthand for several images"},"mediaType":{"type":"string","description":"Type of mediaUrl/mediaUrls","enum":["image","video","document"]},"documentTitle":{"type":"string","description":"Document posts: the title LinkedIn requires (default: the media item title, then the file name)","maxLength":400},"firstComment":{"type":"string","description":"Posted as the first comment after publishing, as the post's author; mentions become plain names","maxLength":1250},"organizationUrn":{"type":"string","description":"Must be the account's own author URN; to post as a page, use that page's connected account or switch this one (urn:li:organization:<id>, see /accounts/{id}/linkedin-organizations)"}},"title":"LinkedIn","description":"Post content up to 3,000 characters, published in LinkedIn's little-text format (reserved characters escaped, #hashtags kept). Mentions: @[Name](urn:li:person:…|urn:li:organization:…) as written, or @[https://www.linkedin.com/in/…] / @[Name](https://www.linkedin.com/company/…) resolved to LinkedIn's name when publishing (at most 10; person lookups need an administered page). Videos and documents are processed by LinkedIn first: the target stays publishing until then."},"Contact":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]},"company":{"type":["string","null"]},"avatarUrl":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"isSubscribed":{"type":"boolean"},"isBlocked":{"type":"boolean"},"customFields":{"type":"object"},"notes":{"type":["string","null"]},"profileId":{"type":["string","null"]},"messagesSentCount":{"type":"integer"},"messagesReceivedCount":{"type":"integer"},"lastMessageSentAt":{"type":["string","null"],"format":"date-time"},"lastMessageReceivedAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"ContactChannel":{"type":"object","properties":{"id":{"type":"string"},"accountId":{"type":"string"},"platform":{"type":"string"},"platformIdentifier":{"type":"string","description":"WhatsApp: phone digits (wa_id)"},"displayIdentifier":{"type":"string"},"isSubscribed":{"type":"boolean"},"conversationId":{"type":["string","null"]},"metadata":{"type":"object"},"lastActiveAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"}}},"BroadcastTemplate":{"type":"object","properties":{"name":{"type":"string","description":"Approved template name"},"language":{"type":"string","description":"e.g. en_US"},"components":{"type":"array","items":{"type":"object"},"description":"Meta components; text parameters may hold {{n}}, filled from variableMapping"},"variableMapping":{"type":"object","description":"Position → {field: name | phone | email | company | custom, customValue}","additionalProperties":{"type":"object","properties":{"field":{"type":"string","enum":["name","phone","email","company","custom"]},"customValue":{"type":"string"}}}}},"required":["name","language"]},"Broadcast":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"platform":{"type":"string","enum":["whatsapp"]},"accountId":{"type":"string"},"accountName":{"type":"string"},"profileId":{"type":["string","null"]},"status":{"type":"string","enum":["draft","scheduled","sending","completed","failed","cancelled"]},"template":{"$ref":"#/components/schemas/BroadcastTemplate"},"segmentFilters":{"type":"object","properties":{"tags":{"type":"array","items":{"type":"string"}},"isSubscribed":{"type":"boolean"},"customFields":{"type":"object"}}},"messagePreview":{"type":["string","null"]},"scheduledAt":{"type":["string","null"],"format":"date-time"},"startedAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"recipientCount":{"type":"integer"},"sentCount":{"type":"integer"},"deliveredCount":{"type":"integer"},"readCount":{"type":"integer"},"failedCount":{"type":"integer"},"pendingCount":{"type":"integer"},"lastError":{"type":["string","null"],"description":"e.g. the messaging-limit tier was reached; the worker continues as capacity frees up"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"BroadcastRecipient":{"type":"object","properties":{"id":{"type":"string"},"contactId":{"type":["string","null"]},"channelId":{"type":["string","null"]},"platformIdentifier":{"type":"string"},"contactName":{"type":["string","null"]},"status":{"type":"string","enum":["pending","sent","delivered","read","failed"]},"messageId":{"type":["string","null"]},"platformMessageId":{"type":["string","null"]},"error":{"type":["string","null"]},"errorCode":{"type":["integer","null"],"description":"Meta error code (131049 marketing limit, 131026 unreachable...)"},"errorExplanation":{"type":["string","null"]},"errorTraceId":{"type":["string","null"]},"sentAt":{"type":["string","null"],"format":"date-time"},"deliveredAt":{"type":["string","null"],"format":"date-time"},"readAt":{"type":["string","null"],"format":"date-time"},"failedAt":{"type":["string","null"],"format":"date-time"}}},"WhatsAppFlow":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["DRAFT","PUBLISHED","DEPRECATED","BLOCKED","THROTTLED"]},"categories":{"type":"array","items":{"type":"string"}},"validation_errors":{"type":"array","items":{"type":"object"}},"json_version":{"type":"string"},"endpoint_uri":{"type":"string"},"preview":{"type":"object","properties":{"preview_url":{"type":["string","null"]},"expires_at":{"type":["string","null"]}}},"version":{"type":"integer","description":"Version in the clone lineage (tracked by Postgale)"},"lineageId":{"type":"string"}}},"WhatsAppCallingConfig":{"type":"object","properties":{"phoneNumber":{"type":["string","null"]},"callingEnabled":{"type":"boolean"},"callDeepLink":{"type":["string","null"]},"forwardTo":{"type":["string","null"],"description":"tel:+E164 / sip:user@host / wss://host"},"recordingEnabled":{"type":"boolean"},"sipAuthUsername":{"type":["string","null"]},"sipAuthPasswordConfigured":{"type":"boolean"},"callIconCountries":{"type":["array","null"]},"outboundDisabled":{"type":"boolean"},"callerIdMode":{"type":"string","enum":["business","platform"]},"callerIdVerified":{"type":"boolean"},"maxCallDurationSeconds":{"type":["integer","null"]},"forwardCallerId":{"type":"string","enum":["business","caller"]}}},"WhatsAppCall":{"type":"object","properties":{"id":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"from":{"type":"string"},"to":{"type":"string"},"status":{"type":"string","enum":["dialing","ringing","answered","ended","failed"]},"startedAt":{"type":"string","format":"date-time"},"endedAt":{"type":["string","null"],"format":"date-time"},"durationSeconds":{"type":["integer","null"]},"endReason":{"type":["string","null"]},"recordingUrl":{"type":["string","null"]},"forwardTo":{"type":["string","null"]},"billing":{"type":["object","null"]}}},"ZTemplate":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"type":"string"},"category":{"type":"string"},"language":{"type":"string"},"components":{"type":"array","items":{"type":"object"}},"message_send_ttl_seconds":{"type":"integer"},"rejected_reason":{"type":"string"},"quality_score":{"type":"object"}}}},"responses":{"BadRequest":{"description":"Invalid input; codes not_supported (the platform lacks the feature) and invalid_request (rejected by the platform)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"missing_permission (reconnect after the Meta app has the permission) or approval_required (ads writes while human approval applies)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Queued":{"description":"Approval applies: the action was queued for a person (nothing was sent). Follow it with GET /actions/{id} or the action.* webhooks","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueuedAction"}}}},"NotFound":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Conflict":{"description":"reconnect_required, outside_messaging_window, recipient_unavailable, sync_required, or a post state conflict (APPROVAL_REQUIRED, ALREADY_PUBLISHED, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Gone":{"description":"pending_expired: the pending connection expired or was already completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooLarge":{"description":"Media too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"API key rate limit, or rate_limited by the platform","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"PlatformError":{"description":"platform_error: the platform failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/accounts":{"get":{"tags":["Accounts"],"summary":"List connected accounts","parameters":[{"name":"externalId","in":"query","required":false,"schema":{"type":"string"},"description":"Only accounts with this externalId"}],"responses":{"200":{"description":"{accounts}","content":{"application/json":{"schema":{"type":"object","properties":{"accounts":{"type":"array","items":{"$ref":"#/components/schemas/Account"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/accounts/health":{"get":{"tags":["Accounts"],"summary":"Health of every account (token validity, missing permissions, publishing limit, recommendations; cached 10 minutes)","parameters":[{"name":"refresh","in":"query","required":false,"schema":{"type":"string","enum":["1"]},"description":"Re-check with the platform instead of the 10-minute cache"}],"responses":{"200":{"description":"{accounts}","content":{"application/json":{"schema":{"type":"object","properties":{"accounts":{"type":"array","items":{"$ref":"#/components/schemas/AccountHealth"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/accounts/{id}":{"get":{"tags":["Accounts"],"summary":"Get an account","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{account}","content":{"application/json":{"schema":{"type":"object","properties":{"account":{"$ref":"#/components/schemas/Account"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"tags":["Accounts"],"summary":"Update the account: any of externalId, displayName, username (display overrides) and profileId (move to another profile; null detaches). null or \"\" clears a field","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"externalId":{"type":["string","null"],"maxLength":200,"description":"null or \"\" clears it"},"displayName":{"type":["string","null"],"maxLength":200},"username":{"type":["string","null"],"maxLength":200},"profileId":{"type":["string","null"],"description":"Move to this profile; null detaches"}}}}}},"responses":{"200":{"description":"{account}","content":{"application/json":{"schema":{"type":"object","properties":{"account":{"$ref":"#/components/schemas/Account"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Accounts"],"summary":"Same as PATCH (Zernio's update-account verb)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"externalId":{"type":["string","null"],"maxLength":200,"description":"null or \"\" clears it"},"displayName":{"type":["string","null"],"maxLength":200},"username":{"type":["string","null"],"maxLength":200},"profileId":{"type":["string","null"],"description":"Move to this profile; null detaches"}}}}}},"responses":{"200":{"description":"{account}","content":{"application/json":{"schema":{"type":"object","properties":{"account":{"$ref":"#/components/schemas/Account"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/accounts/follower-stats":{"get":{"tags":["Analytics"],"summary":"Follower history per account from daily snapshots (the worker reads each account once per UTC day) with current count and growth over the window","parameters":[{"name":"accountIds","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated account ids"},{"name":"profileId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this profile"},{"name":"fromDate","in":"query","required":false,"schema":{"type":"string"},"description":"First day, YYYY-MM-DD (default: 30 days ago)"},{"name":"toDate","in":"query","required":false,"schema":{"type":"string"},"description":"Last day, YYYY-MM-DD (default: today)"},{"name":"granularity","in":"query","required":false,"schema":{"type":"string","enum":["daily","weekly","monthly"]},"description":"Aggregation (default daily)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":"Maximum items (default 25, max 100)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"pagination.nextCursor"}],"responses":{"200":{"description":"{accounts, stats, dateRange, granularity, pagination?}","content":{"application/json":{"schema":{"type":"object","properties":{"accounts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"platform":{"type":"string"},"accountName":{"type":"string"},"profileId":{"type":["string","null"]},"currentFollowers":{"type":["integer","null"]},"growth":{"type":["integer","null"]},"growthPercentage":{"type":["number","null"]},"dataPoints":{"type":"integer"}}}},"stats":{"type":"object","description":"{accountId: [{date, followers}]}"},"dateRange":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}}},"granularity":{"type":"string"},"pagination":{"type":"object","properties":{"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/profiles":{"get":{"tags":["Accounts"],"summary":"Profiles (groups of accounts, e.g. one per brand or client), default first","parameters":[{"name":"name","in":"query","required":false,"schema":{"type":"string"},"description":"Exact name"},{"name":"externalId","in":"query","required":false,"schema":{"type":"string"},"description":"Exact externalId"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":100},"description":"Maximum items (default 100, max 100)"},{"name":"skip","in":"query","required":false,"schema":{"type":"integer"},"description":"Offset"}],"responses":{"200":{"description":"{profiles, total?, skip?, limit?}","content":{"application/json":{"schema":{"type":"object","properties":{"profiles":{"type":"array","items":{"$ref":"#/components/schemas/Profile"}},"total":{"type":"integer"},"skip":{"type":"integer"},"limit":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Accounts"],"summary":"Create a profile. timezone: the IANA zone CSV bulk uploads read schedule_time in when a row names no tz","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":100},"description":{"type":["string","null"],"maxLength":500},"color":{"type":["string","null"]},"timezone":{"type":["string","null"],"description":"IANA zone"},"externalId":{"type":["string","null"],"maxLength":255},"isDefault":{"type":"boolean"}},"required":["name"]}}}},"responses":{"201":{"description":"{message, profile}","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"profile":{"$ref":"#/components/schemas/Profile"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/profiles/{id}":{"get":{"tags":["Accounts"],"summary":"One profile","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Profile id"}],"responses":{"200":{"description":"{profile}","content":{"application/json":{"schema":{"type":"object","properties":{"profile":{"$ref":"#/components/schemas/Profile"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Accounts"],"summary":"Update a profile (null clears an optional field; 409 on a duplicate name or externalId)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Profile id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":100},"description":{"type":["string","null"],"maxLength":500},"color":{"type":["string","null"]},"timezone":{"type":["string","null"],"description":"IANA zone"},"externalId":{"type":["string","null"],"maxLength":255},"isDefault":{"type":"boolean"}}}}}},"responses":{"200":{"description":"{message, profile}","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"profile":{"$ref":"#/components/schemas/Profile"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"tags":["Accounts"],"summary":"Same as PUT","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Profile id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":100},"description":{"type":["string","null"],"maxLength":500},"color":{"type":["string","null"]},"timezone":{"type":["string","null"],"description":"IANA zone"},"externalId":{"type":["string","null"],"maxLength":255},"isDefault":{"type":"boolean"}}}}}},"responses":{"200":{"description":"{message, profile}","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"profile":{"$ref":"#/components/schemas/Profile"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Accounts"],"summary":"Delete a profile; its accounts stay connected without a profile","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Profile id"}],"responses":{"200":{"description":"{message, id}","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"id":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/account-groups":{"get":{"tags":["Accounts"],"summary":"Account groups (named lists of account ids)","responses":{"200":{"description":"{groups}","content":{"application/json":{"schema":{"type":"object","properties":{"groups":{"type":"array","items":{"$ref":"#/components/schemas/AccountGroup"}}}}}}}}},"post":{"tags":["Accounts"],"summary":"Create an account group (409 when the name exists)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":100},"accountIds":{"type":"array","items":{"type":"string"}}},"required":["name","accountIds"]}}}},"responses":{"201":{"description":"{message, group}","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"group":{"$ref":"#/components/schemas/AccountGroup"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/account-groups/{id}":{"put":{"tags":["Accounts"],"summary":"Rename a group and/or replace its accounts","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Group id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":100},"accountIds":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"{message, group}","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"group":{"$ref":"#/components/schemas/AccountGroup"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"tags":["Accounts"],"summary":"Same as PUT","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Group id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"accountIds":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"{message, group}","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"group":{"$ref":"#/components/schemas/AccountGroup"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Accounts"],"summary":"Delete a group; the accounts are not affected","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Group id"}],"responses":{"200":{"description":"{message, id}","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"id":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/accounts/{id}/health":{"get":{"tags":["Accounts"],"summary":"Health of one account","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"},{"name":"refresh","in":"query","required":false,"schema":{"type":"string","enum":["1"]},"description":"Re-check with the platform instead of the 10-minute cache"}],"responses":{"200":{"description":"{health}","content":{"application/json":{"schema":{"type":"object","properties":{"health":{"$ref":"#/components/schemas/AccountHealth"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/accounts/{id}/publishing-limit":{"get":{"tags":["Accounts"],"summary":"Publishing quota used in the 24-hour window (Instagram, Threads)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{accountId, platform, publishingLimit}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string"},"publishingLimit":{"$ref":"#/components/schemas/PublishingLimit"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/bluesky-settings":{"get":{"tags":["Accounts"],"summary":"The Bluesky account's default post languages (applied when a post sets no platformSpecificData.langs); null when none is set","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{defaultLangs}","content":{"application/json":{"schema":{"type":"object","properties":{"defaultLangs":{"type":["array","null"],"items":{"type":"string"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"tags":["Accounts"],"summary":"Set 1-3 BCP-47 tags (e.g. [\"pt\"], [\"en-US\"]) as the default post languages, or clear them with null. Per-post langs always win; published posts keep theirs (Bluesky has no edits)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"defaultLangs":{"type":["array","null"],"items":{"type":"string"},"minItems":1,"maxItems":3}},"required":["defaultLangs"]}}}},"responses":{"200":{"description":"{defaultLangs}","content":{"application/json":{"schema":{"type":"object","properties":{"defaultLangs":{"type":["array","null"],"items":{"type":"string"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/accounts/{id}/mentions":{"get":{"tags":["Accounts"],"summary":"Media the Instagram account is tagged in (GET /{ig-id}/tags). With Instagram Login, @mentions in comments arrive through the comments webhook field (comment.received)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":"Maximum items (default 25, max 100)"}],"responses":{"200":{"description":"{accountId, platform, mentions}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string"},"mentions":{"type":"array","items":{"$ref":"#/components/schemas/Mention"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/webhook-subscription":{"post":{"tags":["Accounts"],"summary":"Subscribe the account to Meta webhooks (Instagram: INSTAGRAM_WEBHOOK_FIELDS, default comments and the messaging fields; Facebook Page: FACEBOOK_WEBHOOK_FIELDS, default feed and the Messenger fields) so comment.received and message.* can be delivered. Messaging fields are left out when the account has not granted the messaging permission","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{accountId, platform, subscribed}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string"},"subscribed":{"type":"array","items":{"type":"string"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/connect/{platform}":{"get":{"tags":["Connect"],"summary":"OAuth authorization URL for the account owner (valid 10 minutes, single use). Facebook: the owner picks Pages; the result may be a pending connection. WhatsApp: a Postgale page that runs Meta's Embedded Signup (several numbers → pending connection). Telegram has no OAuth: the answer is a one-time code (15 minutes) and instructions: a chat admin adds Postgale's bot as an admin with the right to post and sends /connect <code> in the channel or group (or forwards that channel post to the bot); the chat then appears in GET /accounts and account.connected is emitted. Discord: a server admin installs Postgale's bot (scope bot) and picks channels, one account per channel (platformAccountId = channel id); POST /connect/discord binds more channels of that server (without DISCORD_BOT_TOKEN the link creates a channel webhook instead, platformAccountId = webhook id). Mastodon needs instance (the server's domain; public DNS names only): Postgale registers itself on that server if needed and the link opens its authorization page (platformAccountId = <id>@<server>). Bluesky has no OAuth: POST {handle, appPassword} (a Bluesky app password, never the account password) connects the account right away and answers {platform, account}; a refused handle or password is a 400. Platforms that are not live on this instance answer 400","parameters":[{"name":"platform","in":"path","required":true,"schema":{"type":"string","enum":["instagram","tiktok","x","linkedin","facebook","threads","whatsapp","telegram","discord","bluesky","mastodon"]}},{"name":"externalId","in":"query","required":false,"schema":{"type":"string","maxLength":200},"description":"Your reference, stored on the connected account(s)"},{"name":"instance","in":"query","required":false,"schema":{"type":"string","description":"Mastodon: the server's domain, e.g. hachyderm.io (required for mastodon)","maxLength":253},"description":"Mastodon server domain"}],"responses":{"200":{"description":"{authUrl, expiresInSeconds}; for telegram {code, command, botUsername, instructions, expiresAt, expiresInSeconds}; for bluesky {platform, account}","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"authUrl":{"type":"string"},"expiresInSeconds":{"type":"integer"}}},{"$ref":"#/components/schemas/TelegramConnect"},{"$ref":"#/components/schemas/BlueskyConnect"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Connect"],"summary":"OAuth authorization URL for the account owner (valid 10 minutes, single use). Facebook: the owner picks Pages; the result may be a pending connection. WhatsApp: a Postgale page that runs Meta's Embedded Signup (several numbers → pending connection). Telegram has no OAuth: the answer is a one-time code (15 minutes) and instructions: a chat admin adds Postgale's bot as an admin with the right to post and sends /connect <code> in the channel or group (or forwards that channel post to the bot); the chat then appears in GET /accounts and account.connected is emitted. Discord: a server admin installs Postgale's bot (scope bot) and picks channels, one account per channel (platformAccountId = channel id); POST /connect/discord binds more channels of that server (without DISCORD_BOT_TOKEN the link creates a channel webhook instead, platformAccountId = webhook id). Mastodon needs instance (the server's domain; public DNS names only): Postgale registers itself on that server if needed and the link opens its authorization page (platformAccountId = <id>@<server>). Bluesky has no OAuth: POST {handle, appPassword} (a Bluesky app password, never the account password) connects the account right away and answers {platform, account}; a refused handle or password is a 400. Platforms that are not live on this instance answer 400. Same as GET with externalId (and instance) in the JSON body; Bluesky needs POST with handle and appPassword","parameters":[{"name":"platform","in":"path","required":true,"schema":{"type":"string","enum":["instagram","tiktok","x","linkedin","facebook","threads","whatsapp","telegram","discord","bluesky","mastodon"]}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"externalId":{"type":"string","description":"Your reference, stored on the connected account(s)","maxLength":200},"instance":{"type":"string","description":"Mastodon: the server's domain, e.g. hachyderm.io (required for mastodon)","maxLength":253},"handle":{"type":"string","description":"Bluesky: the handle (e.g. yourname.bsky.social) or DID"},"appPassword":{"type":"string","description":"Bluesky: an app password (xxxx-xxxx-xxxx-xxxx) from Settings → Privacy and security → App passwords. Stored encrypted","format":"password"}}}}}},"responses":{"200":{"description":"{authUrl, expiresInSeconds}; for telegram {code, command, botUsername, instructions, expiresAt, expiresInSeconds}; for bluesky {platform, account}","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"authUrl":{"type":"string"},"expiresInSeconds":{"type":"integer"}}},{"$ref":"#/components/schemas/TelegramConnect"},{"$ref":"#/components/schemas/BlueskyConnect"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/connect/linkedin":{"post":{"tags":["Connect"],"summary":"Connect (or with accountId reconnect) a LinkedIn account with the member's own web session: cookies (li_at and JSESSIONID at least) and the user agent of the browser they came from. No OAuth, no password. country (ISO-3166 alpha-2, required) and city (optional) choose where the server-side residential proxy the session goes through exits; any proxy sent by the caller is ignored. The jar is validated, sealed (encrypted) and stored; responses never contain cookie values. While approval applies to the key, the organization or the account, the connect is queued (202, kind account.linkedin_connect, the queued call carries the jar already sealed). Availability: PROVIDER_LIVE_LINKEDIN_SESSION (or mock outside production)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"cookies":{"oneOf":[{"type":"object","additionalProperties":{"type":"string"},"description":"{name: value} map"},{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"value":{"type":"string"},"domain":{"type":"string","description":"Only linkedin.com cookies are kept"}},"required":["name","value"]},"maxItems":200,"description":"Cookie export list"}],"description":"Session cookies; must include li_at and JSESSIONID. JSON body only, never the query string (400)"},"userAgent":{"type":"string","description":"User agent of the browser that minted the session","maxLength":1024},"country":{"type":"string","description":"ISO-3166 alpha-2 code (any case) of the country the member uses LinkedIn from; the session goes out through a residential proxy there","pattern":"^[a-zA-Z]{2}$"},"city":{"type":"string","description":"Optional city within that country (e.g. \"Buenos Aires\"); normalized to lowercase ASCII with underscores","maxLength":100},"accountId":{"type":"string","description":"Reconnect this existing LinkedIn account"},"externalId":{"type":"string","description":"Your reference, stored on the account","maxLength":200}},"required":["cookies","userAgent","country"]}}}},"responses":{"201":{"description":"{platform, account, verification}: the session account (never the cookies). verification is unverified until live verification is enabled","content":{"application/json":{"schema":{"type":"object","properties":{"platform":{"type":"string","enum":["linkedin"]},"account":{"type":"object","properties":{"id":{"type":"string"},"socialAccountId":{"type":"string","description":"The connected account id"},"status":{"type":"string","enum":["active","expired","checkpoint","unverified"]},"source":{"type":"string","enum":["ui","mcp","api"]},"userAgent":{"type":"string"},"connectedAt":{"type":"string","format":"date-time"}}},"verification":{"type":"string"}},"required":["platform","account","verification"]}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"invalid_linkedin_session: the jar is invalid (e.g. missing li_at or JSESSIONID) or country is missing/invalid; the message names the problem, never a value","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}},"get":{"tags":["Connect"],"summary":"Not supported: LinkedIn session connect has no OAuth link. POST the session cookies instead","responses":{"405":{"description":"Use POST","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/connect/pending":{"get":{"tags":["Connect"],"summary":"Unexpired pending connections of this organization, newest first (options without tokens). Use it, or the connection.pending webhook, to learn the id after an API-started Facebook connect","responses":{"200":{"description":"{pending}","content":{"application/json":{"schema":{"type":"object","properties":{"pending":{"type":"array","items":{"$ref":"#/components/schemas/PendingConnection"}}}}}}}}}},"/connect/pending/{id}":{"get":{"tags":["Connect"],"summary":"A pending connection of this organization: options to pick (no tokens). Expires after 30 minutes","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Pending connection id"}],"responses":{"200":{"description":"{pending}","content":{"application/json":{"schema":{"type":"object","properties":{"pending":{"$ref":"#/components/schemas/PendingConnection"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/connect/pending/{id}/select":{"post":{"tags":["Connect"],"summary":"Connect the chosen options (one account each, e.g. one per Facebook Page); completes the pending connection","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Pending connection id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"optionIds":{"type":"array","minItems":1,"items":{"type":"string"}}},"required":["optionIds"]}}}},"responses":{"200":{"description":"{accounts}","content":{"application/json":{"schema":{"type":"object","properties":{"accounts":{"type":"array","items":{"$ref":"#/components/schemas/ConnectedAccount"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"410":{"$ref":"#/components/responses/Gone"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/media":{"post":{"tags":["Media"],"summary":"Upload media (multipart file, base64 JSON, or public URL import)","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}},"required":["file"]}},"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"Public http(s) URL to import"},"base64":{"type":"string","description":"File contents (data: prefix accepted)"},"fileName":{"type":"string"},"mimeType":{"type":"string","enum":["image/jpeg","image/png","image/webp","image/gif","video/mp4","video/quicktime"]}}}}}},"responses":{"201":{"description":"{media}; media.publicUrl can be used as mediaUrl/mediaUrls","content":{"application/json":{"schema":{"type":"object","properties":{"media":{"$ref":"#/components/schemas/Media"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"413":{"$ref":"#/components/responses/TooLarge"},"429":{"$ref":"#/components/responses/RateLimited"}}},"get":{"tags":["Media"],"summary":"List uploaded media (newest 200)","responses":{"200":{"description":"{media}","content":{"application/json":{"schema":{"type":"object","properties":{"media":{"type":"array","items":{"$ref":"#/components/schemas/Media"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/media/{id}":{"get":{"tags":["Media"],"summary":"Get uploaded media, including publicUrl","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Id"}],"responses":{"200":{"description":"{media}","content":{"application/json":{"schema":{"type":"object","properties":{"media":{"$ref":"#/components/schemas/Media"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/posts":{"get":{"tags":["Posts"],"summary":"List recent posts (max 100)","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"Only posts with this status"}],"responses":{"200":{"description":"{posts}","content":{"application/json":{"schema":{"type":"object","properties":{"posts":{"type":"array","items":{"$ref":"#/components/schemas/Post"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Posts"],"summary":"Create a post (draft, scheduled or published now)","parameters":[{"name":"x-request-id","in":"header","description":"Idempotency key (max 200 chars)","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewPost"}}}},"responses":{"200":{"description":"Idempotent replay (same x-request-id)"},"201":{"description":"{post}","content":{"application/json":{"schema":{"type":"object","properties":{"post":{"$ref":"#/components/schemas/Post"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/posts/{id}":{"get":{"tags":["Posts"],"summary":"Get a post with its targets and media","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Postgale post id"}],"responses":{"200":{"description":"{post}","content":{"application/json":{"schema":{"type":"object","properties":{"post":{"$ref":"#/components/schemas/Post"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"tags":["Posts"],"summary":"Edit the text of an unpublished post (re-queues approval if previously approved)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Postgale post id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string"}},"required":["content"]}}}},"responses":{"200":{"description":"{post}","content":{"application/json":{"schema":{"type":"object","properties":{"post":{"$ref":"#/components/schemas/Post"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Posts"],"summary":"Delete the post record (nothing is removed from the platforms; see /posts/{id}/unpublish)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Postgale post id"}],"responses":{"200":{"description":"{deleted}","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/posts/{id}/publish":{"post":{"tags":["Posts"],"summary":"Publish now (retries failed targets); moves to pending_approval if approval is required","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Postgale post id"}],"responses":{"200":{"description":"{status}","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/posts/{id}/approve":{"post":{"tags":["Posts"],"summary":"Not available to API keys: approval is dashboard-only (always 403)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Postgale post id"}],"responses":{"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/posts/{id}/reject":{"post":{"tags":["Posts"],"summary":"Not available to API keys: rejection is dashboard-only (always 403)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Postgale post id"}],"responses":{"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/posts/{id}/comments":{"get":{"tags":["Comments"],"summary":"Comments on the published targets of a post (legacy; see /inbox/comments)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Postgale post id"}],"responses":{"200":{"description":"{comments}","content":{"application/json":{"schema":{"type":"object","properties":{"comments":{"type":"array","items":{"$ref":"#/components/schemas/Comment"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/posts/{id}/edit":{"post":{"tags":["Published posts"],"summary":"Edit the text of the post on the platform (Facebook; Telegram text or caption, keeping the post's parseMode; Discord message text; X Premium within 1 hour, as a new post id; the Postgale post keeps its text). Queued for approval (202) while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Postgale post id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","maxLength":40000},"accountId":{"type":"string","description":"Only this target"}},"required":["content"]}}}},"responses":{"200":{"description":"{postId, results}: per target; with one target (or accountId) its failure is the error","content":{"application/json":{"schema":{"type":"object","properties":{"postId":{"type":"string"},"results":{"type":"array","items":{"$ref":"#/components/schemas/TargetResult"}}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/posts/{id}/unpublish":{"post":{"tags":["Published posts"],"summary":"Delete the post from the platform (Facebook, Threads, X, Telegram: every message of an album; Discord; Bluesky and Mastodon: the post, or a thread's first post; Instagram does not allow it → not_supported). The Postgale post stays","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Postgale post id"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Only this target"}}}}}},"responses":{"200":{"description":"{postId, results}: per target; with one target (or accountId) its failure is the error","content":{"application/json":{"schema":{"type":"object","properties":{"postId":{"type":"string"},"results":{"type":"array","items":{"$ref":"#/components/schemas/TargetResult"}}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/posts/{id}/comments-settings":{"post":{"tags":["Published posts"],"summary":"Turn comments on or off on the published post (Instagram)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Postgale post id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"accountId":{"type":"string","description":"Only this target"}},"required":["enabled"]}}}},"responses":{"200":{"description":"{postId, results, enabled}","content":{"application/json":{"schema":{"type":"object","properties":{"postId":{"type":"string"},"results":{"type":"array","items":{"$ref":"#/components/schemas/TargetResult"}},"enabled":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/comments/{id}/reply":{"post":{"tags":["Comments"],"summary":"Reply to a comment on a Postgale-published post (legacy; see /inbox/comments/{commentId}/reply)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Platform comment id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"platformPostId":{"type":"string"},"text":{"type":"string","maxLength":10000}},"required":["platformPostId","text"]}}}},"responses":{"200":{"description":"{ok}","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/comments":{"get":{"tags":["Comments"],"summary":"Comments (with replies, parentId set) of a Postgale post (postId) or of any post of an account (accountId + platformPostId). Instagram, Facebook, Threads, X and Bluesky (the reply thread; ids are at:// URIs)","parameters":[{"name":"postId","in":"query","required":false,"schema":{"type":"string"},"description":"Postgale post id"},{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Account id (with platformPostId, or to filter a post's targets)"},{"name":"platformPostId","in":"query","required":false,"schema":{"type":"string"},"description":"Platform post/media id"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"description":"Maximum items (default 50, max 100)"},{"name":"after","in":"query","required":false,"schema":{"type":"string"},"description":"Paging cursor"}],"responses":{"200":{"description":"{comments, next?, errors?}: errors lists targets that failed when a post has several","content":{"application/json":{"schema":{"type":"object","properties":{"postId":{"type":"string"},"comments":{"type":"array","items":{"$ref":"#/components/schemas/Comment"}},"next":{"type":"string","description":"Paging cursor (pass as after)"},"errors":{"type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["Comments"],"summary":"Top-level comment on a platform post as the account","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"},"platformPostId":{"type":"string"},"text":{"type":"string","maxLength":10000}},"required":["accountId","platformPostId","text"]}}}},"responses":{"201":{"description":"{comment}","content":{"application/json":{"schema":{"type":"object","properties":{"comment":{"type":"object","properties":{"id":{"type":"string"},"platform":{"type":"string"},"accountId":{"type":"string"},"platformPostId":{"type":"string"}}}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/comments/{commentId}":{"delete":{"tags":["Comments"],"summary":"Delete a comment (X and Bluesky: the account's own replies; Bluesky comment ids are at:// URIs, URL-encode them in the path). With ?commentId= (Zernio's DELETE /inbox/comments/{postId}?commentId=), the path segment is the post and commentId the comment","parameters":[{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform comment id"},{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Account id (or in the JSON body)"},{"name":"commentId","in":"query","required":false,"schema":{"type":"string"},"description":"Zernio form: the comment to delete"}],"responses":{"200":{"description":"{commentId, deleted}","content":{"application/json":{"schema":{"type":"object","properties":{"commentId":{"type":"string"},"deleted":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"get":{"tags":["Comments"],"summary":"Zernio's GET /inbox/comments/{postId}: the comments of a post. The segment is a Postgale post id, or a platform post id of accountId","parameters":[{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Post id (Postgale or platform)"},{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Account id (required for a platform post id)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"description":"Maximum items (default 50, max 100)"},{"name":"after","in":"query","required":false,"schema":{"type":"string"},"description":"Pagination cursor"}],"responses":{"200":{"description":"{comments, next?} or {postId, comments, errors?}","content":{"application/json":{"schema":{"type":"object","properties":{"comments":{"type":"array","items":{"$ref":"#/components/schemas/Comment"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["Comments"],"summary":"Zernio's POST /inbox/comments/{postId}: reply to commentId, or comment on the post (the segment is the platform post id). Queued for approval (202) while approval applies","parameters":[{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform post id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"},"message":{"type":"string"},"text":{"type":"string","description":"Alias of message"},"commentId":{"type":"string","description":"Reply to this comment"}},"required":["accountId"]}}}},"responses":{"201":{"description":"{reply} or {comment}","content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/comments/{commentId}/pin":{"post":{"tags":["Comments"],"summary":"Pin a top-level comment to the top of the post, where supported (else 400 not_supported). Queued for approval (202) while approval applies","parameters":[{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform comment id"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"},"postId":{"type":"string","description":"Platform post id (some platforms need it)"}}}}}},"responses":{"200":{"description":"{commentId, pinned}","content":{"application/json":{"schema":{"type":"object","properties":{"commentId":{"type":"string"},"pinned":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Comments"],"summary":"Unpin the comment. Queued for approval (202) while approval applies","parameters":[{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform comment id"},{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Account id (or in the JSON body)"}],"responses":{"200":{"description":"{commentId, pinned}","content":{"application/json":{"schema":{"type":"object","properties":{"commentId":{"type":"string"},"pinned":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/comments/{commentId}/private-reply":{"post":{"tags":["Comments"],"summary":"Send a direct message to the author of the comment (Instagram, Facebook private replies; else 400 not_supported). Queued for approval (202) while approval applies","parameters":[{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform comment id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"},"message":{"type":"string","maxLength":1000},"text":{"type":"string","description":"Alias of message"}},"required":["accountId"]}}}},"responses":{"200":{"description":"{commentId, accountId, platform, messageId, recipientId}","content":{"application/json":{"schema":{"type":"object","properties":{"commentId":{"type":"string"},"accountId":{"type":"string"},"platform":{"type":"string"},"messageId":{"type":"string"},"recipientId":{"type":["string","null"]}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/comments/{commentId}/{childId}/hide":{"post":{"tags":["Comments"],"summary":"Zernio path: hide comment childId of post commentId. Queued for approval (202) while approval applies","parameters":[{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Post id (platform)"},{"name":"childId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform comment id"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"}}}}}},"responses":{"200":{"description":"{commentId, hidden}","content":{"application/json":{"schema":{"type":"object","properties":{"commentId":{"type":"string"},"hidden":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Comments"],"summary":"Zernio path: unhide the comment. Queued for approval (202) while approval applies","parameters":[{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Post id (platform)"},{"name":"childId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform comment id"}],"responses":{"200":{"description":"{commentId, hidden}","content":{"application/json":{"schema":{"type":"object","properties":{"commentId":{"type":"string"},"hidden":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/comments/{commentId}/{childId}/like":{"post":{"tags":["Comments"],"summary":"Zernio path: like the comment. Queued for approval (202) while approval applies","parameters":[{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Post id (platform)"},{"name":"childId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform comment id"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"},"reactionType":{"type":"string","description":"LinkedIn: the reaction to create (default LIKE)","enum":["LIKE","PRAISE","EMPATHY","INTEREST","APPRECIATION","ENTERTAINMENT"]}},"required":["accountId"]}}}},"responses":{"200":{"description":"{commentId, liked}","content":{"application/json":{"schema":{"type":"object","properties":{"commentId":{"type":"string"},"liked":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Comments"],"summary":"Zernio path: remove the like. Queued for approval (202) while approval applies","parameters":[{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Post id (platform)"},{"name":"childId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform comment id"}],"responses":{"200":{"description":"{commentId, liked}","content":{"application/json":{"schema":{"type":"object","properties":{"commentId":{"type":"string"},"liked":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/comments/{commentId}/{childId}/pin":{"post":{"tags":["Comments"],"summary":"Pin a top-level comment to the top of the post, where supported (else 400 not_supported). Queued for approval (202) while approval applies","parameters":[{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Post id (platform)"},{"name":"childId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform comment id"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"},"postId":{"type":"string","description":"Platform post id (some platforms need it)"}}}}}},"responses":{"200":{"description":"{commentId, pinned}","content":{"application/json":{"schema":{"type":"object","properties":{"commentId":{"type":"string"},"pinned":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Comments"],"summary":"Unpin the comment. Queued for approval (202) while approval applies","parameters":[{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Post id (platform)"},{"name":"childId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform comment id"},{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Account id (or in the JSON body)"}],"responses":{"200":{"description":"{commentId, pinned}","content":{"application/json":{"schema":{"type":"object","properties":{"commentId":{"type":"string"},"pinned":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/comments/{commentId}/{childId}/private-reply":{"post":{"tags":["Comments"],"summary":"Send a direct message to the author of the comment (Instagram, Facebook private replies; else 400 not_supported). Queued for approval (202) while approval applies","parameters":[{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Post id (platform)"},{"name":"childId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform comment id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"},"message":{"type":"string","maxLength":1000},"text":{"type":"string","description":"Alias of message"}},"required":["accountId"]}}}},"responses":{"200":{"description":"{commentId, accountId, platform, messageId, recipientId}","content":{"application/json":{"schema":{"type":"object","properties":{"commentId":{"type":"string"},"accountId":{"type":"string"},"platform":{"type":"string"},"messageId":{"type":"string"},"recipientId":{"type":["string","null"]}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/posts/{postId}/like":{"post":{"tags":["Comments"],"summary":"Like a post as the account, where supported (else 400 not_supported). postId: the platform post id (a Postgale post id works for posts it published). Queued for approval (202) while approval applies","parameters":[{"name":"postId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform post id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"},"reactionType":{"type":"string","description":"LinkedIn: the reaction to create (default LIKE)","enum":["LIKE","PRAISE","EMPATHY","INTEREST","APPRECIATION","ENTERTAINMENT"]}},"required":["accountId"]}}}},"responses":{"200":{"description":"{accountId, platformPostId, liked}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"platformPostId":{"type":"string"},"liked":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Comments"],"summary":"Remove the account's like from a post. Queued for approval (202) while approval applies","parameters":[{"name":"postId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform post id"},{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Account id (or in the JSON body)"}],"responses":{"200":{"description":"{accountId, platformPostId, liked}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"platformPostId":{"type":"string"},"liked":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/posts/{id}/pin":{"post":{"tags":["Published posts"],"summary":"Pin the published post to the top of its Page (Facebook; else 400 platform_not_supported). Without accountId, the only target that supports it. Queued for approval (202) while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Postgale post id"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"}}}}}},"responses":{"200":{"description":"{postId, accountId, platform, pinned}","content":{"application/json":{"schema":{"type":"object","properties":{"postId":{"type":"string"},"accountId":{"type":"string"},"platform":{"type":"string"},"pinned":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/posts/{id}/unpin":{"post":{"tags":["Published posts"],"summary":"Unpin the published post. Queued for approval (202) while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Postgale post id"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"}}}}}},"responses":{"200":{"description":"{postId, accountId, platform, pinned}","content":{"application/json":{"schema":{"type":"object","properties":{"postId":{"type":"string"},"accountId":{"type":"string"},"platform":{"type":"string"},"pinned":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/posts/{id}/retry":{"post":{"tags":["Posts"],"summary":"Retry a failed or partially published post now: failed targets get a fresh attempt budget, then the post is published again (approval policy applies)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Postgale post id"}],"responses":{"200":{"description":"{post, status}","content":{"application/json":{"schema":{"type":"object","properties":{"post":{"$ref":"#/components/schemas/Post"},"status":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/posts/{id}/review":{"post":{"tags":["Posts"],"summary":"Zernio's review endpoint. reject closes a post awaiting approval; approve answers 403 human_approval_required (a person approves in the dashboard)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Postgale post id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string","enum":["approve","reject"]}},"required":["action"]}}}},"responses":{"200":{"description":"{postId, status}","content":{"application/json":{"schema":{"type":"object","properties":{"postId":{"type":"string"},"status":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/posts/bulk-upload":{"post":{"tags":["Posts"],"summary":"Create posts from a CSV (multipart field file, or a text/csv body). Columns: platforms, profiles (id or name), post_content (content), schedule_time (scheduledFor) with tz, publish_now, is_draft, media_urls, and per-platform schedule_time_<p>, custom_content_<p>, custom_media_<p>. One post per row (per distinct per-platform schedule). dryRun=true validates only. 5000 rows max. 207 when some rows failed","parameters":[{"name":"dryRun","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]},"description":"Validate without creating posts"}],"responses":{"200":{"description":"{total, valid, invalid, results, warnings}","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"valid":{"type":"integer"},"invalid":{"type":"integer"},"results":{"type":"array","items":{"type":"object","properties":{"rowIndex":{"type":"integer"},"ok":{"type":"boolean"},"createdPostId":{"type":"string"},"createdPostIds":{"type":"array","items":{"type":"string"}},"errors":{"type":"array","items":{"type":"string"}}}}},"warnings":{"type":"array","items":{"type":"string"}}}}}}},"207":{"description":"{total, valid, invalid, results, warnings}","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"valid":{"type":"integer"},"invalid":{"type":"integer"},"results":{"type":"array","items":{"type":"object","properties":{"rowIndex":{"type":"integer"},"ok":{"type":"boolean"},"createdPostId":{"type":"string"},"createdPostIds":{"type":"array","items":{"type":"string"}},"errors":{"type":"array","items":{"type":"string"}}}}},"warnings":{"type":"array","items":{"type":"string"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/accounts/{id}/posts":{"get":{"tags":["Accounts"],"summary":"The account's most recent posts as they exist on the platform (published through Postgale or not), with postgalePostId when Postgale published them. Where supported (else 400 not_supported)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":"Maximum items (default 25, max 100)"}],"responses":{"200":{"description":"{accountId, platform, posts}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string"},"posts":{"type":"array","items":{"type":"object","properties":{"platformPostId":{"type":"string"},"text":{"type":"string"},"url":{"type":"string"},"mediaType":{"type":"string"},"mediaUrl":{"type":"string"},"thumbnailUrl":{"type":"string"},"publishedAt":{"type":"string"},"metrics":{"type":"object"},"postgalePostId":{"type":["string","null"]}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/comments/{commentId}/reply":{"post":{"tags":["Comments"],"summary":"Reply to a comment as the account","parameters":[{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform comment id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"},"text":{"type":"string","maxLength":10000}},"required":["accountId","text"]}}}},"responses":{"201":{"description":"{reply}","content":{"application/json":{"schema":{"type":"object","properties":{"reply":{"type":"object","properties":{"id":{"type":"string"},"platform":{"type":"string"},"accountId":{"type":"string"},"parentId":{"type":"string"}}}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/comments/{commentId}/hide":{"post":{"tags":["Comments"],"summary":"Hide a comment (Instagram, Facebook, Threads replies)","parameters":[{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform comment id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"}},"required":["accountId"]}}}},"responses":{"200":{"description":"{commentId, hidden}","content":{"application/json":{"schema":{"type":"object","properties":{"commentId":{"type":"string"},"hidden":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Comments"],"summary":"Unhide a comment","parameters":[{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform comment id"},{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Account id (or in the JSON body)"}],"responses":{"200":{"description":"{commentId, hidden}","content":{"application/json":{"schema":{"type":"object","properties":{"commentId":{"type":"string"},"hidden":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/comments/{commentId}/like":{"post":{"tags":["Comments"],"summary":"Like a comment as the account (Facebook, X, Bluesky). Bluesky: pass the comment's cid (looked up when absent) and keep the returned likeUri to unlike","parameters":[{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform comment id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"},"reactionType":{"type":"string","description":"LinkedIn: the reaction to create (default LIKE)","enum":["LIKE","PRAISE","EMPATHY","INTEREST","APPRECIATION","ENTERTAINMENT"]}},"required":["accountId"]}}}},"responses":{"200":{"description":"{commentId, liked, likeUri?}","content":{"application/json":{"schema":{"type":"object","properties":{"commentId":{"type":"string"},"liked":{"type":"boolean"},"likeUri":{"type":"string","description":"Bluesky: URI of the like record"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Comments"],"summary":"Remove the like (Facebook, X, Bluesky)","parameters":[{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Platform comment id"},{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Account id (or in the JSON body)"},{"name":"likeUri","in":"query","required":false,"schema":{"type":"string"},"description":"Bluesky: the likeUri returned by the like (looked up when absent)"}],"responses":{"200":{"description":"{commentId, liked}","content":{"application/json":{"schema":{"type":"object","properties":{"commentId":{"type":"string"},"liked":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/events":{"get":{"tags":["Comments"],"summary":"Inbound events from Meta webhooks for this organization's accounts, newest first","parameters":[{"name":"kind","in":"query","required":false,"schema":{"type":"string","enum":["comment","mention","reply","feed","message","template","quality","other"]},"description":"Only this kind"},{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this account"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"description":"Maximum items (default 50, max 100)"}],"responses":{"200":{"description":"{events}","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/InboundEvent"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/inbox/conversations":{"post":{"tags":["Messages"],"summary":"Start a conversation (X and Bluesky; Meta platforms only allow replies): sends the FIRST live DM to participantId or participantUsername. X: text ≤10,000 or one attachment (mediaUrl or mediaId); X answers 403 when the person does not accept DMs from the account. Bluesky: participantUsername is a handle, participantId a DID; text only (≤1000). Queued for approval (202) while approval applies","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"X account id"},"participantId":{"type":"string","description":"Numeric X user id, or a Bluesky DID"},"participantUsername":{"type":"string","description":"@username or Bluesky handle (instead of participantId)"},"text":{"type":"string","maxLength":10000},"mediaUrl":{"type":"string","description":"Public https URL of an image, GIF or video"},"mediaId":{"type":"string","description":"Id of an uploaded media"},"attachmentType":{"type":"string","enum":["image","video"]}},"required":["accountId"]}}}},"responses":{"201":{"description":"{message, conversation}","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/Message"},"conversation":{"$ref":"#/components/schemas/Conversation"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"get":{"tags":["Messages"],"summary":"Direct-message conversations of this organization (Instagram, Messenger, WhatsApp, X, Bluesky), latest message first. Filled by inbound webhooks, the X and Bluesky inbox polls and POST /inbox/conversations/sync","parameters":[{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this account"},{"name":"platform","in":"query","required":false,"schema":{"type":"string","enum":["instagram","facebook","whatsapp","x","bluesky"]},"description":"Only this platform"},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["active","archived"]},"description":"Only this status"},{"name":"unread","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]},"description":"true: only conversations with unread messages; false: only read ones"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":"Maximum items (default 25, max 100)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor of the previous page"}],"responses":{"200":{"description":"{conversations, nextCursor}","content":{"application/json":{"schema":{"type":"object","properties":{"conversations":{"type":"array","items":{"$ref":"#/components/schemas/Conversation"}},"nextCursor":{"type":["string","null"],"description":"Pass as cursor for the next page"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/inbox/conversations/sync":{"post":{"tags":["Messages"],"summary":"Backfill conversations from Meta for an account: up to pages × limit conversations, each with its latest messages (Meta returns details for the 20 most recent messages only). Idempotent; no customer webhooks are emitted","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"},"limit":{"type":"integer","minimum":1,"maximum":100,"default":25,"description":"Conversations per page"},"pages":{"type":"integer","minimum":1,"maximum":10,"default":3}},"required":["accountId"]}}}},"responses":{"200":{"description":"{accountId, platform, conversations, messages}: conversations seen and new messages stored","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string"},"conversations":{"type":"integer"},"messages":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/conversations/{id}":{"get":{"tags":["Messages"],"summary":"One conversation, including its messagingWindow","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Conversation id"}],"responses":{"200":{"description":"{conversation}","content":{"application/json":{"schema":{"type":"object","properties":{"conversation":{"$ref":"#/components/schemas/Conversation"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"tags":["Messages"],"summary":"Archive or unarchive a conversation (Postgale only; a new inbound message makes it active again)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Conversation id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["active","archived"]}},"required":["status"]}}}},"responses":{"200":{"description":"{conversation}","content":{"application/json":{"schema":{"type":"object","properties":{"conversation":{"$ref":"#/components/schemas/Conversation"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Messages"],"summary":"Same as PATCH (Zernio's verb): archive or unarchive a conversation","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Conversation id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["active","archived"]}},"required":["status"]}}}},"responses":{"200":{"description":"{conversation}","content":{"application/json":{"schema":{"type":"object","properties":{"conversation":{"$ref":"#/components/schemas/Conversation"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Messages"],"summary":"Delete Postgale's stored copy of the conversation and its messages; nothing is deleted on the platform","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Conversation id"}],"responses":{"200":{"description":"{success, id}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"id":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/inbox/conversations/{id}/messages":{"get":{"tags":["Messages"],"summary":"Messages of a conversation, oldest → newest within the page; before pages back in time","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Conversation id"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"description":"Maximum items (default 50, max 100)"},{"name":"before","in":"query","required":false,"schema":{"type":"string"},"description":"nextBefore of the previous page"}],"responses":{"200":{"description":"{conversationId, messages, nextBefore}","content":{"application/json":{"schema":{"type":"object","properties":{"conversationId":{"type":"string"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/Message"}},"nextBefore":{"type":["string","null"],"description":"Pass as before for older messages"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Messages"],"summary":"Send a LIVE direct message to the participant: text (Instagram ≤1000, Messenger ≤2000 characters) or one attachment (mediaUrl or mediaId), not both. Allowed within 24 hours of the participant's last message, or within 7 days with tag HUMAN_AGENT (needs Meta's Human Agent permission); otherwise 409 outside_messaging_window without calling Meta. WhatsApp conversations take the WhatsAppOutbound fields (text ≤4096, mediaUrl / mediaId / whatsappMediaId with caption, template, interactive, location or reaction, replyTo; no tag): within 24 hours anything, outside only a template. 403 approval_required while approval applies; 403 missing_permission without the messaging permission. Emits message.sent","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Conversation id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","maxLength":2000},"mediaUrl":{"type":"string","description":"Public https URL of the attachment"},"mediaId":{"type":"string","description":"Id of an uploaded media (POST /media) with a publicUrl"},"attachmentType":{"type":"string","description":"Default: from the media MIME type or the URL extension (else image)","enum":["image","video","audio","file"]},"tag":{"type":"string","description":"Instagram/Messenger: human agent reply up to 7 days after the participant's last message","enum":["HUMAN_AGENT"]},"whatsappMediaId":{"type":"string","description":"WhatsApp: uploaded WhatsApp media id"},"caption":{"type":"string","description":"WhatsApp media caption"},"filename":{"type":"string","description":"WhatsApp document name"},"template":{"description":"WhatsApp: {name, language, components}"},"interactive":{"description":"WhatsApp: see WhatsAppOutbound"},"location":{"description":"WhatsApp: {latitude, longitude, name?, address?}"},"reaction":{"description":"WhatsApp: {messageId, emoji}"},"replyTo":{"type":"string","description":"WhatsApp: wamid of the quoted message; other platforms that list replyTo in their send options: the platform message id"},"message":{"type":"string","description":"Alias of text (Zernio)"},"attachmentUrl":{"type":"string","description":"Alias of mediaUrl (Zernio)"},"quickReplies":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string","maxLength":20},"payload":{"type":"string","maxLength":1000},"imageUrl":{"type":"string"}},"required":["title"]},"description":"Max 13. Where supported (else 400 not_supported); not with buttons"},"buttons":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["postback","url","phone"]},"title":{"type":"string","maxLength":20},"payload":{"type":"string"},"url":{"type":"string"},"phone":{"type":"string"}},"required":["title"]},"description":"Max 3. Where supported (else 400 not_supported); not with quickReplies"},"replyMarkup":{"type":"object","description":"Telegram keyboard markup"},"parseMode":{"type":"string","description":"Telegram","enum":["HTML","Markdown","MarkdownV2"]},"disableNotification":{"type":"boolean","description":"Telegram: deliver silently"},"protectContent":{"type":"boolean","description":"Telegram: no forwarding or saving"},"disableWebPagePreview":{"type":"boolean","description":"Telegram: no link preview"}}}}}},"responses":{"201":{"description":"{message, conversation}","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/Message"},"conversation":{"$ref":"#/components/schemas/Conversation"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/conversations/{id}/read":{"post":{"tags":["Messages"],"summary":"Mark the conversation read in Postgale (unreadCount 0) and, unless platform is false, as seen on Meta (mark_seen; WhatsApp: the latest inbound message is marked read; best effort: a failure or a closed messaging window is returned in warnings)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Conversation id"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"platform":{"type":"boolean","default":true,"description":"false: only mark read in Postgale"}}}}}},"responses":{"200":{"description":"{conversation, warnings?}","content":{"application/json":{"schema":{"type":"object","properties":{"conversation":{"$ref":"#/components/schemas/Conversation"},"warnings":{"type":"array","items":{"type":"string"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/inbox/conversations/{id}/sync":{"post":{"tags":["Messages"],"summary":"Fetch the latest messages of one conversation from Meta (needs platformConversationId from an account sync, else 409 sync_required). No customer webhooks are emitted","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Conversation id"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"limit":{"type":"integer","minimum":1,"maximum":100,"default":25}}}}}},"responses":{"200":{"description":"{conversationId, messages}: new messages stored","content":{"application/json":{"schema":{"type":"object","properties":{"conversationId":{"type":"string"},"messages":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/conversations/search":{"get":{"tags":["Messages"],"summary":"Search conversations by participant (name, username, phone) and by message text, most recent match first. Each result carries match: {messageId, text} or {participant: true}","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":2,"maxLength":200},"description":"Search text"},{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this account"},{"name":"platform","in":"query","required":false,"schema":{"type":"string"},"description":"Only this platform"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":"Maximum items (default 25, max 100)"}],"responses":{"200":{"description":"{conversations}","content":{"application/json":{"schema":{"type":"object","properties":{"conversations":{"type":"array","items":{"$ref":"#/components/schemas/Conversation"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/inbox/conversations/{id}/messages/{messageId}":{"patch":{"tags":["Messages"],"summary":"Edit a message the account sent, where the platform allows it (else 400 not_supported). messageId is the Postgale id or the platform message id. Queued for approval (202) while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Conversation id"},{"name":"messageId","in":"path","required":true,"schema":{"type":"string"},"description":"Message id (Postgale or platform id)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","maxLength":4096},"message":{"type":"string","description":"Alias of text (Zernio)"},"replyMarkup":{"type":"object","description":"Telegram: a new {inline_keyboard} for the message (text is then optional)"}}}}}},"responses":{"200":{"description":"{message}","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/Message"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Messages"],"summary":"Delete a message on the platform where supported (else 400 not_supported); the stored copy is kept with isDeleted. Queued for approval (202) while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Conversation id"},{"name":"messageId","in":"path","required":true,"schema":{"type":"string"},"description":"Message id (Postgale or platform id)"}],"responses":{"200":{"description":"{message}","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/Message"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/conversations/{id}/messages/{messageId}/reactions":{"post":{"tags":["Messages"],"summary":"Add the account's emoji reaction to a message, where supported (WhatsApp: send a reaction message instead). Queued for approval (202) while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Conversation id"},{"name":"messageId","in":"path","required":true,"schema":{"type":"string"},"description":"Message id (Postgale or platform id)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"emoji":{"type":"string"}},"required":["emoji"]}}}},"responses":{"200":{"description":"{message}","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/Message"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Messages"],"summary":"Remove the account's reaction from a message. Queued for approval (202) while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Conversation id"},{"name":"messageId","in":"path","required":true,"schema":{"type":"string"},"description":"Message id (Postgale or platform id)"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"emoji":{"type":"string"}}}}}},"responses":{"200":{"description":"{message}","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/Message"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/conversations/{id}/messages/{messageId}/attachments/{index}":{"get":{"tags":["Messages"],"summary":"One attachment of a message as a URL that works now; authenticated: true when the URL is a Postgale route that needs the API key (WhatsApp media)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Conversation id"},{"name":"messageId","in":"path","required":true,"schema":{"type":"string"},"description":"Message id (Postgale or platform id)"},{"name":"index","in":"path","required":true,"schema":{"type":"string"},"description":"Attachment index (0-based)"}],"responses":{"200":{"description":"{type, url, mimeType, authenticated?}","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"url":{"type":"string"},"mimeType":{"type":["string","null"]},"authenticated":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/inbox/conversations/{id}/typing":{"post":{"tags":["Messages"],"summary":"Show (or with on: false, clear) a typing indicator, where the platform supports it (else 400 not_supported)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Conversation id"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"on":{"type":"boolean","default":true}}}}}},"responses":{"200":{"description":"{success}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/media/upload-direct":{"post":{"tags":["Media"],"summary":"Zernio's direct upload path: the same as POST /media (multipart file, or JSON {url})","responses":{"201":{"description":"{media}","content":{"application/json":{"schema":{"type":"object","properties":{"media":{"$ref":"#/components/schemas/Media"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"413":{"$ref":"#/components/responses/TooLarge"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/x/accounts/{id}/reposts":{"post":{"tags":["X"],"summary":"Repost. LIVE and public (except bookmarks); queued for approval (202) while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"X account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"postId":{"type":"string","description":"X post id or post URL"}},"required":["postId"]}}}},"responses":{"200":{"description":"{accountId, action, undo, target, reposted | liked | bookmarked | following}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"action":{"type":"string","enum":["repost","like","bookmark","follow"]},"undo":{"type":"boolean"},"target":{"type":"string"},"reposted":{"type":"boolean"},"liked":{"type":"boolean"},"bookmarked":{"type":"boolean"},"following":{"type":"boolean"},"pendingFollow":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["X"],"summary":"Undo a repost. Body or query: same fields as POST","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"X account id"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"postId":{"type":"string","description":"X post id or post URL"}},"required":["postId"]}}}},"responses":{"200":{"description":"{accountId, action, undo, target, reposted | liked | bookmarked | following}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"action":{"type":"string","enum":["repost","like","bookmark","follow"]},"undo":{"type":"boolean"},"target":{"type":"string"},"reposted":{"type":"boolean"},"liked":{"type":"boolean"},"bookmarked":{"type":"boolean"},"following":{"type":"boolean"},"pendingFollow":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/x/accounts/{id}/likes":{"post":{"tags":["X"],"summary":"Like (X allows API likes only with Enterprise access since 2026-04-20). LIVE and public (except bookmarks); queued for approval (202) while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"X account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"postId":{"type":"string","description":"X post id or post URL"}},"required":["postId"]}}}},"responses":{"200":{"description":"{accountId, action, undo, target, reposted | liked | bookmarked | following}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"action":{"type":"string","enum":["repost","like","bookmark","follow"]},"undo":{"type":"boolean"},"target":{"type":"string"},"reposted":{"type":"boolean"},"liked":{"type":"boolean"},"bookmarked":{"type":"boolean"},"following":{"type":"boolean"},"pendingFollow":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["X"],"summary":"Unlike. Body or query: same fields as POST","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"X account id"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"postId":{"type":"string","description":"X post id or post URL"}},"required":["postId"]}}}},"responses":{"200":{"description":"{accountId, action, undo, target, reposted | liked | bookmarked | following}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"action":{"type":"string","enum":["repost","like","bookmark","follow"]},"undo":{"type":"boolean"},"target":{"type":"string"},"reposted":{"type":"boolean"},"liked":{"type":"boolean"},"bookmarked":{"type":"boolean"},"following":{"type":"boolean"},"pendingFollow":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/x/accounts/{id}/bookmarks":{"post":{"tags":["X"],"summary":"Bookmark (private). LIVE and public (except bookmarks); queued for approval (202) while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"X account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"postId":{"type":"string","description":"X post id or post URL"}},"required":["postId"]}}}},"responses":{"200":{"description":"{accountId, action, undo, target, reposted | liked | bookmarked | following}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"action":{"type":"string","enum":["repost","like","bookmark","follow"]},"undo":{"type":"boolean"},"target":{"type":"string"},"reposted":{"type":"boolean"},"liked":{"type":"boolean"},"bookmarked":{"type":"boolean"},"following":{"type":"boolean"},"pendingFollow":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["X"],"summary":"Remove a bookmark. Body or query: same fields as POST","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"X account id"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"postId":{"type":"string","description":"X post id or post URL"}},"required":["postId"]}}}},"responses":{"200":{"description":"{accountId, action, undo, target, reposted | liked | bookmarked | following}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"action":{"type":"string","enum":["repost","like","bookmark","follow"]},"undo":{"type":"boolean"},"target":{"type":"string"},"reposted":{"type":"boolean"},"liked":{"type":"boolean"},"bookmarked":{"type":"boolean"},"following":{"type":"boolean"},"pendingFollow":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/x/accounts/{id}/following":{"post":{"tags":["X"],"summary":"Follow a user (X allows API follows only with Enterprise access since 2026-04-20); pendingFollow when the account is protected. LIVE and public (except bookmarks); queued for approval (202) while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"X account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","description":"Numeric X user id"},"username":{"type":"string","description":"@username (instead of userId)"}}}}}},"responses":{"200":{"description":"{accountId, action, undo, target, reposted | liked | bookmarked | following}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"action":{"type":"string","enum":["repost","like","bookmark","follow"]},"undo":{"type":"boolean"},"target":{"type":"string"},"reposted":{"type":"boolean"},"liked":{"type":"boolean"},"bookmarked":{"type":"boolean"},"following":{"type":"boolean"},"pendingFollow":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["X"],"summary":"Unfollow. Body or query: same fields as POST","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"X account id"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","description":"Numeric X user id"},"username":{"type":"string","description":"@username (instead of userId)"}}}}}},"responses":{"200":{"description":"{accountId, action, undo, target, reposted | liked | bookmarked | following}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"action":{"type":"string","enum":["repost","like","bookmark","follow"]},"undo":{"type":"boolean"},"target":{"type":"string"},"reposted":{"type":"boolean"},"liked":{"type":"boolean"},"bookmarked":{"type":"boolean"},"following":{"type":"boolean"},"pendingFollow":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/x/accounts/{id}/search":{"get":{"tags":["X"],"summary":"Recent search (last 7 days) as the account, X search syntax. Every post returned is billed by X as a post read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"X account id"},{"name":"query","in":"query","required":true,"schema":{"type":"string","maxLength":512},"description":"X search query"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":10,"maximum":100,"default":25},"description":"Max posts"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor of the previous page"},{"name":"sortOrder","in":"query","required":false,"schema":{"type":"string","enum":["recency","relevancy"]},"description":"Order"}],"responses":{"200":{"description":"{accountId, query, posts, nextCursor}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"query":{"type":"string"},"posts":{"type":"array","items":{"$ref":"#/components/schemas/XPost"}},"nextCursor":{"type":["string","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/twitter/retweet":{"post":{"tags":["X"],"summary":"Repost a post (Zernio path; the account in the body). LIVE and public (except bookmarks); queued for approval (202) while approval applies","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"X account id"},"tweetId":{"type":"string"}},"required":["accountId","tweetId"]}}}},"responses":{"200":{"description":"{accountId, action, undo, target, reposted | liked | bookmarked | following}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"action":{"type":"string","enum":["repost","like","bookmark","follow"]},"undo":{"type":"boolean"},"target":{"type":"string"},"reposted":{"type":"boolean"},"liked":{"type":"boolean"},"bookmarked":{"type":"boolean"},"following":{"type":"boolean"},"pendingFollow":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["X"],"summary":"Undo a repost. Body or query: accountId and tweetId","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"X account id"},"tweetId":{"type":"string"}},"required":["accountId","tweetId"]}}}},"responses":{"200":{"description":"{accountId, action, undo, target, reposted | liked | bookmarked | following}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"action":{"type":"string","enum":["repost","like","bookmark","follow"]},"undo":{"type":"boolean"},"target":{"type":"string"},"reposted":{"type":"boolean"},"liked":{"type":"boolean"},"bookmarked":{"type":"boolean"},"following":{"type":"boolean"},"pendingFollow":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/twitter/bookmark":{"post":{"tags":["X"],"summary":"Bookmark a post (private) (Zernio path; the account in the body). LIVE and public (except bookmarks); queued for approval (202) while approval applies","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"X account id"},"tweetId":{"type":"string"}},"required":["accountId","tweetId"]}}}},"responses":{"200":{"description":"{accountId, action, undo, target, reposted | liked | bookmarked | following}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"action":{"type":"string","enum":["repost","like","bookmark","follow"]},"undo":{"type":"boolean"},"target":{"type":"string"},"reposted":{"type":"boolean"},"liked":{"type":"boolean"},"bookmarked":{"type":"boolean"},"following":{"type":"boolean"},"pendingFollow":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["X"],"summary":"Remove a bookmark. Body or query: accountId and tweetId","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"X account id"},"tweetId":{"type":"string"}},"required":["accountId","tweetId"]}}}},"responses":{"200":{"description":"{accountId, action, undo, target, reposted | liked | bookmarked | following}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"action":{"type":"string","enum":["repost","like","bookmark","follow"]},"undo":{"type":"boolean"},"target":{"type":"string"},"reposted":{"type":"boolean"},"liked":{"type":"boolean"},"bookmarked":{"type":"boolean"},"following":{"type":"boolean"},"pendingFollow":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/twitter/follow":{"post":{"tags":["X"],"summary":"Follow a user (X allows API follows only with Enterprise access since 2026-04-20) (Zernio path; the account in the body). LIVE and public (except bookmarks); queued for approval (202) while approval applies","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"X account id"},"targetUserId":{"type":"string"}},"required":["accountId","targetUserId"]}}}},"responses":{"200":{"description":"{accountId, action, undo, target, reposted | liked | bookmarked | following}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"action":{"type":"string","enum":["repost","like","bookmark","follow"]},"undo":{"type":"boolean"},"target":{"type":"string"},"reposted":{"type":"boolean"},"liked":{"type":"boolean"},"bookmarked":{"type":"boolean"},"following":{"type":"boolean"},"pendingFollow":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["X"],"summary":"Unfollow. Body or query: accountId and targetUserId","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"X account id"},"targetUserId":{"type":"string"}},"required":["accountId","targetUserId"]}}}},"responses":{"200":{"description":"{accountId, action, undo, target, reposted | liked | bookmarked | following}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"action":{"type":"string","enum":["repost","like","bookmark","follow"]},"undo":{"type":"boolean"},"target":{"type":"string"},"reposted":{"type":"boolean"},"liked":{"type":"boolean"},"bookmarked":{"type":"boolean"},"following":{"type":"boolean"},"pendingFollow":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/twitter/tweet":{"get":{"tags":["X"],"summary":"One X post (Zernio path): text, author, url, public metrics","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"X account id"},{"name":"tweetId","in":"query","required":true,"schema":{"type":"string"},"description":"X post id or URL"}],"responses":{"200":{"description":"{accountId, post}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"post":{"$ref":"#/components/schemas/XPost"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/twitter/search":{"get":{"tags":["X"],"summary":"Recent search (Zernio path), last 7 days, X search syntax. Every post returned is billed by X","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"X account id"},{"name":"query","in":"query","required":true,"schema":{"type":"string"},"description":"X search query"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":"Maximum items (default 25, max 100)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor"},{"name":"sortOrder","in":"query","required":false,"schema":{"type":"string","enum":["recency","relevancy"]},"description":"Order"}],"responses":{"200":{"description":"{accountId, query, posts, nextCursor}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"query":{"type":"string"},"posts":{"type":"array","items":{"$ref":"#/components/schemas/XPost"}},"nextCursor":{"type":["string","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/x/accounts/{id}/posts/{postId}":{"get":{"tags":["X"],"summary":"One X post: text, author, url, public metrics","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"X account id"},{"name":"postId","in":"path","required":true,"schema":{"type":"string"},"description":"X post id"}],"responses":{"200":{"description":"{accountId, post}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"post":{"$ref":"#/components/schemas/XPost"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/x/accounts/{id}/users/{username}":{"get":{"tags":["X"],"summary":"One X user by @username: id, name, subscriptionType, verified, followers, receivesYourDm","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"X account id"},{"name":"username","in":"path","required":true,"schema":{"type":"string"},"description":"X username without @"}],"responses":{"200":{"description":"{accountId, user}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"user":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/numbers/available":{"get":{"tags":["WhatsApp"],"summary":"Numbers (voice + SMS) Postgale can buy now, with Postgale's monthly price. 403 numbers_disabled unless WHATSAPP_NUMBERS_ENABLED=1","parameters":[{"name":"country","in":"query","required":false,"schema":{"type":"string","enum":["US","CA"],"default":"US"},"description":"Country"},{"name":"areaCode","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{3}$"},"description":"3-digit area code"},{"name":"contains","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{1,10}$"},"description":"Digits the number contains"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":50,"default":10},"description":"Maximum items (default 10, max 50)"}],"responses":{"200":{"description":"{provider, country, priceCents, currency, numbers}","content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string"},"country":{"type":"string"},"priceCents":{"type":"integer"},"currency":{"type":"string"},"numbers":{"type":"array","items":{"type":"object","properties":{"phoneNumber":{"type":"string"},"countryCode":{"type":"string"},"locality":{"type":["string","null"]},"region":{"type":["string","null"]},"features":{"type":"array","items":{"type":"string"}},"priceCents":{"type":"integer"},"currency":{"type":"string"}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/numbers":{"get":{"tags":["WhatsApp"],"summary":"Numbers bought by Postgale for this organization, newest first, with the organization's limit and how many it holds","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"Only this status"}],"responses":{"200":{"description":"{numbers, limit, held}","content":{"application/json":{"schema":{"type":"object","properties":{"numbers":{"type":"array","items":{"$ref":"#/components/schemas/ProvisionedNumber"}},"limit":{"type":"integer"},"held":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["WhatsApp"],"summary":"Buy phoneNumber and connect it to the WABA of accountId (a connected WhatsApp account; its token is used): purchase (billing event number.purchase), POST /{waba}/phone_numbers, voice code request (SMS after WHATSAPP_OTP_VOICE_TIMEOUT_MIN), code captured from the carrier call, verify, register, new WhatsApp account (phone_number.provisioned). 403 number_limit_reached beyond the per-organization limit","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"phoneNumber":{"type":"string","description":"E.164, from /whatsapp/numbers/available"},"accountId":{"type":"string","description":"Connected WhatsApp account"},"verifiedName":{"type":"string","description":"WhatsApp display name"},"country":{"type":"string","enum":["US","CA"]}},"required":["phoneNumber","accountId","verifiedName"]}}}},"responses":{"201":{"description":"{number}","content":{"application/json":{"schema":{"type":"object","properties":{"number":{"$ref":"#/components/schemas/ProvisionedNumber"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/numbers/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Provisioned number id"}],"get":{"tags":["WhatsApp"],"summary":"One bought number; lastCode is the code captured in the last 10 minutes (manual Embedded Signup fallback: choose voice call and type it)","responses":{"200":{"description":"{number}","content":{"application/json":{"schema":{"type":"object","properties":{"number":{"$ref":"#/components/schemas/ProvisionedNumber"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["WhatsApp"],"summary":"Release the number now: deregistered (best effort), returned to the carrier, its account flagged needs_reconnect (phone_number.released). Idempotent","responses":{"200":{"description":"{number}","content":{"application/json":{"schema":{"type":"object","properties":{"number":{"$ref":"#/components/schemas/ProvisionedNumber"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/whatsapp/numbers/{id}/retry":{"post":{"tags":["WhatsApp"],"summary":"Retry a failed number from the step that failed","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Provisioned number id"}],"responses":{"200":{"description":"{number}","content":{"application/json":{"schema":{"type":"object","properties":{"number":{"$ref":"#/components/schemas/ProvisionedNumber"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/connect":{"post":{"tags":["WhatsApp"],"summary":"Connect a number with an existing token (system user or test token) instead of Embedded Signup: reads the number and the WABA with it, subscribes the app to the WABA and registers the number (failures are reported in onboarding, not as errors). The token is stored encrypted. Emits account.connected","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accessToken":{"type":"string","description":"Token with whatsapp_business_management and whatsapp_business_messaging"},"phoneNumberId":{"type":"string","description":"Cloud API phone number id"},"wabaId":{"type":"string","description":"WhatsApp Business Account id"},"pin":{"type":"string","description":"6-digit two-step verification PIN (default: random)","pattern":"^\\d{6}$"},"register":{"type":"boolean","default":true},"subscribe":{"type":"boolean","default":true},"externalId":{"type":"string","maxLength":200}},"required":["accessToken","phoneNumberId","wabaId"]}}}},"responses":{"201":{"description":"{account, whatsapp}","content":{"application/json":{"schema":{"type":"object","properties":{"account":{"$ref":"#/components/schemas/ConnectedAccount"},"whatsapp":{"$ref":"#/components/schemas/WhatsAppAccount"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/accounts/{id}/phone-number":{"get":{"tags":["WhatsApp"],"summary":"The number: display number, verified name, quality rating, messaging limit tier, name status, status and onboarding state; refresh=true reads it from Meta and saves it","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"refresh","in":"query","required":false,"schema":{"type":"string","enum":["true","1"]},"description":"Read the current values from Meta"}],"responses":{"200":{"description":"WhatsAppAccount","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppAccount"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/accounts/{id}/register":{"post":{"tags":["WhatsApp"],"summary":"Register (or re-register) the number for the Cloud API with pin, or a random 6-digit PIN (stored encrypted). Meta allows 10 attempts per 72 hours","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"pin":{"type":"string","pattern":"^\\d{6}$"}}}}}},"responses":{"200":{"description":"WhatsAppAccount","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppAccount"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/accounts/{id}/messages":{"post":{"tags":["WhatsApp"],"summary":"Send a LIVE WhatsApp message to to (phone), recipient (BSUID) or the participant of conversationId. Free-form types need the person to have written within 24 hours; templates are always allowed (409 outside_messaging_window before calling Meta). 403 approval_required while approval applies. Emits message.sent; statuses follow as message.status","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppSend"}}}},"responses":{"201":{"description":"{message, conversation}","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/Message"},"conversation":{"$ref":"#/components/schemas/Conversation"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/accounts/{id}/messages/{messageId}/read":{"post":{"tags":["WhatsApp"],"summary":"Mark an inbound message (and the earlier ones) read on WhatsApp; typing also shows the typing indicator (25 seconds or until the next message)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"messageId","in":"path","required":true,"schema":{"type":"string"},"description":"wamid of the inbound message"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"typing":{"type":"boolean","default":false}}}}}},"responses":{"200":{"description":"{accountId, messageId, read, typing}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"messageId":{"type":"string"},"read":{"type":"boolean"},"typing":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/accounts/{id}/templates":{"get":{"tags":["WhatsApp"],"summary":"Message templates of the account's WABA","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"APPROVED, PENDING, REJECTED, PAUSED, DISABLED, ..."},{"name":"name","in":"query","required":false,"schema":{"type":"string"},"description":"Name contains"},{"name":"category","in":"query","required":false,"schema":{"type":"string","enum":["MARKETING","UTILITY","AUTHENTICATION"]},"description":"Only this category"},{"name":"language","in":"query","required":false,"schema":{"type":"string"},"description":"e.g. en_US"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":"Maximum items (default 25, max 100)"},{"name":"after","in":"query","required":false,"schema":{"type":"string"},"description":"next of the previous page"}],"responses":{"200":{"description":"{accountId, wabaId, templates, next}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"wabaId":{"type":["string","null"]},"templates":{"type":"array","items":{"$ref":"#/components/schemas/Template"}},"next":{"type":["string","null"],"description":"Pass as after"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["WhatsApp"],"summary":"Submit a template for review (status PENDING; template.status reports the decision)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Lowercase letters, digits and underscores","pattern":"^[a-z0-9_]+$","maxLength":512},"language":{"type":"string","description":"e.g. en_US"},"category":{"type":"string","enum":["MARKETING","UTILITY","AUTHENTICATION"]},"components":{"type":"array","items":{"type":"object"},"description":"Meta components (BODY required), e.g. [{type:\"BODY\",text:\"Hi {{1}}\",example:{body_text:[[\"Ana\"]]}}]"},"parameterFormat":{"type":"string","enum":["positional","named"]},"allowCategoryChange":{"type":"boolean"}},"required":["name","language","category","components"]}}}},"responses":{"201":{"description":"{accountId, template}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"template":{"$ref":"#/components/schemas/Template"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/accounts/{id}/templates/{templateId}":{"get":{"tags":["WhatsApp"],"summary":"One template","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"templateId","in":"path","required":true,"schema":{"type":"string"},"description":"Template id"}],"responses":{"200":{"description":"{accountId, template}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"template":{"$ref":"#/components/schemas/Template"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["WhatsApp"],"summary":"Delete this template (this language); allLanguages=true deletes every language of its name. name skips looking the name up","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"templateId","in":"path","required":true,"schema":{"type":"string"},"description":"Template id"},{"name":"name","in":"query","required":false,"schema":{"type":"string"},"description":"Template name (default: read from the template)"},{"name":"allLanguages","in":"query","required":false,"schema":{"type":"string","enum":["true","1"]},"description":"Delete every language of the name"}],"responses":{"200":{"description":"{accountId, name, templateId, deleted}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"name":{"type":"string"},"templateId":{"type":["string","null"]},"deleted":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/accounts/{id}/media":{"post":{"tags":["WhatsApp"],"summary":"Upload a Postgale media (mediaId) or a public https URL (≤100 MB) to WhatsApp; send the returned id as whatsappMediaId (Meta keeps it 30 days)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mediaId":{"type":"string","description":"Postgale media id"},"url":{"type":"string","description":"Public https URL"},"mimeType":{"type":"string","description":"url: overrides the response Content-Type"},"fileName":{"type":"string"}},"description":"Exactly one of mediaId or url"}}}},"responses":{"201":{"description":"{accountId, media}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"media":{"type":"object","properties":{"id":{"type":"string","description":"WhatsApp media id"},"mimeType":{"type":"string"},"size":{"type":"integer"},"fileName":{"type":"string"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/accounts/{id}/media/{waMediaId}":{"get":{"tags":["WhatsApp"],"summary":"Media info; download=1 streams the bytes instead (Content-Type, Content-Length, Content-Disposition: attachment). Works for inbound attachment ids","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"waMediaId","in":"path","required":true,"schema":{"type":"string"},"description":"WhatsApp media id"},{"name":"download","in":"query","required":false,"schema":{"type":"string","enum":["1","true"]},"description":"Stream the bytes"}],"responses":{"200":{"description":"MediaInfo as {accountId, media}, or the file with download=1","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"media":{"$ref":"#/components/schemas/MediaInfo"}}}},"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["WhatsApp"],"summary":"Delete the media from WhatsApp","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"waMediaId","in":"path","required":true,"schema":{"type":"string"},"description":"WhatsApp media id"}],"responses":{"200":{"description":"{accountId, mediaId, deleted}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"mediaId":{"type":"string"},"deleted":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/analytics/posts/{id}":{"get":{"tags":["Analytics"],"summary":"Insights of each published target of a post (stored for best-time analysis). Bluesky: likes, comments (replies), shares (reposts + quotes), replies, reposts, quotes","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Postgale post id"},{"name":"metrics","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated metric names instead of the defaults (IG feed: reach,likes,comments,shares,saved,total_interactions,views; FB: post_media_view,post_reactions_by_type_total,post_clicks; Threads: views,likes,replies,reposts,quotes,shares)"},{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this target"}],"responses":{"200":{"description":"{postId, targets}","content":{"application/json":{"schema":{"type":"object","properties":{"postId":{"type":"string"},"targets":{"type":"array","items":{"type":"object","properties":{"targetId":{"type":"string"},"accountId":{"type":"string"},"platform":{"type":"string"},"platformPostId":{"type":"string"},"publishedAt":{"type":["string","null"],"format":"date-time"},"metrics":{"type":"object","additionalProperties":{"type":"number"}},"metricsAt":{"type":"string","format":"date-time"},"unavailable":{"type":"array","items":{"type":"string"},"description":"Requested metrics the platform could not return for this post (the others are still returned)"},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/analytics/accounts/{id}":{"get":{"tags":["Analytics"],"summary":"Account insights (Instagram, Facebook Page, Threads, TikTok, X; Telegram: followers = member count; Discord, Bluesky and Mastodon have no analytics → not_supported)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"},{"name":"metrics","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated metrics (IG default reach,views,accounts_engaged,...; FB page_media_view,page_post_engagements,page_follows,page_views_total — page_impressions/page_fans were removed; Threads views,likes,replies,reposts,quotes,clicks,followers_count)"},{"name":"period","in":"query","required":false,"schema":{"type":"string"},"description":"day (default) | week | days_28 | lifetime"},{"name":"since","in":"query","required":false,"schema":{"type":"string"},"description":"ISO date or unix seconds"},{"name":"until","in":"query","required":false,"schema":{"type":"string"},"description":"ISO date or unix seconds"},{"name":"metricType","in":"query","required":false,"schema":{"type":"string","enum":["total_value","time_series"]},"description":"Instagram (default total_value)"},{"name":"breakdown","in":"query","required":false,"schema":{"type":"string"},"description":"Instagram breakdown"},{"name":"timeframe","in":"query","required":false,"schema":{"type":"string"},"description":"Instagram timeframe"}],"responses":{"200":{"description":"{accountId, platform, metrics}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string"},"metrics":{"type":"array","items":{"$ref":"#/components/schemas/InsightSeries"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/analytics/accounts/{id}/demographics":{"get":{"tags":["Analytics"],"summary":"Audience demographics (Instagram needs 100+ followers; Threads follower_demographics only)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"},{"name":"breakdown","in":"query","required":false,"schema":{"type":"string","enum":["age","city","country","gender"],"default":"country"},"description":"Breakdown"},{"name":"metric","in":"query","required":false,"schema":{"type":"string","enum":["follower_demographics","engaged_audience_demographics","reached_audience_demographics"]},"description":"Default follower_demographics"},{"name":"timeframe","in":"query","required":false,"schema":{"type":"string"},"description":"Instagram: this_month (default) | this_week"}],"responses":{"200":{"description":"{accountId, platform, metric, breakdown, timeframe?, results}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string"},"metric":{"type":"string"},"breakdown":{"type":"string"},"timeframe":{"type":"string"},"results":{"type":"array","items":{"type":"object","properties":{"dimension":{"type":"string"},"value":{"type":"number"}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/analytics/accounts/{id}/online-followers":{"get":{"tags":["Analytics"],"summary":"Followers online per hour (Instagram; Meta may return none)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{accountId, platform, hours}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string"},"hours":{"type":"object","additionalProperties":{"type":"number"},"description":"\"0\"..\"23\" → followers"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/analytics":{"get":{"tags":["Analytics"],"summary":"With postId: live insights of one post (as /analytics/posts/{id}). Without: posts published in the window with their latest stored metrics, engagement rate and overview totals","parameters":[{"name":"postId","in":"query","required":false,"schema":{"type":"string"},"description":"One Postgale post (live insights)"},{"name":"profileId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this profile"},{"name":"platform","in":"query","required":false,"schema":{"type":"string"},"description":"Only this platform"},{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this account"},{"name":"source","in":"query","required":false,"schema":{"type":"string","enum":["postgale","late","external"]},"description":"Posts published through Postgale (late is Zernio's name) or imported from the platform"},{"name":"fromDate","in":"query","required":false,"schema":{"type":"string"},"description":"First day, YYYY-MM-DD (default: 90 days ago)"},{"name":"toDate","in":"query","required":false,"schema":{"type":"string"},"description":"Last day, YYYY-MM-DD (default: today)"},{"name":"sortBy","in":"query","required":false,"schema":{"type":"string","enum":["date","engagement"]},"description":"Order"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"description":"Maximum items (default 50, max 100)"},{"name":"page","in":"query","required":false,"schema":{"type":"integer"},"description":"Page (1-based)"}],"responses":{"200":{"description":"{overview, posts, pagination} or {postId, targets}","content":{"application/json":{"schema":{"type":"object","properties":{"overview":{"type":"object"},"posts":{"type":"array","items":{"type":"object"}},"pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"pages":{"type":"integer"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/analytics/dashboard":{"get":{"tags":["Analytics"],"summary":"One call for a dashboard: window totals (engagement received each day, so totals are the sum of daily), follower growth, a per-day series, top posts by engagement and recent posts with lifetime metrics; compare=previous_period adds the same figures for the previous window. UTC days, at most 366","parameters":[{"name":"fromDate","in":"query","required":true,"schema":{"type":"string"},"description":"First day (YYYY-MM-DD)"},{"name":"toDate","in":"query","required":true,"schema":{"type":"string"},"description":"Last day (YYYY-MM-DD)"},{"name":"profileId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this profile"},{"name":"platform","in":"query","required":false,"schema":{"type":"string"},"description":"Only this platform"},{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this account"},{"name":"source","in":"query","required":false,"schema":{"type":"string","enum":["postgale","late","external"]},"description":"Posts published through Postgale (late is Zernio's name) or imported from the platform"},{"name":"compare","in":"query","required":false,"schema":{"type":"string","enum":["previous_period"]},"description":"Also the previous period"},{"name":"topPosts","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":50},"description":"How many top posts (default 5)"},{"name":"recentPosts","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":50},"description":"How many recent posts (default 5)"}],"responses":{"200":{"description":"Dashboard","content":{"application/json":{"schema":{"type":"object","properties":{"dateRange":{"type":"object","properties":{"fromDate":{"type":"string"},"toDate":{"type":"string"}}},"totals":{"type":"object"},"previousTotals":{"type":"object"},"followers":{"type":"object","properties":{"total":{"type":"integer"},"start":{"type":"integer"},"gained":{"type":"integer"}}},"previousFollowers":{"type":"object"},"daily":{"type":"array","items":{"type":"object"}},"topPosts":{"type":"array","items":{"type":"object"}},"recentPosts":{"type":"array","items":{"type":"object"}},"dataAsOf":{"type":["string","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/analytics/daily-metrics":{"get":{"tags":["Analytics"],"summary":"Per-day post count, platform distribution and summed metrics (impressions, reach, likes, comments, shares, saves, clicks, views) plus per-platform totals. attribution publish (default) puts each post's lifetime totals on its publish day; received puts each day's increase on the day it arrived","parameters":[{"name":"profileId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this profile"},{"name":"platform","in":"query","required":false,"schema":{"type":"string"},"description":"Only this platform"},{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this account"},{"name":"source","in":"query","required":false,"schema":{"type":"string","enum":["postgale","late","external"]},"description":"Posts published through Postgale (late is Zernio's name) or imported from the platform"},{"name":"fromDate","in":"query","required":false,"schema":{"type":"string"},"description":"First day, YYYY-MM-DD (default: 180 days ago)"},{"name":"toDate","in":"query","required":false,"schema":{"type":"string"},"description":"Last day, YYYY-MM-DD (default: today)"},{"name":"attribution","in":"query","required":false,"schema":{"type":"string","enum":["publish","received"]},"description":"Default publish"}],"responses":{"200":{"description":"{dailyData, platformBreakdown, attribution}","content":{"application/json":{"schema":{"type":"object","properties":{"dailyData":{"type":"array","items":{"type":"object"}},"platformBreakdown":{"type":"array","items":{"type":"object"}},"attribution":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/analytics/post-timeline":{"get":{"tags":["Analytics"],"summary":"Day-by-day lifetime metrics of one post, one row per day and platform","parameters":[{"name":"postId","in":"query","required":true,"schema":{"type":"string"},"description":"Postgale post or target id, or a platform post id"},{"name":"fromDate","in":"query","required":false,"schema":{"type":"string"},"description":"First day, YYYY-MM-DD (default: 90 days ago)"},{"name":"toDate","in":"query","required":false,"schema":{"type":"string"},"description":"Last day, YYYY-MM-DD (default: today)"}],"responses":{"200":{"description":"{postId, timeline}","content":{"application/json":{"schema":{"type":"object","properties":{"postId":{"type":"string"},"timeline":{"type":"array","items":{"type":"object"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/analytics/posting-frequency":{"get":{"tags":["Analytics"],"summary":"Calendar weeks grouped by how many posts were published, with the average engagement and engagement rate of their posts","parameters":[{"name":"profileId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this profile"},{"name":"platform","in":"query","required":false,"schema":{"type":"string"},"description":"Only this platform"},{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this account"},{"name":"source","in":"query","required":false,"schema":{"type":"string","enum":["postgale","late","external"]},"description":"Posts published through Postgale (late is Zernio's name) or imported from the platform"},{"name":"fromDate","in":"query","required":false,"schema":{"type":"string"},"description":"First day, YYYY-MM-DD (default: 365 days ago)"},{"name":"toDate","in":"query","required":false,"schema":{"type":"string"},"description":"Last day, YYYY-MM-DD (default: today)"}],"responses":{"200":{"description":"{frequency}","content":{"application/json":{"schema":{"type":"object","properties":{"frequency":{"type":"array","items":{"type":"object","properties":{"platform":{"type":"string"},"posts_per_week":{"type":"integer"},"avg_engagement_rate":{"type":"number"},"avg_engagement":{"type":"number"},"weeks_count":{"type":"integer"}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/analytics/content-decay":{"get":{"tags":["Analytics"],"summary":"How much of its latest engagement a post had reached by each age bucket (Day 0 to Day 31+)","parameters":[{"name":"profileId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this profile"},{"name":"platform","in":"query","required":false,"schema":{"type":"string"},"description":"Only this platform"},{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this account"},{"name":"source","in":"query","required":false,"schema":{"type":"string","enum":["postgale","late","external"]},"description":"Posts published through Postgale (late is Zernio's name) or imported from the platform"},{"name":"fromDate","in":"query","required":false,"schema":{"type":"string"},"description":"First day, YYYY-MM-DD (default: 365 days ago)"},{"name":"toDate","in":"query","required":false,"schema":{"type":"string"},"description":"Last day, YYYY-MM-DD (default: today)"}],"responses":{"200":{"description":"{buckets}","content":{"application/json":{"schema":{"type":"object","properties":{"buckets":{"type":"array","items":{"type":"object","properties":{"bucket_order":{"type":"integer"},"bucket_label":{"type":"string"},"avg_pct_of_final":{"type":"number"},"post_count":{"type":"integer"}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/analytics/delta":{"get":{"tags":["Analytics"],"summary":"Feed of metric snapshots that changed since cursor, oldest change first. nextCursor is always present (also on an empty page): store it and send it next time; hasMore means call again now","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor of the previous call"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":100},"description":"Page size"},{"name":"platform","in":"query","required":false,"schema":{"type":"string"},"description":"Only this platform"},{"name":"profileId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this profile"}],"responses":{"200":{"description":"{data, nextCursor, hasMore}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}},"nextCursor":{"type":"string"},"hasMore":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/posts/sync-external":{"post":{"tags":["Analytics"],"summary":"Read the account's recent posts from the platform now (including posts published outside Postgale) and store today's metrics for each. With postId or url, returns that post ({found, post})","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"},"postId":{"type":"string","description":"Platform post id to locate"},"url":{"type":"string","description":"Post URL to locate"}},"required":["accountId"]}}}},"responses":{"200":{"description":"{synced, posts} or {synced, found, post}","content":{"application/json":{"schema":{"type":"object","properties":{"synced":{"type":"object","properties":{"postsFound":{"type":"integer"},"postsSynced":{"type":"integer"},"skipped":{"type":"boolean"}}},"found":{"type":"boolean"},"post":{"type":"object"},"posts":{"type":"array","items":{"type":"object"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/mentions":{"get":{"tags":["Comments"],"summary":"Mentions of the organization's accounts from the last 7 days, received by webhook: Instagram caption and comment mentions, Facebook post and comment mentions","parameters":[{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this account"},{"name":"profileId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this profile"},{"name":"sortOrder","in":"query","required":false,"schema":{"type":"string","enum":["asc","desc"]},"description":"By time (default desc)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"description":"Maximum items (default 50, max 100)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor of the previous page"}],"responses":{"200":{"description":"{data, nextCursor, hasMore}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"platform":{"type":"string"},"type":{"type":"string","enum":["caption","post","comment"]},"mediaId":{"type":["string","null"]},"postId":{"type":["string","null"]},"commentId":{"type":["string","null"]},"accountId":{"type":"string"},"accountUsername":{"type":["string","null"]},"content":{"type":"string"},"authorUrn":{"type":["string","null"]},"authorName":{"type":["string","null"]},"authorUsername":{"type":["string","null"]},"publishedAt":{"type":"string"},"createdAt":{"type":"string"}}}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/inbox/mentions/reply":{"post":{"tags":["Comments"],"summary":"Reply where the account was mentioned (Instagram): commentId for a comment mention, only mediaId for a caption mention. Queued for approval (202) while approval applies","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"},"mediaId":{"type":"string"},"commentId":{"type":"string"},"message":{"type":"string","maxLength":2200}},"required":["accountId","mediaId","message"]}}}},"responses":{"200":{"description":"{success, id}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"id":{"type":"string"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/analytics/best-time":{"get":{"tags":["Analytics"],"summary":"Best UTC weekday/hour slots from published posts with metrics, falling back to Instagram online followers or defaults","parameters":[{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this account"},{"name":"days","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":365,"default":90},"description":"Look-back window"}],"responses":{"200":{"description":"BestTime","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BestTime"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/actions":{"get":{"tags":["Approvals"],"summary":"Agent actions queued for approval in this organization, newest first","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["pending_approval","approved","rejected","executed","failed"]},"description":"Only this status"},{"name":"kind","in":"query","required":false,"schema":{"type":"string"},"description":"Only this kind, e.g. comment.reply"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"description":"Maximum items (default 50, max 100)"},{"name":"before","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"nextBefore of the previous page"}],"responses":{"200":{"description":"{actions, nextBefore}","content":{"application/json":{"schema":{"type":"object","properties":{"actions":{"type":"array","items":{"$ref":"#/components/schemas/PendingAction"}},"nextBefore":{"type":["string","null"],"description":"Pass as before for older actions"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/actions/{id}":{"get":{"tags":["Approvals"],"summary":"One queued action: its status, the exact call (as edited by the reviewer), and the result or error once it ran","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Pending action id"}],"responses":{"200":{"description":"{action}","content":{"application/json":{"schema":{"type":"object","properties":{"action":{"$ref":"#/components/schemas/PendingAction"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/webhooks":{"get":{"tags":["Webhooks"],"summary":"List webhooks","responses":{"200":{"description":"{webhooks}","content":{"application/json":{"schema":{"type":"object","properties":{"webhooks":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Webhooks"],"summary":"Create a webhook (secret returned once). While approval applies it answers 202 (queued, kind webhook.create); once approved the secret is shown once to the approving member in the dashboard only, and the action's result (GET /actions/{id}, action.* webhooks) carries the webhook without it","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"Public https URL"},"events":{"type":"array","minItems":1,"items":{"type":"string","enum":["post.published","post.failed","post.pending_approval","post.approved","post.rejected","action.pending_approval","action.approved","action.rejected","action.executed","action.failed","comment.received","mention.received","message.received","message.sent","message.read","message.delivered","message.reaction","message.status","message.edited","message.deleted","message.failed","reaction.received","template.status","template.quality","account.quality","account.connected","account.disconnected","connection.pending","phone_number.provisioned","phone_number.release_scheduled","phone_number.released","phone_number.failed"]},"description":"Default post.published, post.failed, post.pending_approval"}},"required":["url"]}}}},"responses":{"201":{"description":"{webhook}","content":{"application/json":{"schema":{"type":"object","properties":{"webhook":{"$ref":"#/components/schemas/Webhook"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Webhooks"],"summary":"Delete a webhook","parameters":[{"name":"id","in":"query","required":true,"schema":{"type":"string"},"description":"Webhook id"}],"responses":{"200":{"description":"{deleted}","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/webhooks/{id}/deliveries":{"get":{"tags":["Webhooks"],"summary":"Newest deliveries of a webhook (at most 100)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Webhook id"},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["pending","sending","delivered","failed"]},"description":"Only this status"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":100},"description":"Maximum items (default 100, max 100)"}],"responses":{"200":{"description":"{deliveries}","content":{"application/json":{"schema":{"type":"object","properties":{"deliveries":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/webhooks/{id}/test":{"post":{"tags":["Webhooks"],"summary":"Queue a webhook.test event to this webhook only (sent by the worker within about a minute)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Webhook id"}],"responses":{"202":{"description":"{delivery}","content":{"application/json":{"schema":{"type":"object","properties":{"delivery":{"$ref":"#/components/schemas/WebhookDelivery"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/webhooks/deliveries/{deliveryId}/redeliver":{"post":{"tags":["Webhooks"],"summary":"Queue a copy of a delivery; it keeps the original X-Idempotency-Key (redeliveryOf = original id)","parameters":[{"name":"deliveryId","in":"path","required":true,"schema":{"type":"string"},"description":"Delivery id"}],"responses":{"202":{"description":"{delivery}","content":{"application/json":{"schema":{"type":"object","properties":{"delivery":{"$ref":"#/components/schemas/WebhookDelivery"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/keys":{"get":{"tags":["Dashboard"],"summary":"List API keys of the signed-in organization (session cookie)","security":[{"SessionCookie":[]}],"responses":{"200":{"description":"{keys}"},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Dashboard"],"summary":"Create an API key (secret returned once)","security":[{"SessionCookie":[]}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"requireApproval":{"type":"boolean"}}}}}},"responses":{"201":{"description":"{key: {id, name, prefix, secret}}"},"400":{"$ref":"#/components/responses/BadRequest"}}},"delete":{"tags":["Dashboard"],"summary":"Revoke an API key","security":[{"SessionCookie":[]}],"parameters":[{"name":"id","in":"query","required":true,"schema":{"type":"string"},"description":"Key id"}],"responses":{"200":{"description":"{revoked}"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/org-settings":{"get":{"tags":["Dashboard"],"summary":"Organization approval setting (session cookie)","security":[{"SessionCookie":[]}],"responses":{"200":{"description":"{requireApproval}"},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Dashboard"],"summary":"Set the organization approval setting","security":[{"SessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"requireApproval":{"type":"boolean"}}}}}},"responses":{"200":{"description":"{requireApproval}"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/openapi.json":{"get":{"tags":["Meta"],"summary":"This document","security":[],"responses":{"200":{"description":"OpenAPI 3.1 JSON"}}}},"/webhooks/telephony/{provider}":{"servers":[{"url":"/api"}],"parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","enum":["telnyx","twilio"]}}],"post":{"tags":["Inbound"],"summary":"Carrier events for numbers bought by Postgale: Telnyx (JSON, telnyx-signature-ed25519 over `${telnyx-timestamp}|${body}` with TELNYX_PUBLIC_KEY, at most 5 minutes old) or Twilio (form, X-Twilio-Signature with TWILIO_AUTH_TOKEN; answers TwiML). Calls are answered and transcribed, the verification code is captured; events are stored as inbound events (platform telephony, digits redacted)","security":[],"responses":{"200":{"description":"Processed (Twilio: TwiML)"},"401":{"description":"Invalid signature"}}}},"/webhooks/telegram":{"servers":[{"url":"/api"}],"post":{"tags":["Inbound"],"summary":"Telegram Bot API updates (message, channel_post, my_chat_member), registered with npm run telegram:set-webhook. X-Telegram-Bot-Api-Secret-Token must equal TELEGRAM_WEBHOOK_SECRET (compared in constant time). /connect <code> in a channel or group (or a forwarded channel post) links the chat; the bot being removed or losing the right to post flags the account needs_reconnect (account.disconnected). Always 200 for authentic updates, including ignored ones","security":[],"responses":{"200":{"description":"{ok}","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"401":{"description":"Missing or wrong secret token"}}}},"/webhooks/meta/{product}":{"servers":[{"url":"/api"}],"parameters":[{"name":"product","in":"path","required":true,"schema":{"type":"string","enum":["instagram","facebook","threads","whatsapp"]}}],"get":{"tags":["Inbound"],"summary":"Meta verification handshake: echoes hub.challenge (text/plain) when hub.mode=subscribe and hub.verify_token = META_WEBHOOK_VERIFY_TOKEN","security":[],"parameters":[{"name":"hub.mode","in":"query","required":false,"schema":{"type":"string"},"description":"subscribe"},{"name":"hub.verify_token","in":"query","required":false,"schema":{"type":"string"},"description":"Verify token"},{"name":"hub.challenge","in":"query","required":false,"schema":{"type":"string"},"description":"Challenge to echo"}],"responses":{"200":{"description":"hub.challenge","content":{"text/plain":{"schema":{"type":"string"}}}},"403":{"description":"Token mismatch"}}},"post":{"tags":["Inbound"],"summary":"Meta event delivery, signed with X-Hub-Signature-256 (sha256=<hex HMAC of the raw body>) by the product's app secret (instagram: INSTAGRAM_CLIENT_SECRET, facebook: FACEBOOK_APP_SECRET, threads: THREADS_APP_SECRET, whatsapp: WHATSAPP_APP_SECRET, then FACEBOOK_APP_SECRET). Stored as inbound events (deduplicated) and emitted as comment.received / mention.received; messaging events are stored as conversations and messages and emitted as message.*","security":[],"parameters":[{"name":"X-Hub-Signature-256","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Instagram {object:\"instagram\", entry:[{id, time, changes:[{field:\"comments\"|\"live_comments\"|\"mentions\", value}]}]}; Facebook {object:\"page\", entry:[{id, changes:[{field:\"feed\", value:{item, verb, comment_id, post_id, message, from, parent_id}}]}]}; Threads fields replies / mentions. Messaging: entry[].messaging[{sender{id}, recipient{id}, timestamp, message|read|delivery|reaction|postback|referral}] (Instagram and Messenger), or a messaging field (messages, messaging_seen, message_reactions, messaging_postbacks, ...) whose value is one such event. WhatsApp {object:\"whatsapp_business_account\", entry:[{id: WABA id, changes:[{field:\"messages\"|\"message_template_status_update\"|\"message_template_quality_update\"|\"template_category_update\"|\"phone_number_quality_update\"|..., value}]}]}"}}}},"responses":{"200":{"description":"{received, events, duplicates, ignored, unmatched}","content":{"application/json":{"schema":{"type":"object","properties":{"received":{"type":"boolean"},"events":{"type":"integer"},"duplicates":{"type":"integer"},"ignored":{"type":"integer"},"unmatched":{"type":"integer"}}}}}},"400":{"description":"Invalid JSON"},"401":{"description":"Invalid or missing signature"},"500":{"description":"Storage failed (Meta retries)"}}}},"/ads/accounts":{"get":{"tags":["Ads"],"summary":"Ad accounts the connected Facebook user can reach (needs ads_read or ads_management on the account). Only those linked to the Page (owned by its business, that promoted it, or allowed by a person) can be used: others answer 403 ad_account_not_linked. currencyOffset 100: amounts in cents; 1: whole units. Mock mode returns three sandbox accounts (USD, EUR, CLP)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Connected Facebook Page account id"},{"name":"after","in":"query","required":false,"schema":{"type":"string"},"description":"next of the previous page"}],"responses":{"200":{"description":"{adAccounts, next, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"adAccounts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"name":{"type":"string"},"currency":{"type":"string"},"currencyOffset":{"type":"integer","enum":[1,100]},"account_status":{"type":"integer"},"timezone_name":{"type":"string"}}}},"next":{"type":["string","null"]},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/ads/boost":{"post":{"tags":["Ads"],"summary":"Boost a published Facebook Page or Instagram post: creates campaign, ad set, creative (referencing the post, keeping its likes and comments) and ad, PAUSED unless status ACTIVE. Requires confirm: true","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Boost"}}}},"responses":{"201":{"description":"{boost, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"boost":{"type":"object","properties":{"platform":{"type":"string"},"platformPostId":{"type":"string"},"status":{"type":"string"},"campaignId":{"type":"string"},"adSetId":{"type":"string"},"creativeId":{"type":"string"},"adId":{"type":"string"}}},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/ads/campaigns":{"get":{"tags":["Ads"],"summary":"List campaigns of an ad account (mock mode: the objects created through this instance)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Connected Facebook Page account id"},{"name":"adAccountId","in":"query","required":true,"schema":{"type":"string"},"description":"Ad account id (act_...)"},{"name":"parentId","in":"query","required":false,"schema":{"type":"string"},"description":"Ad sets of a campaign / ads of an ad set"},{"name":"statuses","in":"query","required":false,"schema":{"type":"string"},"description":"Comma list of effective statuses"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":"Maximum items (default 25, max 100)"},{"name":"after","in":"query","required":false,"schema":{"type":"string"},"description":"next of the previous page"}],"responses":{"200":{"description":"{items, next, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object"}},"next":{"type":["string","null"]},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["Ads"],"summary":"Create a campaign (objective or goal, optional CBO budget, specialAdCategories). PAUSED by default; requires confirm: true","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected Facebook Page account id"},"adAccountId":{"type":"string","description":"Ad account id (act_...)"},"confirm":{"type":"boolean","description":"Required (true) for anything that can spend: creates (campaign, ad set, ad, boost), status ACTIVE, budget, bid, schedule or targeting changes; and for what cannot be undone (status DELETED or ARCHIVED, deleting an audience). Without it: 400 confirmation_required, nothing is created"},"name":{"type":"string"},"objective":{"type":"string","enum":["OUTCOME_AWARENESS","OUTCOME_TRAFFIC","OUTCOME_ENGAGEMENT","OUTCOME_LEADS","OUTCOME_SALES","OUTCOME_APP_PROMOTION"]},"goal":{"type":"string","description":"Alternative to objective: engagement, traffic, awareness, ..."},"dailyBudget":{"type":"integer","minimum":1,"description":"Campaign (CBO) daily budget: an integer in the ad account currency's API units (currencyOffset 100: cents, 1500 = 15.00 USD; currencyOffset 1, e.g. JPY, KRW, CLP, COP: whole units, 1500 = 1500 CLP)"},"lifetimeBudget":{"type":"integer","minimum":1,"description":"Campaign lifetime budget: an integer in the ad account currency's API units (currencyOffset 100: cents, 1500 = 15.00 USD; currencyOffset 1, e.g. JPY, KRW, CLP, COP: whole units, 1500 = 1500 CLP)"},"spendCap":{"type":"integer","minimum":1,"description":"Spend cap: an integer in the ad account currency's API units (currencyOffset 100: cents, 1500 = 15.00 USD; currencyOffset 1, e.g. JPY, KRW, CLP, COP: whole units, 1500 = 1500 CLP)"},"bidStrategy":{"type":"string"},"specialAdCategories":{"type":"array","items":{"type":"string"}},"startTime":{"type":"string","format":"date-time"},"stopTime":{"type":"string","format":"date-time"},"status":{"type":"string","description":"PAUSED (default) or ACTIVE (only together with confirm: true)","enum":["PAUSED","ACTIVE"]}},"required":["accountId","adAccountId","name","confirm"]}}}},"responses":{"201":{"description":"{campaign, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"campaign":{"type":"object"},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/ads/campaigns/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"campaign id"}],"get":{"tags":["Ads"],"summary":"One campaign","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Connected Facebook Page account id"}],"responses":{"200":{"description":"{item, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"item":{"type":"object"},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"patch":{"tags":["Ads"],"summary":"Update or pause a campaign: name, status (PAUSED, ACTIVE, ARCHIVED, DELETED), dailyBudget, lifetimeBudget, spendCap, stopTime. Pausing needs no confirm; ACTIVE, spend changes and DELETED/ARCHIVED (irreversible) need confirm: true","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdUpdate"}}}},"responses":{"200":{"description":"{item, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"item":{"type":"object"},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/ads/adsets":{"get":{"tags":["Ads"],"summary":"List ad sets of an ad account (mock mode: the objects created through this instance)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Connected Facebook Page account id"},{"name":"adAccountId","in":"query","required":true,"schema":{"type":"string"},"description":"Ad account id (act_...)"},{"name":"parentId","in":"query","required":false,"schema":{"type":"string"},"description":"Ad sets of a campaign / ads of an ad set"},{"name":"statuses","in":"query","required":false,"schema":{"type":"string"},"description":"Comma list of effective statuses"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":"Maximum items (default 25, max 100)"},{"name":"after","in":"query","required":false,"schema":{"type":"string"},"description":"next of the previous page"}],"responses":{"200":{"description":"{items, next, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object"}},"next":{"type":["string","null"]},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["Ads"],"summary":"Create an ad set in a campaign: targeting, budget (unless the campaign has one), schedule, optimization goal. PAUSED by default; requires confirm: true","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected Facebook Page account id"},"adAccountId":{"type":"string","description":"Ad account id (act_...)"},"confirm":{"type":"boolean","description":"Required (true) for anything that can spend: creates (campaign, ad set, ad, boost), status ACTIVE, budget, bid, schedule or targeting changes; and for what cannot be undone (status DELETED or ARCHIVED, deleting an audience). Without it: 400 confirmation_required, nothing is created"},"campaignId":{"type":"string"},"name":{"type":"string"},"dailyBudget":{"type":"integer","minimum":1,"description":"Daily budget: an integer in the ad account currency's API units (currencyOffset 100: cents, 1500 = 15.00 USD; currencyOffset 1, e.g. JPY, KRW, CLP, COP: whole units, 1500 = 1500 CLP)"},"lifetimeBudget":{"type":"integer","minimum":1,"description":"Lifetime budget (needs endTime): an integer in the ad account currency's API units (currencyOffset 100: cents, 1500 = 15.00 USD; currencyOffset 1, e.g. JPY, KRW, CLP, COP: whole units, 1500 = 1500 CLP)"},"startTime":{"type":"string","format":"date-time"},"endTime":{"type":"string","format":"date-time"},"optimizationGoal":{"type":"string","description":"Default LINK_CLICKS"},"billingEvent":{"type":"string","description":"Default IMPRESSIONS"},"bidAmount":{"type":"integer","minimum":1,"description":"Bid cap: an integer in the ad account currency's API units (currencyOffset 100: cents, 1500 = 15.00 USD; currencyOffset 1, e.g. JPY, KRW, CLP, COP: whole units, 1500 = 1500 CLP)"},"bidStrategy":{"type":"string"},"targeting":{"$ref":"#/components/schemas/Targeting"},"promotedObject":{"type":"object"},"destinationType":{"type":"string"},"status":{"type":"string","description":"PAUSED (default) or ACTIVE (only together with confirm: true)","enum":["PAUSED","ACTIVE"]}},"required":["accountId","adAccountId","campaignId","name","confirm"]}}}},"responses":{"201":{"description":"{adSet, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"adSet":{"type":"object"},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/ads/adsets/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ad set id"}],"get":{"tags":["Ads"],"summary":"One ad set","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Connected Facebook Page account id"}],"responses":{"200":{"description":"{item, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"item":{"type":"object"},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"patch":{"tags":["Ads"],"summary":"Update or pause a ad set: name, status (PAUSED, ACTIVE, ARCHIVED, DELETED), dailyBudget, lifetimeBudget, bidAmount, endTime, targeting. Pausing needs no confirm; ACTIVE, spend changes and DELETED/ARCHIVED (irreversible) need confirm: true","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdUpdate"}}}},"responses":{"200":{"description":"{item, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"item":{"type":"object"},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/ads/creatives":{"get":{"tags":["Ads"],"summary":"List creatives of an ad account (mock mode: the objects created through this instance)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Connected Facebook Page account id"},{"name":"adAccountId","in":"query","required":true,"schema":{"type":"string"},"description":"Ad account id (act_...)"},{"name":"parentId","in":"query","required":false,"schema":{"type":"string"},"description":"Ad sets of a campaign / ads of an ad set"},{"name":"statuses","in":"query","required":false,"schema":{"type":"string"},"description":"Comma list of effective statuses"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":"Maximum items (default 25, max 100)"},{"name":"after","in":"query","required":false,"schema":{"type":"string"},"description":"next of the previous page"}],"responses":{"200":{"description":"{items, next, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object"}},"next":{"type":["string","null"]},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["Ads"],"summary":"Create a creative from a Page post (objectStoryId), an Instagram post (instagramMediaId) or a new link ad (link, message, headline, imageUrl or imageHash, callToAction). Spends nothing; no confirm needed","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"adAccountId":{"type":"string"},"name":{"type":"string"},"objectStoryId":{"type":"string"},"instagramMediaId":{"type":"string"},"instagramUserId":{"type":"string"},"link":{"type":"string"},"message":{"type":"string"},"headline":{"type":"string"},"description":{"type":"string"},"imageUrl":{"type":"string"},"imageHash":{"type":"string"},"callToAction":{"type":"string"},"linkUrl":{"type":"string"}},"required":["accountId","adAccountId"]}}}},"responses":{"201":{"description":"{creative, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"creative":{"type":"object"},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/ads/ads":{"get":{"tags":["Ads"],"summary":"List ads of an ad account (mock mode: the objects created through this instance)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Connected Facebook Page account id"},{"name":"adAccountId","in":"query","required":true,"schema":{"type":"string"},"description":"Ad account id (act_...)"},{"name":"parentId","in":"query","required":false,"schema":{"type":"string"},"description":"Ad sets of a campaign / ads of an ad set"},{"name":"statuses","in":"query","required":false,"schema":{"type":"string"},"description":"Comma list of effective statuses"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":"Maximum items (default 25, max 100)"},{"name":"after","in":"query","required":false,"schema":{"type":"string"},"description":"next of the previous page"}],"responses":{"200":{"description":"{items, next, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object"}},"next":{"type":["string","null"]},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["Ads"],"summary":"Create an ad from an ad set and a creative. PAUSED by default; requires confirm: true","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected Facebook Page account id"},"adAccountId":{"type":"string","description":"Ad account id (act_...)"},"confirm":{"type":"boolean","description":"Required (true) for anything that can spend: creates (campaign, ad set, ad, boost), status ACTIVE, budget, bid, schedule or targeting changes; and for what cannot be undone (status DELETED or ARCHIVED, deleting an audience). Without it: 400 confirmation_required, nothing is created"},"name":{"type":"string"},"adSetId":{"type":"string"},"creativeId":{"type":"string"},"status":{"type":"string","description":"PAUSED (default) or ACTIVE (only together with confirm: true)","enum":["PAUSED","ACTIVE"]}},"required":["accountId","adAccountId","name","adSetId","creativeId","confirm"]}}}},"responses":{"201":{"description":"{ad, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"ad":{"type":"object"},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/ads/ads/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"ad id"}],"get":{"tags":["Ads"],"summary":"One ad","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Connected Facebook Page account id"}],"responses":{"200":{"description":"{item, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"item":{"type":"object"},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"patch":{"tags":["Ads"],"summary":"Update or pause a ad: name, status (PAUSED, ACTIVE, ARCHIVED, DELETED). Pausing needs no confirm; ACTIVE, spend changes and DELETED/ARCHIVED (irreversible) need confirm: true","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdUpdate"}}}},"responses":{"200":{"description":"{item, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"item":{"type":"object"},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/ads/audiences":{"get":{"tags":["Ads"],"summary":"List custom audiences of an ad account (mock mode: the objects created through this instance)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Connected Facebook Page account id"},{"name":"adAccountId","in":"query","required":true,"schema":{"type":"string"},"description":"Ad account id (act_...)"},{"name":"parentId","in":"query","required":false,"schema":{"type":"string"},"description":"Ad sets of a campaign / ads of an ad set"},{"name":"statuses","in":"query","required":false,"schema":{"type":"string"},"description":"Comma list of effective statuses"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":"Maximum items (default 25, max 100)"},{"name":"after","in":"query","required":false,"schema":{"type":"string"},"description":"next of the previous page"}],"responses":{"200":{"description":"{items, next, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object"}},"next":{"type":["string","null"]},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["Ads"],"summary":"Create a customer-list custom audience (then add users)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"adAccountId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"}},"required":["accountId","adAccountId","name"]}}}},"responses":{"201":{"description":"{audience, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"audience":{"type":"object"},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/ads/audiences/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Custom audience id"}],"get":{"tags":["Ads"],"summary":"One custom audience (size bounds, status)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Connected Facebook Page account id"}],"responses":{"200":{"description":"{item, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"item":{"type":"object"},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Ads"],"summary":"Delete a custom audience (irreversible: needs confirm=true)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Connected Facebook Page account id"},{"name":"confirm","in":"query","required":true,"schema":{"type":"boolean"},"description":"Must be true"}],"responses":{"200":{"description":"{deleted}","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/ads/audiences/{id}/users":{"post":{"tags":["Ads"],"summary":"Add users to a custom audience: emails or phones, normalized and SHA-256 hashed by Postgale (raw values never reach Meta); up to 10000 per call","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Custom audience id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"emails":{"type":"array","items":{"type":"string"}},"phones":{"type":"array","items":{"type":"string"}}},"required":["accountId"]}}}},"responses":{"200":{"description":"{audienceId, received, schema}","content":{"application/json":{"schema":{"type":"object","properties":{"audienceId":{"type":"string"},"received":{"type":"integer"},"schema":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/ads/insights":{"get":{"tags":["Ads"],"summary":"Ads insights (impressions, reach, clicks, spend, cpc, cpm, ctr, actions) of an ad account, campaign, ad set or ad","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Connected Facebook Page account id"},{"name":"after","in":"query","required":false,"schema":{"type":"string"},"description":"next of the previous page"},{"name":"objectId","in":"query","required":true,"schema":{"type":"string"},"description":"act_..., campaign, ad set or ad id"},{"name":"datePreset","in":"query","required":false,"schema":{"type":"string"},"description":"last_7d (default), last_30d, ..."},{"name":"since","in":"query","required":false,"schema":{"type":"string"},"description":"YYYY-MM-DD"},{"name":"until","in":"query","required":false,"schema":{"type":"string"},"description":"YYYY-MM-DD"},{"name":"level","in":"query","required":false,"schema":{"type":"string"},"description":"account | campaign | adset | ad"},{"name":"breakdowns","in":"query","required":false,"schema":{"type":"string"},"description":"Comma list, e.g. age,gender"},{"name":"timeIncrement","in":"query","required":false,"schema":{"type":"string"},"description":"1 for daily rows"},{"name":"fields","in":"query","required":false,"schema":{"type":"string"},"description":"Comma list of insight fields"}],"responses":{"200":{"description":"{objectId, currency, insights, next, mock}","content":{"application/json":{"schema":{"type":"object","properties":{"objectId":{"type":"string"},"currency":{"type":"string"},"insights":{"type":"array","items":{"type":"object"}},"next":{"type":["string","null"]},"mock":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/ads/targeting/search":{"get":{"tags":["Ads"],"summary":"Search targeting options (interests, locations, locales...) for Targeting","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Connected Facebook Page account id"},{"name":"q","in":"query","required":true,"schema":{"type":"string"},"description":"Search text"},{"name":"type","in":"query","required":false,"schema":{"type":"string","enum":["adinterest","adgeolocation","adlocale","adeducationschool","adworkemployer"]},"description":"Default adinterest"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":"Maximum items (default 25, max 100)"}],"responses":{"200":{"description":"{results}","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/tiktok/creator-info":{"get":{"tags":["TikTok"],"summary":"TikTok creator_info, required before each post by TikTok's Content Sharing Guidelines: nickname, privacy levels the creator allows now (allowedNow false while the app is unaudited), interaction toggles, max video duration, commercial content options. Errors when TikTok says the creator cannot post right now (e.g. spam_risk_too_many_posts → 429)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"},{"name":"mediaType","in":"query","required":false,"schema":{"type":"string","enum":["video","photo"]},"description":"photo: duet/stitch are null"}],"responses":{"200":{"description":"CreatorInfo","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string"},"mediaType":{"type":"string"},"creator":{"type":"object","properties":{"nickname":{"type":"string"},"username":{"type":"string"},"avatarUrl":{"type":["string","null"]}}},"privacyLevels":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"},"allowedNow":{"type":"boolean"}}}},"interactionSettings":{"type":"object","properties":{"allowComment":{"type":"object","properties":{"enabled":{"type":"boolean","description":"false: the creator turned it off in TikTok (send false)"},"default":{"type":"boolean"}}},"allowDuet":{"anyOf":[{"type":"object","properties":{"enabled":{"type":"boolean","description":"false: the creator turned it off in TikTok (send false)"},"default":{"type":"boolean"}}},{"type":"null"}]},"allowStitch":{"anyOf":[{"type":"object","properties":{"enabled":{"type":"boolean","description":"false: the creator turned it off in TikTok (send false)"},"default":{"type":"boolean"}}},{"type":"null"}]}}},"maxVideoDurationSec":{"type":"integer"},"commercialContentTypes":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}}}},"appAudited":{"type":"boolean"},"note":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/tiktok/profile":{"get":{"tags":["TikTok"],"summary":"TikTok profile and lifetime stats (Display API user/info: user.info.basic, user.info.profile, user.info.stats)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{accountId, platform, profile}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string"},"profile":{"$ref":"#/components/schemas/TikTokProfile"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/tiktok/videos":{"get":{"tags":["TikTok"],"summary":"The creator's public videos with views, likes, comments and shares, newest first (Display API video/list, needs video.list); videoIds reads up to 20 specific videos (video/query)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor from the previous page"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":20,"default":20},"description":"Maximum items (default 20, max 20)"},{"name":"videoIds","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated video ids (max 20) instead of listing"}],"responses":{"200":{"description":"{accountId, platform, videos, nextCursor?, hasMore}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string"},"videos":{"type":"array","items":{"$ref":"#/components/schemas/TikTokVideo"}},"nextCursor":{"type":"string","description":"Pass as cursor for the next page"},"hasMore":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/telegram-commands":{"get":{"tags":["Telegram"],"summary":"The bot commands (\"/\" menu) set for this Telegram account, and startLink: the t.me link that opens a private chat with the bot bound to this account (its messages then arrive in the inbox)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{data, startLink}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"command":{"type":"string","description":"a-z, 0-9 and _, at most 32, no leading /","pattern":"^[a-z0-9_]{1,32}$"},"description":{"type":"string","maxLength":256}},"required":["command","description"]},"description":"At most 100"},"startLink":{"type":["string","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Telegram"],"summary":"Replace the bot commands shown in the account's group (channels have no command menu) and in the private chats bound to it (best effort: failures there are warnings). The shared bot scopes commands per chat","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"commands":{"type":"array","items":{"type":"object","properties":{"command":{"type":"string","description":"a-z, 0-9 and _, at most 32, no leading /","pattern":"^[a-z0-9_]{1,32}$"},"description":{"type":"string","maxLength":256}},"required":["command","description"]},"description":"At most 100"}},"required":["commands"]}}}},"responses":{"200":{"description":"{success, data, warnings?}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"command":{"type":"string","description":"a-z, 0-9 and _, at most 32, no leading /","pattern":"^[a-z0-9_]{1,32}$"},"description":{"type":"string","maxLength":256}},"required":["command","description"]},"description":"At most 100"},"warnings":{"type":"array","items":{"type":"string"}}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Telegram"],"summary":"Clear the account's bot commands","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{success, warnings?}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"warnings":{"type":"array","items":{"type":"string"}}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/instagram-ice-breakers":{"get":{"tags":["Meta"],"summary":"Instagram ice breakers (Instagram)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"put":{"tags":["Meta"],"summary":"Set instagram ice breakers (replaces every locale). Queued while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ice_breakers":{"description":"[{question, payload}] (max 4, question ≤80 characters) or [{locale, call_to_actions: [{question, payload}]}]"}},"required":["ice_breakers"]}}}},"responses":{"200":{"description":"{success: true}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Meta"],"summary":"Delete instagram ice breakers. Queued while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{success: true}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/messenger-ice-breakers":{"get":{"tags":["Meta"],"summary":"Messenger ice breakers (Facebook)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"put":{"tags":["Meta"],"summary":"Set messenger ice breakers (replaces every locale). Queued while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ice_breakers":{"type":"array","items":{"type":"object","properties":{"locale":{"type":"string","description":"default or a Meta locale like en_US"},"call_to_actions":{"type":"array","items":{"type":"object","properties":{"question":{"type":"string","maxLength":80},"payload":{"type":"string","description":"Postback payload sent when tapped"}},"required":["question","payload"]},"description":"Max 4"}}},"description":"One entry per locale; one must use locale default"}},"required":["ice_breakers"]}}}},"responses":{"200":{"description":"{success: true}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Meta"],"summary":"Delete messenger ice breakers. Queued while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{success: true}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/messenger-menu":{"get":{"tags":["Meta"],"summary":"Persistent menu (Facebook, Instagram)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"put":{"tags":["Meta"],"summary":"Set persistent menu (replaces every locale). Queued while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"persistent_menu":{"type":"array","items":{"type":"object","properties":{"locale":{"type":"string","description":"default or a Meta locale like en_US"},"composer_input_disabled":{"type":"boolean"},"call_to_actions":{"type":"array","items":{"type":"object"},"description":"Up to 20 items: {type: postback, title, payload} | {type: web_url, title, url}; no nested menus (Meta removed them). Instagram: no composer_input_disabled or webview_height_ratio"}}},"description":"Meta format; Facebook shows it only with a Get Started button"}},"required":["persistent_menu"]}}}},"responses":{"200":{"description":"{success: true}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Meta"],"summary":"Delete persistent menu. Queued while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{success: true}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/messenger-greeting":{"get":{"tags":["Meta"],"summary":"Messenger greeting (Facebook)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"put":{"tags":["Meta"],"summary":"Set messenger greeting (replaces every locale). Queued while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"greeting":{"type":"array","items":{"type":"object","properties":{"locale":{"type":"string","description":"default or a Meta locale like en_US"},"text":{"type":"string","description":"{{user_first_name}} etc. are personalized","maxLength":160}}},"description":"One entry per locale; one must use locale default"}},"required":["greeting"]}}}},"responses":{"200":{"description":"{success: true}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Meta"],"summary":"Delete messenger greeting. Queued while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{success: true}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/messenger-get-started":{"get":{"tags":["Meta"],"summary":"Get Started button (Facebook; delete the menu before deleting it)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":["object","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"put":{"tags":["Meta"],"summary":"Set get started button (replaces every locale). Queued while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"payload":{"type":"string","description":"Postback payload, e.g. GET_STARTED"}},"required":["payload"]}}}},"responses":{"200":{"description":"{success: true}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Meta"],"summary":"Delete get started button. Queued while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{success: true}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/facebook-page-info":{"get":{"tags":["Meta"],"summary":"Public info of the Page: about, description, website, phone, emails, hours (null when never filled)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Facebook Page account id"}],"responses":{"200":{"description":"FacebookPageInfo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FacebookPageInfo"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"patch":{"tags":["Meta"],"summary":"Update Page info: only the given fields are sent; \"\" clears a text field; unknown fields are 400. Answers the info read back. Needs pages_manage_metadata. Queued while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Facebook Page account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"about":{"type":"string"},"description":{"type":"string"},"website":{"type":"string"},"phone":{"type":"string"},"emails":{"type":"array","items":{"type":"string"}},"hours":{"type":"object","description":"{day}_{1|2}_{open|close}: HH:MM, e.g. mon_1_open: \"09:00\""}}}}}},"responses":{"200":{"description":"FacebookPageInfo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FacebookPageInfo"}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/follow-status/{userId}":{"get":{"tags":["Meta"],"summary":"Whether an Instagram user (IGSID from a webhook) follows the account, with profile counters. Meta answers only for people who messaged the account: otherwise 200 with isFollower null and unavailableReason (consent_required, dm_access_disabled, not_messageable, error)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Instagram account id"},{"name":"userId","in":"path","required":true,"schema":{"type":"string"},"description":"Instagram-scoped user id (IGSID)"},{"name":"refresh","in":"query","required":false,"schema":{"type":"string","enum":["1"]},"description":"Re-check with the platform instead of the 10-minute cache"}],"responses":{"200":{"description":"FollowStatus","content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"accountId":{"type":"string"},"isFollower":{"type":["boolean","null"]},"isFollowedByAccount":{"type":["boolean","null"]},"followerCount":{"type":["integer","null"]},"isVerified":{"type":["boolean","null"]},"username":{"type":["string","null"]},"name":{"type":["string","null"]},"unavailableReason":{"type":["string","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/instagram/stories":{"get":{"tags":["Meta"],"summary":"Active stories of the account (24 hours; live videos and reshares excluded)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Instagram account id"}],"responses":{"200":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/instagram/stories/{storyId}/insights":{"get":{"tags":["Meta"],"summary":"Metrics of one story. source: live (active story), cached (from Meta's story_insights webhook after it expired) or unavailable. navigation = tapsForward + tapsBack + exits + swipesForward","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Instagram account id"},{"name":"storyId","in":"path","required":true,"schema":{"type":"string"},"description":"Story media id"}],"responses":{"200":{"description":"{data: {source, metrics}}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"source":{"type":"string","enum":["live","cached","unavailable"]},"metrics":{"type":"object"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/instagram/tags":{"get":{"tags":["Meta"],"summary":"Media other users photo-tagged the account in, newest first","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Instagram account id"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":"Maximum items (default 25, max 100)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor of the previous page"}],"responses":{"200":{"description":"{data, nextCursor}: InstagramTaggedMedia","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}},"nextCursor":{"type":["string","null"],"description":"Pass as cursor for the next page"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/instagram/mentions/media/{mediaId}":{"get":{"tags":["Meta"],"summary":"A post that @mentions the account in its caption. Meta serves it to Instagram accounts connected through Facebook Login only: Postgale's Instagram Login accounts answer 400 with the code named here (mock mode returns sample data): instagram_mentions_require_facebook_login","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Instagram account id"},{"name":"mediaId","in":"path","required":true,"schema":{"type":"string"},"description":"Media id (digits)"}],"responses":{"200":{"description":"InstagramMentionedMedia","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/instagram/mentions/comments/{commentId}":{"get":{"tags":["Meta"],"summary":"A comment that @mentions the account, with its post. Meta serves it to Instagram accounts connected through Facebook Login only: Postgale's Instagram Login accounts answer 400 with the code named here (mock mode returns sample data): instagram_mentions_require_facebook_login","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Instagram account id"},{"name":"commentId","in":"path","required":true,"schema":{"type":"string"},"description":"Comment id (digits)"}],"responses":{"200":{"description":"InstagramMentionedComment","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/instagram/business-discovery":{"get":{"tags":["Meta"],"summary":"Public profile and recent media of a Business or Creator account. Meta serves it to Instagram accounts connected through Facebook Login only: Postgale's Instagram Login accounts answer 400 with the code named here (mock mode returns sample data): instagram_business_discovery_requires_facebook_login","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Instagram account id"},{"name":"username","in":"query","required":true,"schema":{"type":"string"},"description":"Handle, with or without @"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":50,"default":12},"description":"Maximum items (default 12, max 50)"}],"responses":{"200":{"description":"{profile, media}","content":{"application/json":{"schema":{"type":"object","properties":{"profile":{"type":"object"},"media":{"type":"array","items":{"type":"object"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/instagram/audio":{"get":{"tags":["Meta"],"summary":"Search the audio catalog, or the trending list without q (up to ~30). Pass audioId when creating a Reel. Meta serves it to Instagram accounts connected through Facebook Login only: Postgale's Instagram Login accounts answer 400 with the code named here (mock mode returns sample data): instagram_audio_requires_facebook_login","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Instagram account id"},{"name":"audioType","in":"query","required":true,"schema":{"type":"string","enum":["music","original_sound"]},"description":"Catalog"},{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Keywords"}],"responses":{"200":{"description":"{audio}","content":{"application/json":{"schema":{"type":"object","properties":{"audio":{"type":"array","items":{"type":"object"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/instagram/audio/{audioId}":{"get":{"tags":["Meta"],"summary":"One audio asset (refreshes the preview downloadUrl). Meta serves it to Instagram accounts connected through Facebook Login only: Postgale's Instagram Login accounts answer 400 with the code named here (mock mode returns sample data): instagram_audio_requires_facebook_login","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Instagram account id"},{"name":"audioId","in":"path","required":true,"schema":{"type":"string"},"description":"Audio asset id"}],"responses":{"200":{"description":"{audio}","content":{"application/json":{"schema":{"type":"object","properties":{"audio":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/instagram/live-media":{"get":{"tags":["Meta"],"summary":"Live broadcasts in progress (empty when nothing is live). Meta serves it to Instagram accounts connected through Facebook Login only: Postgale's Instagram Login accounts answer 400 with the code named here (mock mode returns sample data): instagram_live_media_requires_facebook_login","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Instagram account id"}],"responses":{"200":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/instagram/media/{mediaId}/collaborators":{"get":{"tags":["Meta"],"summary":"Collaborators invited on one of the account's posts, with inviteStatus accepted | pending. Meta serves it to Instagram accounts connected through Facebook Login only: Postgale's Instagram Login accounts answer 400 with the code named here (mock mode returns sample data): instagram_collaborators_require_facebook_login","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Instagram account id"},{"name":"mediaId","in":"path","required":true,"schema":{"type":"string"},"description":"Media id (digits)"}],"responses":{"200":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"username":{"type":["string","null"]},"inviteStatus":{"type":["string","null"]}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/instagram/publishing-limit":{"get":{"tags":["Meta"],"summary":"Instagram publishing quota in Zernio's shape (see also /accounts/{id}/publishing-limit)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Instagram account id"}],"responses":{"200":{"description":"{quotaUsage, quotaTotal, quotaDurationSeconds}","content":{"application/json":{"schema":{"type":"object","properties":{"quotaUsage":{"type":"integer"},"quotaTotal":{"type":"integer"},"quotaDurationSeconds":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/facebook-post-reactions":{"get":{"tags":["Meta"],"summary":"Reactions of a Page post per type (like, love, haha, wow, sad, angry, care) and the total, in one Graph call","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Facebook Page account id"},{"name":"postId","in":"query","required":true,"schema":{"type":"string"},"description":"Facebook post id"}],"responses":{"200":{"description":"{accountId, platform, username, postId, total, breakdown, lastUpdated}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string"},"username":{"type":"string"},"postId":{"type":"string"},"total":{"type":"integer"},"breakdown":{"type":"object"},"lastUpdated":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/facebook-tagged-posts":{"get":{"tags":["Meta"],"summary":"Public posts where people or Pages tagged the Page (pages_read_user_content)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Facebook Page account id"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":"Maximum items (default 25, max 100)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor of the previous page"}],"responses":{"200":{"description":"{data, nextCursor}: FacebookTaggedPost","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}},"nextCursor":{"type":["string","null"],"description":"Pass as cursor for the next page"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/facebook-visitor-posts":{"get":{"tags":["Meta"],"summary":"Posts other people published on the Page (the Page feed without the Page's own posts; limit is the number of feed entries scanned)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Facebook Page account id"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":"Maximum items (default 25, max 100)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor of the previous page"}],"responses":{"200":{"description":"{data, nextCursor}: FacebookVisitorPost","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}},"nextCursor":{"type":["string","null"],"description":"Pass as cursor for the next page"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/analytics/facebook/page-insights":{"get":{"tags":["Analytics"],"summary":"Facebook Page insights in Zernio's envelope (default page_media_view, page_post_engagements, page_follows; also page_views_total, page_video_views, page_video_view_time, content_monetization_earnings, monetization_approximate_earnings). At most 89 days, default the last 30. followers_gained / followers_lost are listed in unavailableMetrics","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Facebook account id"},{"name":"metrics","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated"},{"name":"fromDate","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Default 30 days ago"},{"name":"toDate","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Default today"},{"name":"since","in":"query","required":false,"schema":{"type":"string"},"description":"Alias of fromDate"},{"name":"until","in":"query","required":false,"schema":{"type":"string"},"description":"Alias of toDate"},{"name":"metricType","in":"query","required":false,"schema":{"type":"string","enum":["total_value","time_series"]},"description":"Default total_value"}],"responses":{"200":{"description":"{success, accountId, platform, dateRange, metricType, metrics, unavailableMetrics?, dataDelay}","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/analytics/facebook/post-earnings":{"get":{"tags":["Analytics"],"summary":"Lifetime monetization earnings of one post (cumulative: since, until, period, metricType and breakdown are 400). content_monetization_earnings has unit micro_amount and a currency; monetization_approximate_earnings is unspecified","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Facebook account id"},{"name":"postId","in":"query","required":true,"schema":{"type":"string"},"description":"{pageId}_{postId} or the bare video id of a Reel"},{"name":"metrics","in":"query","required":false,"schema":{"type":"string"},"description":"content_monetization_earnings,monetization_approximate_earnings (default both)"}],"responses":{"200":{"description":"{success, accountId, postId, platform, period: lifetime, metrics, unavailableMetrics?}","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/reviews":{"get":{"tags":["Meta"],"summary":"Reviews (recommendations) of the organization's Facebook Pages, aggregated. Pages that fail are listed in meta.failedAccounts","parameters":[{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"One Facebook account"},{"name":"platform","in":"query","required":false,"schema":{"type":"string","enum":["facebook"]},"description":"Platform"},{"name":"minRating","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":5},"description":"Minimum rating"},{"name":"maxRating","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":5},"description":"Maximum rating"},{"name":"hasReply","in":"query","required":false,"schema":{"type":"boolean"},"description":"Filter by reply status"},{"name":"sortBy","in":"query","required":false,"schema":{"type":"string","enum":["date","rating"]},"description":"Default date"},{"name":"sortOrder","in":"query","required":false,"schema":{"type":"string","enum":["asc","desc"]},"description":"Default desc"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":"Maximum items (default 25, max 100)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor of the previous page"}],"responses":{"200":{"description":"{status, data, pagination: {hasMore, nextCursor}, meta, summary: {totalReviews, averageRating}}","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/inbox/reviews/{reviewId}/reply":{"post":{"tags":["Meta"],"summary":"Reply to a Facebook review (a LIVE public comment on the review). Queued while approval applies","parameters":[{"name":"reviewId","in":"path","required":true,"schema":{"type":"string"},"description":"Review id from GET /inbox/reviews"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"},"message":{"type":"string"}},"required":["accountId","message"]}}}},"responses":{"200":{"description":"{status, reply: {id, text, created}, platform}","content":{"application/json":{"schema":{"type":"object"}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Meta"],"summary":"Delete a review reply: Google Business Profile only, so Facebook answers 400 not_supported","parameters":[{"name":"reviewId","in":"path","required":true,"schema":{"type":"string"},"description":"Review id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"}},"required":["accountId"]}}}},"responses":{"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/inbox/conversations/{id}/accept":{"post":{"tags":["Messages"],"summary":"Accept a Message Request by replying to it (Meta has no separate accept call): the same checks, approval and webhooks as POST /inbox/conversations/{id}/messages","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Conversation id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"},"message":{"type":"string"}},"required":["message"]}}}},"responses":{"200":{"description":"{success, data: {messageId}}","content":{"application/json":{"schema":{"type":"object"}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/inbox/conversations/{id}/thread-control":{"post":{"tags":["Messages"],"summary":"Messenger Platform handover: pass (targetAppId; Page Inbox is 263902037430900), take, request, release. Instagram Login cannot take or request (400 platform_not_supported). Queued while approval applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Conversation id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Connected account id (must belong to the key's organization)"},"action":{"type":"string","enum":["release","take","pass","request"]},"targetAppId":{"type":"string","description":"Required with pass"},"metadata":{"type":"string","description":"Forwarded to the receiving app"}},"required":["action"]}}}},"responses":{"200":{"description":"{success, control: {owner, ownerAppId?}}","content":{"application/json":{"schema":{"type":"object"}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/connect/discord":{"get":{"tags":["Connect"],"summary":"The bot install link for Discord (same as GET /connect/{platform} with discord): a server admin adds Postgale's bot and picks channels","parameters":[{"name":"externalId","in":"query","required":false,"schema":{"type":"string"},"description":"Your own reference, stored on the accounts"}],"responses":{"200":{"description":"{authUrl, expiresInSeconds}","content":{"application/json":{"schema":{"type":"object","properties":{"authUrl":{"type":"string"},"expiresInSeconds":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Connect"],"summary":"Bind channels of a server where the bot was installed (a pending install from the last 30 minutes, or an existing Discord account in that server), one account per text, announcement or forum channel. channelIds connects several at once and answers accounts and failed (422 no_channels_connected when none could be)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"guildId":{"type":"string"},"channelId":{"type":"string"},"channelIds":{"type":"array","maxItems":50,"items":{"type":"string"}},"profileId":{"type":"string"},"redirect_url":{"type":"string","description":"channelIds: returned with connected, profileId, accountId and accountIds appended"}},"required":["guildId"]}}}},"responses":{"200":{"description":"{message, account} or {message, accounts, failed, redirect_url?}","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"account":{"type":"object","properties":{"accountId":{"type":"string"},"id":{"type":"string"},"platform":{"type":"string"},"displayName":{"type":"string"},"accountName":{"type":"string"},"platformAccountId":{"type":"string"},"channelId":{"type":"string"},"guildId":{"type":"string"},"isActive":{"type":"boolean"},"externalId":{"type":["string","null"]}}},"accounts":{"type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"id":{"type":"string"},"platform":{"type":"string"},"displayName":{"type":"string"},"accountName":{"type":"string"},"platformAccountId":{"type":"string"},"channelId":{"type":"string"},"guildId":{"type":"string"},"isActive":{"type":"boolean"},"externalId":{"type":["string","null"]}}}},"failed":{"type":"array","items":{"type":"object","properties":{"channelId":{"type":"string"},"reason":{"type":"string"}}}},"redirect_url":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/BadRequest"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/accounts/{id}/discord-channels":{"get":{"tags":["Discord"],"summary":"Text (0), announcement (5) and forum (15) channels of the account's server","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{channels}","content":{"application/json":{"schema":{"type":"object","properties":{"channels":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"integer","enum":[0,5,15]}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/discord-settings":{"get":{"tags":["Discord"],"summary":"Connected channel and server, and the default webhook identity of every post","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"responses":{"200":{"description":"{account}","content":{"application/json":{"schema":{"type":"object","properties":{"account":{"$ref":"#/components/schemas/DiscordSettings"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"tags":["Discord"],"summary":"Default webhook identity (webhookUsername 1-80 characters without \"discord\"/\"clyde\", webhookAvatarUrl https; \"\" resets) and/or channelId: move the account to another text, announcement or forum channel of the same server (the bot creates a webhook there)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"webhookUsername":{"type":"string"},"webhookAvatarUrl":{"type":"string"},"channelId":{"type":"string"}}}}}},"responses":{"200":{"description":"{message, account}","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"account":{"$ref":"#/components/schemas/DiscordSettings"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/discord/channels/{channelId}/pins":{"get":{"tags":["Discord"],"summary":"Pinned messages of the channel (at most 50, most recent first; Discord message objects). Every call takes accountId: a Discord account of the organization bound to that server (404 otherwise). Discord's 403 (bot permissions or role hierarchy) is passed on; servers that installed the bot before a permission was asked for must re-invite it","parameters":[{"name":"channelId","in":"path","required":true,"schema":{"type":"string"},"description":"Discord channel id (snowflake)"},{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Discord account id bound to this server (or the channel's server)"}],"responses":{"200":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/discord/channels/{channelId}/pins/{messageId}":{"parameters":[{"name":"channelId","in":"path","required":true,"schema":{"type":"string"},"description":"Discord channel id (snowflake)"},{"name":"messageId","in":"path","required":true,"schema":{"type":"string"},"description":"Discord message id"}],"put":{"tags":["Discord"],"summary":"Pin a message (idempotent; needs Manage Messages; a 51st pin is a 400)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Discord account id bound to this server (or the channel's server)"}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"operation":{"type":"string","enum":["message_pinned"]},"channelId":{"type":"string"},"messageId":{"type":"string"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Discord"],"summary":"Unpin a message (idempotent)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Discord account id bound to this server (or the channel's server)"}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"operation":{"type":"string","enum":["message_unpinned"]},"channelId":{"type":"string"},"messageId":{"type":"string"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/discord/channels/{channelId}/threads":{"post":{"tags":["Discord"],"summary":"Create a public thread from messageId, or a standalone one (needs Create Public Threads)","parameters":[{"name":"channelId","in":"path","required":true,"schema":{"type":"string"},"description":"Discord channel id (snowflake)"},{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Discord account id bound to this server (or the channel's server)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":100},"messageId":{"type":"string"},"autoArchiveDuration":{"type":"integer","enum":[60,1440,4320,10080]}},"required":["name"]}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/discord/channels/{channelId}/messages/{messageId}":{"delete":{"tags":["Discord"],"summary":"Delete a message in the channel (any author: needs Manage Messages). Cannot be undone","parameters":[{"name":"channelId","in":"path","required":true,"schema":{"type":"string"},"description":"Discord channel id (snowflake)"},{"name":"messageId","in":"path","required":true,"schema":{"type":"string"},"description":"Discord message id"},{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Discord account id bound to this server (or the channel's server)"}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/discord/channels/{channelId}/messages/{messageId}/crosspost":{"post":{"tags":["Discord"],"summary":"Publish an announcement-channel message to every following server (400 before Discord is called when the channel is not an announcement channel)","parameters":[{"name":"channelId","in":"path","required":true,"schema":{"type":"string"},"description":"Discord channel id (snowflake)"},{"name":"messageId","in":"path","required":true,"schema":{"type":"string"},"description":"Discord message id"},{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Discord account id bound to this server (or the channel's server)"}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","description":"The crossposted message"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/discord/guilds/{guildId}/roles":{"parameters":[{"name":"guildId","in":"path","required":true,"schema":{"type":"string"},"description":"Discord server (guild) id"}],"get":{"tags":["Discord"],"summary":"Every role of the server (unordered; sort by position). Every call takes accountId: a Discord account of the organization bound to that server (404 otherwise). Discord's 403 (bot permissions or role hierarchy) is passed on; servers that installed the bot before a permission was asked for must re-invite it","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Discord account id bound to this server (or the channel's server)"}],"responses":{"200":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DiscordRole"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["Discord"],"summary":"Create a role (needs Manage Roles; it cannot sit at or above the bot's highest role)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Discord account id bound to this server (or the channel's server)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":100},"color":{"type":"integer","minimum":0,"maximum":16777215},"hoist":{"type":"boolean"},"mentionable":{"type":"boolean"},"permissions":{"type":"string","description":"Bitfield as a string of digits"}},"required":["name"]}}}},"responses":{"201":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DiscordRole"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/discord/guilds/{guildId}/roles/{roleId}":{"parameters":[{"name":"guildId","in":"path","required":true,"schema":{"type":"string"},"description":"Discord server (guild) id"},{"name":"roleId","in":"path","required":true,"schema":{"type":"string"},"description":"Role id"}],"patch":{"tags":["Discord"],"summary":"Edit a role: at least one of name, color, hoist, mentionable, permissions","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Discord account id bound to this server (or the channel's server)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":100},"color":{"type":"integer","minimum":0,"maximum":16777215},"hoist":{"type":"boolean"},"mentionable":{"type":"boolean"},"permissions":{"type":"string","description":"Bitfield as a string of digits"}}}}}},"responses":{"200":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DiscordRole"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Discord"],"summary":"Delete a role (from every member too). Cannot be undone","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Discord account id bound to this server (or the channel's server)"}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/discord/guilds/{guildId}/members":{"get":{"tags":["Discord"],"summary":"Members, cursor-paginated (pass pagination.nextCursor as after). Needs the Server Members Intent on the bot app","parameters":[{"name":"guildId","in":"path","required":true,"schema":{"type":"string"},"description":"Discord server (guild) id"},{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Discord account id bound to this server (or the channel's server)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":1000,"default":100},"description":"Maximum items (default 100, max 1000)"},{"name":"after","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor of the previous page"}],"responses":{"200":{"description":"{data, pagination}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DiscordGuildMember"}},"pagination":{"type":"object","properties":{"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/discord/guilds/{guildId}/members/search":{"get":{"tags":["Discord"],"summary":"Members whose username or nickname starts with query","parameters":[{"name":"guildId","in":"path","required":true,"schema":{"type":"string"},"description":"Discord server (guild) id"},{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Discord account id bound to this server (or the channel's server)"},{"name":"query","in":"query","required":true,"schema":{"type":"string"},"description":"Username or nickname prefix"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":1000,"default":100},"description":"Maximum items (default 100, max 1000)"}],"responses":{"200":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DiscordGuildMember"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/discord/guilds/{guildId}/members/{userId}":{"get":{"tags":["Discord"],"summary":"One member","parameters":[{"name":"guildId","in":"path","required":true,"schema":{"type":"string"},"description":"Discord server (guild) id"},{"name":"userId","in":"path","required":true,"schema":{"type":"string"},"description":"User id"},{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Discord account id bound to this server (or the channel's server)"}],"responses":{"200":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DiscordGuildMember"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/discord/guilds/{guildId}/members/{userId}/roles/{roleId}":{"parameters":[{"name":"guildId","in":"path","required":true,"schema":{"type":"string"},"description":"Discord server (guild) id"},{"name":"userId","in":"path","required":true,"schema":{"type":"string"},"description":"User id"},{"name":"roleId","in":"path","required":true,"schema":{"type":"string"},"description":"Role id"}],"put":{"tags":["Discord"],"summary":"Assign a role to a member (idempotent; @everyone is refused; the role must sit below the bot's highest role)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Discord account id bound to this server (or the channel's server)"}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"operation":{"type":"string","enum":["role_assigned"]},"guildId":{"type":"string"},"userId":{"type":"string"},"roleId":{"type":"string"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Discord"],"summary":"Remove a role from a member (idempotent)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Discord account id bound to this server (or the channel's server)"}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"operation":{"type":"string","enum":["role_removed"]},"guildId":{"type":"string"},"userId":{"type":"string"},"roleId":{"type":"string"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/discord/guilds/{guildId}/events":{"parameters":[{"name":"guildId","in":"path","required":true,"schema":{"type":"string"},"description":"Discord server (guild) id"}],"get":{"tags":["Discord"],"summary":"Scheduled events of the server (withUserCount adds user_count, the RSVPs)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Discord account id bound to this server (or the channel's server)"},{"name":"withUserCount","in":"query","required":false,"schema":{"type":"boolean"},"description":"Include user_count"}],"responses":{"200":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DiscordScheduledEvent"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["Discord"],"summary":"Create a scheduled event: external (location and endsAt), voice or stage (channelId). Needs Manage Events","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"name":{"type":"string","maxLength":100},"description":{"type":"string","maxLength":1000},"startsAt":{"type":"string","description":"ISO 8601, in the future","format":"date-time"},"entity":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["external"]},"location":{"type":"string","maxLength":100},"endsAt":{"type":"string","format":"date-time"}},"required":["type","location","endsAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["voice","stage"]},"channelId":{"type":"string"},"endsAt":{"type":"string","format":"date-time"}},"required":["type","channelId"]}]},"imageDataUri":{"type":"string","description":"Cover image as a base64 data URI (PNG, JPEG, GIF)"}},"required":["accountId","name","startsAt","entity"]}}}},"responses":{"200":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DiscordScheduledEvent"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/discord/guilds/{guildId}/events/{eventId}":{"parameters":[{"name":"guildId","in":"path","required":true,"schema":{"type":"string"},"description":"Discord server (guild) id"},{"name":"eventId","in":"path","required":true,"schema":{"type":"string"},"description":"Event id"}],"get":{"tags":["Discord"],"summary":"One scheduled event","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Discord account id bound to this server (or the channel's server)"}],"responses":{"200":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DiscordScheduledEvent"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"patch":{"tags":["Discord"],"summary":"Update any subset; status cancelled cancels the event (kept in the server's history)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"startsAt":{"type":"string"},"endsAt":{"type":"string"},"location":{"type":"string","description":"External events"},"status":{"type":"string","enum":["scheduled","active","completed","cancelled"]},"imageDataUri":{"type":"string"}},"required":["accountId"]}}}},"responses":{"200":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DiscordScheduledEvent"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["Discord"],"summary":"Delete a scheduled event for good","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"Discord account id bound to this server (or the channel's server)"}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"deleted":{"type":"string"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/discord/dms":{"post":{"tags":["Discord"],"summary":"A 1:1 DM from the bot to a user it shares a server with (by snowflake id; Discord answers 403 when the user accepts no DMs). Sent now, not stored; replies never arrive","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"userId":{"type":"string","description":"15-21 digits"},"content":{"type":"string","maxLength":2000},"embeds":{"type":"array","maxItems":10,"items":{"type":"object","properties":{"title":{"type":"string","maxLength":256},"description":{"type":"string","maxLength":4096},"url":{"type":"string","description":"https URL"},"color":{"type":"integer","minimum":0,"maximum":16777215,"description":"0xRRGGBB"},"timestamp":{"type":"string","format":"date-time"},"footer":{"type":"object","properties":{"text":{"type":"string","maxLength":2048},"icon_url":{"type":"string"}},"required":["text"]},"image":{"type":"object","properties":{"url":{"type":"string","description":"https URL or attachment://<file name>"}},"required":["url"]},"thumbnail":{"type":"object","properties":{"url":{"type":"string","description":"https URL or attachment://<file name>"}},"required":["url"]},"author":{"type":"object","properties":{"name":{"type":"string","maxLength":256},"url":{"type":"string"},"icon_url":{"type":"string"}},"required":["name"]},"fields":{"type":"array","maxItems":25,"items":{"type":"object","properties":{"name":{"type":"string","maxLength":256},"value":{"type":"string","maxLength":1024},"inline":{"type":"boolean"}},"required":["name","value"]}}},"description":"Discord's embed object (the keys a webhook may set; unknown keys are refused). Needs at least one of title, description, fields, image, thumbnail, author, footer"}},"attachments":{"type":"array","maxItems":10,"items":{"type":"object","properties":{"type":{"type":"string","enum":["image","video","gif","document"]},"url":{"type":"string"},"filename":{"type":"string"}},"required":["type","url"]}},"tts":{"type":"boolean"}},"required":["accountId","userId"]}}}},"responses":{"200":{"description":"DM sent","content":{"application/json":{"schema":{"type":"object","properties":{"messageId":{"type":"string"},"channelId":{"type":"string","description":"DM channel id"},"url":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"recipient":{"type":"object","properties":{"userId":{"type":"string"},"platform":{"type":"string"}}},"account":{"type":"object","properties":{"id":{"type":"string"},"username":{"type":["string","null"]},"displayName":{"type":"string"}}}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/linkedin-organizations":{"get":{"tags":["LinkedIn"],"summary":"The organization pages the account's member administers (organizationAcls role ADMINISTRATOR); their ids go in organizationUrn","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"LinkedIn account id"}],"responses":{"200":{"description":"{organizations}","content":{"application/json":{"schema":{"type":"object","properties":{"organizations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"vanityName":{"type":"string"},"localizedName":{"type":"string"}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/linkedin-organization":{"put":{"tags":["LinkedIn"],"summary":"Switch the account between the member's personal profile and one of their organization pages, without a new OAuth (the account id, posts and settings stay)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"LinkedIn account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountType":{"type":"string","enum":["personal","organization"]},"selectedOrganization":{"type":"object","properties":{"id":{"type":"string","description":"Organization id or urn:li:organization:<id>"}}}},"required":["accountType"]}}}},"responses":{"200":{"description":"{message, accountType, accountName}","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"accountType":{"type":"string","enum":["personal","organization"]},"accountName":{"type":"string"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/linkedin-mentions":{"get":{"tags":["LinkedIn"],"summary":"Resolve a LinkedIn profile or company URL to its URN and LinkedIn name, with @[Name](urn) markup for post content. Person lookups need the account to administer a LinkedIn Page","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"LinkedIn account id"},{"name":"url","in":"query","required":true,"schema":{"type":"string"},"description":"Profile URL (linkedin.com/in/…), company URL (linkedin.com/company/…) or company vanity name"}],"responses":{"200":{"description":"{urn, type, displayName, mentionFormat, vanityName?}","content":{"application/json":{"schema":{"type":"object","properties":{"urn":{"type":"string"},"type":{"type":"string","enum":["person","organization"]},"displayName":{"type":"string"},"mentionFormat":{"type":"string"},"vanityName":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/linkedin-post-analytics":{"get":{"tags":["LinkedIn"],"summary":"One post's analytics by URN. Personal accounts: posts the member authored (r_member_postAnalytics); organization pages: share statistics","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"LinkedIn account id"},{"name":"urn","in":"query","required":true,"schema":{"type":"string"},"description":"Post URN: urn:li:share:…, urn:li:ugcPost:… (an activity number or a post link also works)"}],"responses":{"200":{"description":"{accountId, platform, accountType, username, postUrn, analytics, lastUpdated}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string","enum":["linkedin"]},"accountType":{"type":"string","enum":["personal","organization"]},"username":{"type":"string"},"postUrn":{"type":"string"},"analytics":{"type":"object","properties":{"impressions":{"type":"integer"},"reach":{"type":"integer"},"likes":{"type":"integer","description":"Reactions"},"comments":{"type":"integer"},"shares":{"type":"integer"},"saves":{"type":"integer","description":"Personal accounts only (0 for pages)"},"sends":{"type":"integer","description":"Personal accounts only (0 for pages)"},"clicks":{"type":"integer","description":"Organization pages only"},"views":{"type":"integer"},"engagementRate":{"type":"number"}}},"unavailable":{"type":"array","items":{"type":"string"}},"lastUpdated":{"type":"string","format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/linkedin-aggregate-analytics":{"get":{"tags":["LinkedIn"],"summary":"Personal accounts: totals (TOTAL) or a daily series (DAILY) across every post the member authored. Organization pages use /analytics/linkedin/org-aggregate-analytics","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"LinkedIn account id"},{"name":"aggregation","in":"query","required":false,"schema":{"type":"string","enum":["TOTAL","DAILY"]},"description":"TOTAL (default) or DAILY"},{"name":"fromDate","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Start (omit for lifetime; required for DAILY)"},{"name":"toDate","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"End, exclusive (default today)"},{"name":"startDate","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Alias of fromDate"},{"name":"endDate","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Alias of toDate"},{"name":"metrics","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated: IMPRESSION, MEMBERS_REACHED, REACTION, COMMENT, RESHARE, POST_SAVE, POST_SEND (default all)"}],"responses":{"200":{"description":"{accountId, platform, accountType, username, aggregation, dateRange, analytics, skippedMetrics?, note, lastUpdated}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string","enum":["linkedin"]},"accountType":{"type":"string","enum":["personal","organization"]},"username":{"type":"string"},"aggregation":{"type":"string","enum":["TOTAL","DAILY"]},"dateRange":{"type":["object","null"]},"analytics":{"type":"object","description":"TOTAL: impressions, reach, reactions, comments, shares, saves, sends, engagementRate. DAILY: each metric as [{date, count}] (no reach)"},"skippedMetrics":{"type":"array","items":{"type":"string"}},"note":{"type":"string"},"lastUpdated":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/linkedin-post-reactions":{"get":{"tags":["LinkedIn"],"summary":"The individual reactions on a post, newest first (organization pages only)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"LinkedIn account id"},{"name":"urn","in":"query","required":true,"schema":{"type":"string"},"description":"Post URN: urn:li:share:…, urn:li:ugcPost:… (an activity number or a post link also works)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"description":"Maximum items (default 50, max 100)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"pagination.cursor of the previous page"}],"responses":{"200":{"description":"{accountId, platform, accountType, username, postUrn, reactions, pagination, lastUpdated}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string","enum":["linkedin"]},"accountType":{"type":"string","enum":["personal","organization"]},"username":{"type":"string"},"postUrn":{"type":"string"},"reactions":{"type":"array","items":{"type":"object","properties":{"reactionType":{"type":"string","enum":["LIKE","PRAISE","EMPATHY","INTEREST","APPRECIATION","ENTERTAINMENT"]},"reactionLabel":{"type":"string"},"reactedAt":{"type":"string","format":"date-time"},"from":{"type":"object","properties":{"urn":{"type":"string"}}}}}},"pagination":{"type":"object","properties":{"hasMore":{"type":"boolean"},"cursor":{"type":"string","description":"Offset of the next page"},"total":{"type":"integer"}}},"lastUpdated":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/analytics/linkedin/org-aggregate-analytics":{"get":{"tags":["LinkedIn"],"summary":"Organization page analytics: share statistics (impressions, unique_impressions, clicks, likes, comments, shares, engagement_rate), follower gains (organic_followers_gained, paid_followers_gained), page views (page_views_total, _overview, _careers, _jobs, _life; total_value only) and followers_gained / followers_lost from Postgale's daily follower snapshots. Max 89 days, default the last 30. A metric that cannot be served is listed in unavailableMetrics, never reported as 0","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"LinkedIn organization account id"},{"name":"metrics","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated (default impressions, clicks, engagement_rate, organic_followers_gained, followers_gained, followers_lost)"},{"name":"metricType","in":"query","required":false,"schema":{"type":"string","enum":["total_value","time_series"]},"description":"Default total_value"},{"name":"fromDate","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Default 30 days ago"},{"name":"toDate","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Default today"},{"name":"since","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Alias of fromDate"},{"name":"until","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Alias of toDate"}],"responses":{"200":{"description":"{success, accountId, platform, dateRange, metricType, metrics, unavailableMetrics?, dataDelay}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"accountId":{"type":"string"},"platform":{"type":"string"},"dateRange":{"type":"object","properties":{"since":{"type":"string"},"until":{"type":"string"}}},"metricType":{"type":"string","enum":["total_value","time_series"]},"metrics":{"type":"object","additionalProperties":{"type":"object","properties":{"total":{"type":"number"},"values":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"value":{"type":"number"}}}}}}},"unavailableMetrics":{"type":"array","items":{"type":"object","properties":{"metric":{"type":"string"},"reason":{"type":"string"},"message":{"type":"string"}}}},"dataDelay":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/analytics/linkedin/demographics":{"get":{"tags":["LinkedIn"],"summary":"Lifetime follower breakdown of an organization page by job function, seniority, industry and company size, largest first (LinkedIn returns at most the top 100 per breakdown)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"LinkedIn organization account id"},{"name":"breakdown","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated: function, seniority, industry, company_size (default all four)"}],"responses":{"200":{"description":"{success, accountId, platform, metric, demographics, note}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"accountId":{"type":"string"},"platform":{"type":"string"},"metric":{"type":"string","enum":["follower_demographics"]},"demographics":{"type":"object","additionalProperties":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"LinkedIn URN (not for company_size)"},"label":{"type":"string"},"value":{"type":"integer"}}}}},"note":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/broadcasts":{"get":{"tags":["Broadcasts"],"summary":"Broadcasts with delivery stats","parameters":[{"name":"profileId","in":"query","required":false,"schema":{"type":"string"},"description":"Profile"},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"draft, scheduled, sending, completed, failed, cancelled"},{"name":"platform","in":"query","required":false,"schema":{"type":"string"},"description":"whatsapp"},{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Sending account"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Page size"},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","minimum":0},"description":"Items to skip"}],"responses":{"200":{"description":"{success, broadcasts, pagination}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"broadcasts":{"type":"array","items":{"$ref":"#/components/schemas/Broadcast"}},"pagination":{"type":"object","properties":{"total":{"type":"integer"},"limit":{"type":"integer"},"skip":{"type":"integer"},"hasMore":{"type":"boolean"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Broadcasts"],"summary":"Create a draft broadcast of an approved WhatsApp template (variableMapping fills {{n}} per recipient)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"profileId":{"type":"string"},"platform":{"type":"string","enum":["whatsapp"]},"name":{"type":"string"},"description":{"type":"string"},"template":{"$ref":"#/components/schemas/BroadcastTemplate"},"message":{"type":"object"},"segmentFilters":{"type":"object"}},"required":["accountId","name","template"]}}}},"responses":{"200":{"description":"{success, broadcast}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"broadcast":{"$ref":"#/components/schemas/Broadcast"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/broadcasts/{broadcastId}":{"parameters":[{"name":"broadcastId","in":"path","required":true,"schema":{"type":"string"},"description":"Broadcast id"}],"get":{"tags":["Broadcasts"],"summary":"A broadcast with its configuration and stats","responses":{"200":{"description":"{success, broadcast}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"broadcast":{"$ref":"#/components/schemas/Broadcast"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"tags":["Broadcasts"],"summary":"Update a draft (name, description, message, template, segmentFilters)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"template":{"$ref":"#/components/schemas/BroadcastTemplate"},"message":{"type":"object"},"segmentFilters":{"type":"object"}}}}}},"responses":{"200":{"description":"{success, broadcast}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"broadcast":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Broadcasts"],"summary":"Delete a draft","responses":{"200":{"description":"{success, deleted, id}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"deleted":{"type":"boolean"},"id":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/broadcasts/{broadcastId}/recipients":{"parameters":[{"name":"broadcastId","in":"path","required":true,"schema":{"type":"string"},"description":"Broadcast id"}],"get":{"tags":["Broadcasts"],"summary":"Recipients with delivery status (filter by status) and summary totals","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"pending, sent, delivered, read, failed"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Page size"},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","minimum":0},"description":"Items to skip"}],"responses":{"200":{"description":"{success, recipients, pagination, summary}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"recipients":{"type":"array","items":{"$ref":"#/components/schemas/BroadcastRecipient"}},"pagination":{"type":"object","properties":{"total":{"type":"integer"},"limit":{"type":"integer"},"skip":{"type":"integer"},"hasMore":{"type":"boolean"}}},"summary":{"type":"object","properties":{"total":{"type":"integer"},"pending":{"type":"integer"},"sent":{"type":"integer"},"delivered":{"type":"integer"},"read":{"type":"integer"},"failed":{"type":"integer"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Broadcasts"],"summary":"Add recipients: contactIds, phones (contacts created), recipients [{phone | contactId, components}] or useSegment. Unsubscribed, blocked and duplicate recipients are skipped","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"contactIds":{"type":"array","items":{"type":"string"}},"phones":{"type":"array","items":{"type":"string"}},"recipients":{"type":"array","items":{"type":"object","properties":{"phone":{"type":"string"},"contactId":{"type":"string"},"components":{"type":"array","items":{"type":"object"}}}}},"useSegment":{"type":"boolean"}}}}}},"responses":{"200":{"description":"{success, added, skipped}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"added":{"type":"integer"},"skipped":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/broadcasts/{broadcastId}/schedule":{"post":{"tags":["Broadcasts"],"summary":"Schedule a draft (or move a scheduled broadcast) to scheduledAt; the worker sends it then","parameters":[{"name":"broadcastId","in":"path","required":true,"schema":{"type":"string"},"description":"Broadcast id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"scheduledAt":{"type":"string","format":"date-time"}},"required":["scheduledAt"]}}}},"responses":{"200":{"description":"{success, broadcast}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"broadcast":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"scheduledAt":{"type":"string"}}}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/broadcasts/{broadcastId}/send":{"post":{"tags":["Broadcasts"],"summary":"Send now (LIVE): the first batch in the request, the rest by the worker within the number's messaging-limit tier","parameters":[{"name":"broadcastId","in":"path","required":true,"schema":{"type":"string"},"description":"Broadcast id"}],"responses":{"200":{"description":"{success, status, sent, failed, recipientCount, deferred?, note?}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"status":{"type":"string"},"sent":{"type":"integer"},"failed":{"type":"integer"},"recipientCount":{"type":"integer"},"deferred":{"type":"integer"},"note":{"type":"string"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/broadcasts/{broadcastId}/cancel":{"post":{"tags":["Broadcasts"],"summary":"Cancel a scheduled or sending broadcast; sent messages are not affected","parameters":[{"name":"broadcastId","in":"path","required":true,"schema":{"type":"string"},"description":"Broadcast id"}],"responses":{"200":{"description":"{success, broadcast}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"broadcast":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/contacts":{"get":{"tags":["Contacts"],"summary":"Contacts (search on name, email, company or a phone; tags; platform; subscription)","parameters":[{"name":"profileId","in":"query","required":false,"schema":{"type":"string"},"description":"Profile"},{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"Channel account"},{"name":"search","in":"query","required":false,"schema":{"type":"string"},"description":"Name, email, company or phone"},{"name":"tag","in":"query","required":false,"schema":{"type":"string"},"description":"One tag"},{"name":"tags","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated, any"},{"name":"platform","in":"query","required":false,"schema":{"type":"string"},"description":"Channel platform"},{"name":"isSubscribed","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]},"description":"Subscription"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Page size"},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","minimum":0},"description":"Items to skip"}],"responses":{"200":{"description":"{success, contacts, filters, pagination}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"contacts":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}},"filters":{"type":"object","properties":{"tags":{"type":"array","items":{"type":"string"}}}},"pagination":{"type":"object","properties":{"total":{"type":"integer"},"limit":{"type":"integer"},"skip":{"type":"integer"},"hasMore":{"type":"boolean"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Contacts"],"summary":"Create a contact, with its channel when accountId and platformIdentifier are given","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"company":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"isSubscribed":{"type":"boolean"},"notes":{"type":"string"},"customFields":{"type":"object"},"profileId":{"type":"string"},"accountId":{"type":"string"},"platform":{"type":"string"},"platformIdentifier":{"type":"string","description":"WhatsApp: phone in international format"},"displayIdentifier":{"type":"string"}},"required":["name"]}}}},"responses":{"200":{"description":"{success, contact, channel?, warning?}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"contact":{"$ref":"#/components/schemas/Contact"},"channel":{"$ref":"#/components/schemas/ContactChannel"},"warning":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/contacts/bulk":{"post":{"tags":["Contacts"],"summary":"Import up to 1000 contacts; duplicates (same channel) are skipped and their new tags merged","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"Required when contacts carry a phone"},"profileId":{"type":"string"},"contacts":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string"},"platformIdentifier":{"type":"string"},"email":{"type":"string"},"company":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"customFields":{"type":"object"},"accountId":{"type":"string"}}}}},"required":["contacts"]}}}},"responses":{"200":{"description":"{success, created, skipped, errors, total}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"created":{"type":"integer"},"skipped":{"type":"integer"},"errors":{"type":"array","items":{"type":"string"}},"total":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/contacts/{contactId}":{"parameters":[{"name":"contactId","in":"path","required":true,"schema":{"type":"string"},"description":"Contact id"}],"get":{"tags":["Contacts"],"summary":"A contact with its channels and message counts","responses":{"200":{"description":"{success, contact, channels}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"contact":{"$ref":"#/components/schemas/Contact"},"channels":{"type":"array","items":{"$ref":"#/components/schemas/ContactChannel"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"tags":["Contacts"],"summary":"Update fields of a contact","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"company":{"type":"string"},"avatarUrl":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"isSubscribed":{"type":"boolean"},"isBlocked":{"type":"boolean"},"notes":{"type":"string"},"customFields":{"type":"object"}}}}}},"responses":{"200":{"description":"{success, contact}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"contact":{"$ref":"#/components/schemas/Contact"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Contacts"],"summary":"Delete a contact and its channels","responses":{"200":{"description":"{success, deleted, id}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"deleted":{"type":"boolean"},"id":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/contacts/{contactId}/channels":{"get":{"tags":["Contacts"],"summary":"Channels of a contact","parameters":[{"name":"contactId","in":"path","required":true,"schema":{"type":"string"},"description":"Contact id"}],"responses":{"200":{"description":"{success, channels}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"channels":{"type":"array","items":{"$ref":"#/components/schemas/ContactChannel"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/whatsapp/business-profile":{"get":{"tags":["WhatsApp"],"summary":"Business profile (about, address, description, email, profilePictureUrl, websites, vertical)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{success, businessProfile}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"businessProfile":{"type":"object","properties":{"about":{"type":"string"},"address":{"type":"string"},"description":{"type":"string"},"email":{"type":"string"},"profilePictureUrl":{"type":"string"},"websites":{"type":"array","items":{"type":"string"}},"vertical":{"type":"string"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["WhatsApp"],"summary":"Update the business profile (only given fields)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"about":{"type":"string","maxLength":139},"address":{"type":"string"},"description":{"type":"string","maxLength":512},"email":{"type":"string"},"websites":{"type":"array","items":{"type":"string"},"description":"At most 2"},"vertical":{"type":"string"},"profilePictureHandle":{"type":"string"}},"required":["accountId"]}}}},"responses":{"200":{"description":"{success}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/business-profile/photo":{"post":{"tags":["WhatsApp"],"summary":"Set the profile picture from a public https URL or a Postgale media (JPEG/PNG ≤5 MB)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"url":{"type":"string"},"mediaId":{"type":"string"}},"required":["accountId"]}}}},"responses":{"200":{"description":"{success}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/business-profile/username":{"get":{"tags":["WhatsApp"],"summary":"The WhatsApp Business username and its state (approved, reserved, none)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{success, username, status}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"username":{"type":["string","null"]},"status":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["WhatsApp"],"summary":"Claim (or with transferAction force_transfer, transfer) a username","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"username":{"type":"string"},"transferAction":{"type":"string","enum":["force_transfer","none"]}},"required":["accountId","username"]}}}},"responses":{"200":{"description":"{success, username, status}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"username":{"type":"string"},"status":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["WhatsApp"],"summary":"Release the username","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"}},"required":["accountId"]}}}},"responses":{"200":{"description":"{success}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/business-profile/username/suggestions":{"get":{"tags":["WhatsApp"],"summary":"Available username suggestions","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{success, suggestions}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"suggestions":{"type":"array","items":{"type":"string"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/business-profile/display-name":{"get":{"tags":["WhatsApp"],"summary":"Display name and its Meta review status","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{success, displayName}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"displayName":{"type":"object","properties":{"name":{"type":"string"},"status":{"type":"string"},"phoneNumber":{"type":"string"},"pendingName":{"type":"string"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["WhatsApp"],"summary":"Submit a display name change for Meta review","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"displayName":{"type":"string"}},"required":["accountId","displayName"]}}}},"responses":{"200":{"description":"{success, message, displayName}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"displayName":{"type":"object","properties":{"name":{"type":"string"},"status":{"type":"string"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/block-users":{"get":{"tags":["WhatsApp"],"summary":"Users blocked on this number (cursor-paginated)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"Page size"},{"name":"after","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor"}],"responses":{"200":{"description":"{blockedUsers, nextCursor}","content":{"application/json":{"schema":{"type":"object","properties":{"blockedUsers":{"type":"array","items":{"type":"object","properties":{"waId":{"type":"string"}}}},"nextCursor":{"type":["string","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["WhatsApp"],"summary":"Block users (phones or wa_ids); per-user results","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"users":{"type":"array","items":{"type":"string"}}},"required":["accountId","users"]}}}},"responses":{"200":{"description":"{blocked, failed}","content":{"application/json":{"schema":{"type":"object","properties":{"blocked":{"type":"array","items":{"type":"object","properties":{"input":{"type":"string"},"waId":{"type":"string"}}}},"failed":{"type":"array","items":{"type":"object","properties":{"input":{"type":"string"},"errors":{"type":"array","items":{"type":"string"}}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["WhatsApp"],"summary":"Unblock users; per-user results","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"users":{"type":"array","items":{"type":"string"}}},"required":["accountId","users"]}}}},"responses":{"200":{"description":"{unblocked, failed}","content":{"application/json":{"schema":{"type":"object","properties":{"unblocked":{"type":"array","items":{"type":"object","properties":{"input":{"type":"string"},"waId":{"type":"string"}}}},"failed":{"type":"array","items":{"type":"object","properties":{"input":{"type":"string"},"errors":{"type":"array","items":{"type":"string"}}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/block-users/status":{"get":{"tags":["WhatsApp"],"summary":"Whether one user is blocked","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"user","in":"query","required":true,"schema":{"type":"string"},"description":"wa_id or phone"}],"responses":{"200":{"description":"{blocked}","content":{"application/json":{"schema":{"type":"object","properties":{"blocked":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/conversational-automation":{"get":{"tags":["WhatsApp"],"summary":"Ice breakers, slash commands and the welcome-message flag","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{data}","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"enable_welcome_message":{"type":"boolean"},"prompts":{"type":"array","items":{"type":"string"}},"commands":{"type":"array","items":{"type":"object","properties":{"command_name":{"type":"string"},"command_description":{"type":"string"}}}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["WhatsApp"],"summary":"Set ice breakers (≤3, 80 chars), commands (≤30) and enable_welcome_message; only given fields change","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"enable_welcome_message":{"type":"boolean"},"prompts":{"type":"array","items":{"type":"string"}},"commands":{"type":"array","items":{"type":"object","properties":{"command_name":{"type":"string"},"command_description":{"type":"string"}}}}},"required":["accountId"]}}}},"responses":{"200":{"description":"{success}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["WhatsApp"],"summary":"Remove every prompt and command and turn the welcome message off","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{success}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/wa-groups":{"get":{"tags":["WhatsApp"],"summary":"Active groups of the number","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"Max groups"},{"name":"after","in":"query","required":false,"schema":{"type":"string"},"description":"Cursor"}],"responses":{"200":{"description":"{groups, paging}","content":{"application/json":{"schema":{"type":"object","properties":{"groups":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"subject":{"type":"string"},"createdAt":{"type":"string"}}}},"paging":{"type":"object","properties":{"cursors":{"type":"object","properties":{"after":{"type":["string","null"]},"before":{"type":["string","null"]}}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["WhatsApp"],"summary":"Create a group; returns its id and invite link","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"subject":{"type":"string","maxLength":128},"description":{"type":"string","maxLength":2048},"joinApprovalMode":{"type":"string","enum":["approval_required","auto_approve"]}},"required":["accountId","subject"]}}}},"responses":{"201":{"description":"{success, group}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"group":{"type":"object","properties":{"groupId":{"type":"string"},"inviteLink":{"type":["string","null"]}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/wa-groups/{groupId}":{"parameters":[{"name":"groupId","in":"path","required":true,"schema":{"type":"string"},"description":"Group id"}],"get":{"tags":["WhatsApp"],"summary":"Group metadata and participants","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{success, group}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"group":{"type":"object","properties":{"id":{"type":"string"},"subject":{"type":"string"},"description":{"type":"string"},"joinApprovalMode":{"type":"string"},"participants":{"type":"array","items":{"type":"object","properties":{"user":{"type":"string"},"admin":{"type":"string"}}}},"participantCount":{"type":"integer"},"createdAt":{"type":"integer"},"isSuspended":{"type":"boolean"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["WhatsApp"],"summary":"Update subject, description or joinApprovalMode","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string"},"description":{"type":"string"},"joinApprovalMode":{"type":"string","enum":["approval_required","auto_approve"]}}}}}},"responses":{"200":{"description":"{success}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["WhatsApp"],"summary":"Delete the group and remove everyone","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{success}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/wa-groups/{groupId}/invite-link":{"post":{"tags":["WhatsApp"],"summary":"A new invite link (the previous one is revoked)","parameters":[{"name":"groupId","in":"path","required":true,"schema":{"type":"string"},"description":"Group id"},{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{success, inviteLink}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"inviteLink":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/wa-groups/{groupId}/participants":{"parameters":[{"name":"groupId","in":"path","required":true,"schema":{"type":"string"},"description":"Group id"}],"post":{"tags":["WhatsApp"],"summary":"Add participants (≤8; a group holds at most 8)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"phoneNumbers":{"type":"array","items":{"type":"string"},"description":"E.164 phones"}},"required":["phoneNumbers"]}}}},"responses":{"200":{"description":"{success}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["WhatsApp"],"summary":"Remove participants","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"phoneNumbers":{"type":"array","items":{"type":"string"},"description":"E.164 phones"}},"required":["phoneNumbers"]}}}},"responses":{"200":{"description":"{success}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/wa-groups/{groupId}/join-requests":{"parameters":[{"name":"groupId","in":"path","required":true,"schema":{"type":"string"},"description":"Group id"}],"get":{"tags":["WhatsApp"],"summary":"Pending join requests (approval_required groups)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{success, joinRequests}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"joinRequests":{"type":"array","items":{"type":"object","properties":{"user":{"type":"string"},"timestamp":{"type":"integer"}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["WhatsApp"],"summary":"Approve join requests","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"phoneNumbers":{"type":"array","items":{"type":"string"},"description":"Phones to approve"}},"required":["phoneNumbers"]}}}},"responses":{"200":{"description":"{success}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["WhatsApp"],"summary":"Reject join requests","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"phoneNumbers":{"type":"array","items":{"type":"string"},"description":"Phones to reject"}},"required":["phoneNumbers"]}}}},"responses":{"200":{"description":"{success}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/flows":{"get":{"tags":["WhatsApp"],"summary":"Flows of the WABA, with version and lineageId","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{success, flows}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"flows":{"type":"array","items":{"$ref":"#/components/schemas/WhatsAppFlow"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["WhatsApp"],"summary":"Create a DRAFT flow (cloneFlowId copies its JSON; asVersion keeps it in that lineage as the next version)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"name":{"type":"string"},"categories":{"type":"array","items":{"type":"string","enum":["SIGN_UP","SIGN_IN","APPOINTMENT_BOOKING","LEAD_GENERATION","CONTACT_US","CUSTOMER_SUPPORT","SURVEY","OTHER"]}},"cloneFlowId":{"type":"string"},"asVersion":{"type":"boolean"},"endpointUri":{"type":"string","description":"https data exchange endpoint"}},"required":["accountId","name","categories"]}}}},"responses":{"200":{"description":"{success, flow}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"flow":{"$ref":"#/components/schemas/WhatsAppFlow"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/flows/{flowId}":{"parameters":[{"name":"flowId","in":"path","required":true,"schema":{"type":"string"},"description":"Flow id"}],"get":{"tags":["WhatsApp"],"summary":"A flow: status, categories, validation errors, preview","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"fields","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated Meta fields"}],"responses":{"200":{"description":"{success, flow}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"flow":{"$ref":"#/components/schemas/WhatsAppFlow"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"patch":{"tags":["WhatsApp"],"summary":"Update name, categories or endpointUri of a DRAFT flow","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"name":{"type":"string"},"categories":{"type":"array","items":{"type":"string"}},"endpointUri":{"type":"string"}},"required":["accountId"]}}}},"responses":{"200":{"description":"{success}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["WhatsApp"],"summary":"Delete a DRAFT flow (irreversible)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{success}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/flows/{flowId}/json":{"parameters":[{"name":"flowId","in":"path","required":true,"schema":{"type":"string"},"description":"Flow id"}],"get":{"tags":["WhatsApp"],"summary":"The Flow JSON asset with a temporary download URL","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{success, assets}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"assets":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"asset_type":{"type":"string"},"download_url":{"type":["string","null"]}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"put":{"tags":["WhatsApp"],"summary":"Upload the Flow JSON of a DRAFT flow; answers Meta's validation errors","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"flow_json":{"description":"The Flow JSON (object or text)"}},"required":["accountId","flow_json"]}}}},"responses":{"200":{"description":"{success, validation_errors}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"validation_errors":{"type":"array","items":{"type":"object"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/flows/{flowId}/publish":{"post":{"tags":["WhatsApp"],"summary":"Publish a DRAFT flow (irreversible)","parameters":[{"name":"flowId","in":"path","required":true,"schema":{"type":"string"},"description":"Flow id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"}},"required":["accountId"]}}}},"responses":{"200":{"description":"{success}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/flows/{flowId}/deprecate":{"post":{"tags":["WhatsApp"],"summary":"Deprecate a PUBLISHED flow (irreversible)","parameters":[{"name":"flowId","in":"path","required":true,"schema":{"type":"string"},"description":"Flow id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"}},"required":["accountId"]}}}},"responses":{"200":{"description":"{success}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/flows/{flowId}/preview":{"get":{"tags":["WhatsApp"],"summary":"Meta's web preview URL of the flow (drafts too)","parameters":[{"name":"flowId","in":"path","required":true,"schema":{"type":"string"},"description":"Flow id"},{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"invalidate","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]},"description":"Mint a fresh link"}],"responses":{"200":{"description":"{preview_url, expires_at}","content":{"application/json":{"schema":{"type":"object","properties":{"preview_url":{"type":["string","null"]},"expires_at":{"type":["string","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/flows/{flowId}/versions":{"get":{"tags":["WhatsApp"],"summary":"Version history of the flow's lineage (missing: Meta no longer has it)","parameters":[{"name":"flowId","in":"path","required":true,"schema":{"type":"string"},"description":"Flow id"},{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{versions}","content":{"application/json":{"schema":{"type":"object","properties":{"versions":{"type":"array","items":{"type":"object","properties":{"flowId":{"type":"string"},"version":{"type":"integer"},"parentFlowId":{"type":["string","null"]},"name":{"type":["string","null"]},"status":{"type":["string","null"]},"missing":{"type":"boolean"}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/flows/encryption-key":{"get":{"tags":["WhatsApp"],"summary":"The RSA public key registered for Flows endpoints","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{publicKey, signatureStatus, registered}","content":{"application/json":{"schema":{"type":"object","properties":{"publicKey":{"type":["string","null"]},"signatureStatus":{"type":["string","null"]},"registered":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["WhatsApp"],"summary":"Register (or replace) the RSA public key (PEM)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"businessPublicKey":{"type":"string"}},"required":["accountId","businessPublicKey"]}}}},"responses":{"200":{"description":"{success}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/flows/send":{"post":{"tags":["WhatsApp"],"summary":"Send a flow as an interactive message (LIVE; within the 24-hour window). flow_token defaults to <flowId>:<uuid>","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"to":{"type":"string"},"conversationId":{"type":"string"},"flow_id":{"type":"string"},"flow_cta":{"type":"string","maxLength":20},"body":{"type":"string"},"flow_action":{"type":"string","enum":["navigate","data_exchange"]},"flow_token":{"type":"string"},"flow_action_payload":{"type":"object"},"header":{},"footer":{"type":"string"},"draft":{"type":"boolean"}},"required":["accountId","flow_id","flow_cta","body"]}}}},"responses":{"200":{"description":"{success, messageId, flowToken, message, conversation}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"messageId":{"type":"string"},"flowToken":{"type":"string"},"message":{"$ref":"#/components/schemas/Message"},"conversation":{"$ref":"#/components/schemas/Conversation"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/flow-responses":{"get":{"tags":["WhatsApp"],"summary":"Flow submissions (nfm_reply), newest first","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"flowId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this flow"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"Max responses"}],"responses":{"200":{"description":"{responses}","content":{"application/json":{"schema":{"type":"object","properties":{"responses":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"receivedAt":{"type":"string"},"from":{"type":["string","null"]},"senderName":{"type":["string","null"]},"conversationId":{"type":["string","null"]},"flowToken":{"type":["string","null"]},"data":{"type":"object"},"raw":{"type":["string","null"]}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/calling":{"get":{"tags":["WhatsApp"],"summary":"Calling configuration of the number","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"WhatsAppCallingConfig + phoneNumberDocId","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WhatsAppCallingConfig"},{"type":"object","properties":{"phoneNumberDocId":{"type":"string","description":"Id for /phone-numbers/{id}/whatsapp/calling"}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/phone-numbers/{id}/whatsapp/calling":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Bought number id (GET /whatsapp/numbers) or the WhatsApp account id"}],"get":{"tags":["WhatsApp"],"summary":"Calling configuration","parameters":[{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"WhatsAppCallingConfig","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppCallingConfig"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["WhatsApp"],"summary":"Enable Business Calling and forward calls to forwardTo","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"forwardTo":{"type":"string","description":"tel:+E164, sip:user@host or wss://host"},"sipAuthUsername":{"type":["string","null"]},"sipAuthPassword":{"type":["string","null"],"description":"Stored encrypted, never returned"},"recordingEnabled":{"type":"boolean"},"callIconCountries":{"type":["array","null"]},"maxCallDurationSeconds":{"type":["integer","null"],"minimum":30,"maximum":14400},"forwardCallerId":{"type":"string","enum":["business","caller"]}},"required":["accountId","forwardTo"]}}}},"responses":{"200":{"description":"{success, callingEnabled, sipHostname, forwardTo, callerIdMode}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"callingEnabled":{"type":"boolean"},"sipHostname":{"type":"string"},"forwardTo":{"type":"string"},"callerIdMode":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"patch":{"tags":["WhatsApp"],"summary":"Update fields of an enabled number","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"forwardTo":{"type":"string","description":"tel:+E164, sip:user@host or wss://host"},"sipAuthUsername":{"type":["string","null"]},"sipAuthPassword":{"type":["string","null"],"description":"Stored encrypted, never returned"},"recordingEnabled":{"type":"boolean"},"callIconCountries":{"type":["array","null"]},"maxCallDurationSeconds":{"type":["integer","null"],"minimum":30,"maximum":14400},"forwardCallerId":{"type":"string","enum":["business","caller"]}},"required":["accountId"]}}}},"responses":{"200":{"description":"WhatsAppCallingConfig","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppCallingConfig"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["WhatsApp"],"summary":"Disable calling (Meta best-effort)","parameters":[{"name":"accountId","in":"query","required":false,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"WhatsAppCallingConfig","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppCallingConfig"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/calls":{"get":{"tags":["WhatsApp"],"summary":"Call history, newest first","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"Status"},{"name":"direction","in":"query","required":false,"schema":{"type":"string"},"description":"inbound | outbound"},{"name":"since","in":"query","required":false,"schema":{"type":"string"},"description":"ISO date-time"},{"name":"until","in":"query","required":false,"schema":{"type":"string"},"description":"ISO date-time"},{"name":"before","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"Max calls"}],"responses":{"200":{"description":"{calls, nextCursor}","content":{"application/json":{"schema":{"type":"object","properties":{"calls":{"type":"array","items":{"$ref":"#/components/schemas/WhatsAppCall"}},"nextCursor":{"type":["string","null"],"description":"Pass as before"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["WhatsApp"],"summary":"Place a LIVE business-initiated call (needs calling enabled and the person's permission), or action send_call_permission_request to ask for it","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"to":{"type":"string"},"action":{"type":"string","enum":["send_call_permission_request"]},"bodyText":{"type":"string"},"forwardTo":{"type":"string"},"recordOverride":{"type":"boolean"}},"required":["accountId","to"]}}}},"responses":{"200":{"description":"{success, callId, status, direction, to, forwardTo, recordingEnabled}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"callId":{"type":"string"},"telnyxCallControlId":{"type":"string"},"status":{"type":"string"},"direction":{"type":"string"},"to":{"type":"string"},"forwardTo":{"type":["string","null"]},"recordingEnabled":{"type":"boolean"},"action":{"type":"string"},"messageId":{"type":"string"}}}}}},"202":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/calls/estimate":{"get":{"tags":["WhatsApp"],"summary":"Zero-markup estimate of an outbound call (Meta part display only)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"to","in":"query","required":true,"schema":{"type":"string"},"description":"Phone"},{"name":"minutes","in":"query","required":false,"schema":{"type":"integer"},"description":"Minutes (default 1)"},{"name":"recording","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]},"description":"Include recording"}],"responses":{"200":{"description":"{destinationCountry, perMinuteUsd, breakdown}","content":{"application/json":{"schema":{"type":"object","properties":{"destinationCountry":{"type":["string","null"]},"perMinuteUsd":{"type":"number"},"breakdown":{"type":"object","properties":{"metaMinutes":{"type":"integer"},"metaCostUSD":{"type":"number"},"telnyxCostUSD":{"type":"number"},"recordingCostUSD":{"type":"number"},"billableCostUSD":{"type":"number"},"totalCostUSD":{"type":"number"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/calls/{id}":{"get":{"tags":["WhatsApp"],"summary":"One call","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Call id"},{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{call}","content":{"application/json":{"schema":{"type":"object","properties":{"call":{"$ref":"#/components/schemas/WhatsAppCall"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/calls/{id}/recording":{"get":{"tags":["WhatsApp"],"summary":"Redirect (302) to the call recording; as=json answers {url}","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Call id"},{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"as","in":"query","required":false,"schema":{"type":"string","enum":["json"]},"description":"Answer JSON instead of redirecting"}],"responses":{"200":{"description":"{url}","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}}}}}},"302":{"description":"Redirect to the MP3"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/whatsapp/call-permissions":{"get":{"tags":["WhatsApp"],"summary":"Call permission state of a person and the actions allowed now","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"to","in":"query","required":true,"schema":{"type":"string"},"description":"Phone"}],"responses":{"200":{"description":"{permission, actions}","content":{"application/json":{"schema":{"type":"object","properties":{"permission":{"type":"object","properties":{"status":{"type":"string","enum":["temporary","no_permission","permanent"]},"expiration_time":{"type":"integer"}}},"actions":{"type":"array","items":{"type":"object","properties":{"action_name":{"type":"string"},"can_perform_action":{"type":"boolean"}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/commerce-settings":{"get":{"tags":["WhatsApp"],"summary":"Commerce settings (catalog visible on the profile, cart enabled)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{settings}","content":{"application/json":{"schema":{"type":"object","properties":{"settings":{"type":"object","properties":{"isCartEnabled":{"type":"boolean"},"isCatalogVisible":{"type":"boolean"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"put":{"tags":["WhatsApp"],"summary":"Update commerce settings","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"catalogAccountId":{"type":"string"},"isCartEnabled":{"type":"boolean"},"isCatalogVisible":{"type":"boolean"}},"required":["accountId"]}}}},"responses":{"200":{"description":"{settings}","content":{"application/json":{"schema":{"type":"object","properties":{"settings":{"type":"object","properties":{"isCartEnabled":{"type":"boolean"},"isCatalogVisible":{"type":"boolean"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/catalogs":{"get":{"tags":["WhatsApp"],"summary":"Meta Commerce catalogs connected to the WABA","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"catalogAccountId","in":"query","required":false,"schema":{"type":"string"},"description":"Account whose token manages catalogs"}],"responses":{"200":{"description":"{wabaId, catalogs}","content":{"application/json":{"schema":{"type":"object","properties":{"wabaId":{"type":["string","null"]},"catalogs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["WhatsApp"],"summary":"Connect a catalog to the WABA","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"catalogId":{"type":"string"},"catalogAccountId":{"type":"string"}},"required":["accountId","catalogId"]}}}},"responses":{"201":{"description":"{wabaId, catalogs}","content":{"application/json":{"schema":{"type":"object","properties":{"wabaId":{"type":["string","null"]},"catalogs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["WhatsApp"],"summary":"Disconnect a catalog","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"catalogId","in":"query","required":true,"schema":{"type":"string"},"description":"Catalog id"},{"name":"catalogAccountId","in":"query","required":false,"schema":{"type":"string"},"description":"Account whose token manages catalogs"}],"responses":{"200":{"description":"{success, wabaId, catalogId}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"wabaId":{"type":["string","null"]},"catalogId":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/dataset":{"get":{"tags":["WhatsApp"],"summary":"The Click-to-WhatsApp conversions dataset of the WABA","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{datasetId}","content":{"application/json":{"schema":{"type":"object","properties":{"datasetId":{"type":["string","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["WhatsApp"],"summary":"Create (or fetch) the dataset","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"}},"required":["accountId"]}}}},"responses":{"200":{"description":"{datasetId, created}","content":{"application/json":{"schema":{"type":"object","properties":{"datasetId":{"type":"string"},"created":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/conversions":{"get":{"tags":["WhatsApp"],"summary":"Conversion events sent to Meta, newest first","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"1-200"}],"responses":{"200":{"description":"{events}","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"timestamp":{"type":"string"},"eventName":{"type":"string"},"eventId":{"type":"string"},"conversationId":{"type":["string","null"]},"eventsReceived":{"type":["integer","null"]},"eventsFailed":{"type":["integer","null"]},"traceId":{"type":["string","null"]},"durationMs":{"type":["integer","null"]}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["WhatsApp"],"summary":"Send a conversion event for a Click-to-WhatsApp conversation (email and externalId hashed)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"eventName":{"type":"string"},"eventId":{"type":"string"},"eventTime":{"type":"integer"},"conversationId":{"type":"string"},"phoneE164":{"type":"string"},"ctwaClid":{"type":"string"},"value":{"type":"number"},"currency":{"type":"string"},"contentIds":{"type":"array","items":{"type":"string"}},"email":{"type":"string"},"externalId":{"type":"string"},"testCode":{"type":"string"}},"required":["accountId","eventName","eventId"]}}}},"responses":{"200":{"description":"{platform, eventsReceived, eventsFailed, failures, traceId}","content":{"application/json":{"schema":{"type":"object","properties":{"platform":{"type":"string"},"eventsReceived":{"type":"integer"},"eventsFailed":{"type":"integer"},"failures":{"type":"array","items":{"type":"object"}},"traceId":{"type":["string","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/pricing-analytics":{"get":{"tags":["WhatsApp"],"summary":"Message volume and approximate cost of the number from Meta","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"start","in":"query","required":true,"schema":{"type":"string"},"description":"ISO date"},{"name":"end","in":"query","required":true,"schema":{"type":"string"},"description":"ISO date"},{"name":"granularity","in":"query","required":true,"schema":{"type":"string","enum":["HALF_HOUR","DAILY","MONTHLY"]},"description":"Data point size"},{"name":"dimensions","in":"query","required":false,"schema":{"type":"string"},"description":"COUNTRY, PHONE, PRICING_CATEGORY, PRICING_TYPE, TIER"},{"name":"metricTypes","in":"query","required":false,"schema":{"type":"string"},"description":"COST, VOLUME"},{"name":"pricingTypes","in":"query","required":false,"schema":{"type":"string"},"description":"Filter"},{"name":"pricingCategories","in":"query","required":false,"schema":{"type":"string"},"description":"Filter"},{"name":"countryCodes","in":"query","required":false,"schema":{"type":"string"},"description":"Filter"}],"responses":{"200":{"description":"{accountId, phoneNumber, granularity, start, end, dataPoints}","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"phoneNumber":{"type":"string"},"granularity":{"type":"string"},"start":{"type":"string"},"end":{"type":"string"},"dataPoints":{"type":"array","items":{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"},"phoneNumber":{"type":["string","null"]},"country":{"type":["string","null"]},"tier":{"type":["string","null"]},"pricingType":{"type":["string","null"]},"pricingCategory":{"type":["string","null"]},"volume":{"type":["integer","null"]},"cost":{"type":["number","null"]}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/account-events":{"get":{"tags":["WhatsApp"],"summary":"Meta-originated events of the number (template reviews, quality, account updates and alerts), newest first","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"Max events"}],"responses":{"200":{"description":"{events}","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"accountId":{"type":"string"},"type":{"type":"string"},"severity":{"type":"string","enum":["info","success","warning","critical"]},"title":{"type":"string"},"detail":{"type":["string","null"]},"createdAt":{"type":"string"}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/number-info":{"get":{"tags":["WhatsApp"],"summary":"Live snapshot of the number from Meta","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{phone, waba, account}","content":{"application/json":{"schema":{"type":"object","properties":{"phone":{"type":"object"},"waba":{"type":["object","null"]},"account":{"$ref":"#/components/schemas/WhatsAppAccount"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/templates":{"get":{"tags":["WhatsApp"],"summary":"Templates (exact name and language filters)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"name","in":"query","required":false,"schema":{"type":"string"},"description":"Exact name"},{"name":"language","in":"query","required":false,"schema":{"type":"string"},"description":"Exact language"},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"Status"}],"responses":{"200":{"description":"{success, templates}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"templates":{"type":"array","items":{"$ref":"#/components/schemas/ZTemplate"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"post":{"tags":["WhatsApp"],"summary":"Create a custom template (components) or one from Meta's library (library_template_name, pre-approved)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"name":{"type":"string"},"category":{"type":"string","enum":["AUTHENTICATION","MARKETING","UTILITY"]},"language":{"type":"string"},"parameter_format":{"type":"string"},"components":{"type":"array","items":{"type":"object"}},"library_template_name":{"type":"string"},"library_template_body_inputs":{"type":"object"},"library_template_button_inputs":{"type":"array","items":{"type":"object"}},"message_send_ttl_seconds":{"type":"integer"}},"required":["accountId","name","category","language"]}}}},"responses":{"200":{"description":"{success, template}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"template":{"$ref":"#/components/schemas/ZTemplate"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/templates/{templateName}":{"parameters":[{"name":"templateName","in":"path","required":true,"schema":{"type":"string"},"description":"Template name (the family)"}],"get":{"tags":["WhatsApp"],"summary":"One variant by name (language required when the family has several)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"language","in":"query","required":false,"schema":{"type":"string"},"description":"Variant"}],"responses":{"200":{"description":"{success, template}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"template":{"$ref":"#/components/schemas/ZTemplate"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"patch":{"tags":["WhatsApp"],"summary":"Edit a variant's components and/or message_send_ttl_seconds","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"language":{"type":"string"},"components":{"type":"array","items":{"type":"object"}},"message_send_ttl_seconds":{"type":"integer"}},"required":["accountId"]}}}},"responses":{"200":{"description":"{success, template}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"template":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"language":{"type":"string"},"status":{"type":"string"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["WhatsApp"],"summary":"Delete the family, or one language","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"language","in":"query","required":false,"schema":{"type":"string"},"description":"Only this variant"}],"responses":{"200":{"description":"{success, scope, language?, message}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"scope":{"type":"string","enum":["all_languages","language"]},"language":{"type":"string"},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/templates/id/{templateId}":{"parameters":[{"name":"templateId","in":"path","required":true,"schema":{"type":"string"},"description":"Meta template id"}],"get":{"tags":["WhatsApp"],"summary":"One variant by id","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{success, template}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"template":{"$ref":"#/components/schemas/ZTemplate"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"patch":{"tags":["WhatsApp"],"summary":"Edit a variant by id","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","description":"WhatsApp account id"},"components":{"type":"array","items":{"type":"object"}},"message_send_ttl_seconds":{"type":"integer"}},"required":["accountId"]}}}},"responses":{"200":{"description":"{success, template}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"template":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"language":{"type":"string"},"status":{"type":"string"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}},"delete":{"tags":["WhatsApp"],"summary":"Delete one variant by id","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"{success, scope, language, message}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"scope":{"type":"string"},"language":{"type":["string","null"]},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/template-library":{"get":{"tags":["WhatsApp"],"summary":"A pre-approved Template Library template by exact name (null when none)","parameters":[{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"},{"name":"name","in":"query","required":true,"schema":{"type":"string"},"description":"Exact name"},{"name":"language","in":"query","required":false,"schema":{"type":"string"},"description":"Language"}],"responses":{"200":{"description":"{template}","content":{"application/json":{"schema":{"type":"object","properties":{"template":{"type":["object","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/media/{mediaId}":{"get":{"tags":["WhatsApp"],"summary":"Stream an attachment of the account","parameters":[{"name":"mediaId","in":"path","required":true,"schema":{"type":"string"},"description":"WhatsApp media id"},{"name":"accountId","in":"query","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"responses":{"200":{"description":"The media bytes","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/sandbox/sessions":{"get":{"tags":["WhatsApp"],"summary":"Non-expired sandbox sessions of the organization","responses":{"200":{"description":"{sessions, sandboxNumber}","content":{"application/json":{"schema":{"type":"object","properties":{"sessions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"phoneE164":{"type":"string"},"status":{"type":"string","enum":["pending","active"]},"expiresAt":{"type":"string"},"activatedAt":{"type":["string","null"]},"createdAt":{"type":"string"}}}},"sandboxNumber":{"type":["string","null"]}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["WhatsApp"],"summary":"Create (or refresh) a pending sandbox session: the activation template is sent from the sandbox number; active once the phone replies","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"phone":{"type":"string"}},"required":["phone"]}}}},"responses":{"200":{"description":"{session, sandboxNumber}","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"type":"object"},"sandboxNumber":{"type":["string","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/whatsapp/sandbox/sessions/{sessionId}":{"delete":{"tags":["WhatsApp"],"summary":"Revoke a sandbox session","parameters":[{"name":"sessionId","in":"path","required":true,"schema":{"type":"string"},"description":"Session id"}],"responses":{"200":{"description":"{success}","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/accounts/{id}/whatsapp/register":{"post":{"tags":["WhatsApp"],"summary":"Re-run Cloud API registration (pin: the 6-digit two-step PIN)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"pin":{"type":"string"}}}}}},"responses":{"200":{"description":"{registered, accountId, phoneNumberId}","content":{"application/json":{"schema":{"type":"object","properties":{"registered":{"type":"boolean"},"accountId":{"type":"string"},"phoneNumberId":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/whatsapp/request-code":{"post":{"tags":["WhatsApp"],"summary":"Ask Meta for the verification code (bring-your-own number)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"method":{"type":"string","enum":["SMS","VOICE"]},"language":{"type":"string"}}}}}},"responses":{"200":{"description":"{requested, alreadyActive, method, accountId, phoneNumberId}","content":{"application/json":{"schema":{"type":"object","properties":{"requested":{"type":"boolean"},"alreadyActive":{"type":"boolean"},"method":{"type":"string"},"accountId":{"type":"string"},"phoneNumberId":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}},"/accounts/{id}/whatsapp/verify-code":{"post":{"tags":["WhatsApp"],"summary":"Submit the code Meta sent","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"WhatsApp account id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"}},"required":["code"]}}}},"responses":{"200":{"description":"{verified, accountId, phoneNumberId}","content":{"application/json":{"schema":{"type":"object","properties":{"verified":{"type":"boolean"},"accountId":{"type":"string"},"phoneNumberId":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/PlatformError"}}}}},"webhooks":{"post.published":{"post":{"summary":"A post finished publishing","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"post.published"},"data":{"type":"object","properties":{"postId":{"type":"string"},"status":{"type":"string","enum":["published"]}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"post.failed":{"post":{"summary":"A post failed on at least one platform","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"post.failed"},"data":{"type":"object","properties":{"postId":{"type":"string"},"status":{"type":"string","enum":["failed","partial"]}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"post.pending_approval":{"post":{"summary":"A post waits for human approval","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"post.pending_approval"},"data":{"type":"object","properties":{"postId":{"type":"string"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"post.approved":{"post":{"summary":"A post was approved in the dashboard","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"post.approved"},"data":{"type":"object","properties":{"postId":{"type":"string"},"status":{"type":"string","enum":["approved","scheduled"]}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"post.rejected":{"post":{"summary":"A post was rejected in the dashboard","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"post.rejected"},"data":{"type":"object","properties":{"postId":{"type":"string"},"status":{"type":"string","enum":["rejected"]}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"action.pending_approval":{"post":{"summary":"An agent action (reply, moderation, DM, published-post change, X engagement) was queued for approval","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"action.pending_approval"},"data":{"type":"object","properties":{"actionId":{"type":"string"},"action":{"$ref":"#/components/schemas/PendingAction"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"action.approved":{"post":{"summary":"A member approved a queued action (it runs right away: action.executed or action.failed follows)","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"action.approved"},"data":{"type":"object","properties":{"actionId":{"type":"string"},"action":{"$ref":"#/components/schemas/PendingAction"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"action.rejected":{"post":{"summary":"A member rejected a queued action (review.rejectReason may say why); nothing was sent","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"action.rejected"},"data":{"type":"object","properties":{"actionId":{"type":"string"},"action":{"$ref":"#/components/schemas/PendingAction"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"action.executed":{"post":{"summary":"An approved action ran: action.result is the operation's response; action.text is what was sent (edited is true if a member changed it)","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"action.executed"},"data":{"type":"object","properties":{"actionId":{"type":"string"},"action":{"$ref":"#/components/schemas/PendingAction"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"action.failed":{"post":{"summary":"An approved action failed when it ran (action.error: message and code, e.g. outside_messaging_window, credential_revoked)","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"action.failed"},"data":{"type":"object","properties":{"actionId":{"type":"string"},"action":{"$ref":"#/components/schemas/PendingAction"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"comment.received":{"post":{"summary":"A new comment or reply on an Instagram, Facebook or Threads account (inbound Meta webhook), or a reply to a Bluesky account's post (inbox poll; comment.cid is set)","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"comment.received"},"data":{"type":"object","properties":{"eventId":{"type":"string","description":"Inbound event id"},"platform":{"type":"string"},"accountId":{"type":"string"},"externalId":{"type":["string","null"]},"postId":{"type":["string","null"],"description":"Postgale post, when the comment is on one"},"platformPostId":{"type":["string","null"]},"comment":{"type":["object","null"],"properties":{"id":{"type":"string"},"text":{"type":["string","null"]},"username":{"type":["string","null"]},"parentId":{"type":["string","null"]}}},"receivedAt":{"type":"string","format":"date-time"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"mention.received":{"post":{"summary":"The account was mentioned (Threads, Facebook mention field, Instagram mentions field where offered; with Instagram Login a comment @mentioning the account on media it is not known to own; Bluesky @mentions from the inbox poll)","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"mention.received"},"data":{"type":"object","properties":{"eventId":{"type":"string","description":"Inbound event id"},"platform":{"type":"string"},"accountId":{"type":"string"},"externalId":{"type":["string","null"]},"postId":{"type":["string","null"],"description":"Postgale post, when the comment is on one"},"platformPostId":{"type":["string","null"]},"comment":{"type":["object","null"],"properties":{"id":{"type":"string"},"text":{"type":["string","null"]},"username":{"type":["string","null"]},"parentId":{"type":["string","null"]}}},"receivedAt":{"type":"string","format":"date-time"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"message.received":{"post":{"summary":"A direct message (or postback) from a person to an Instagram, Facebook Page, WhatsApp or Bluesky account (Bluesky: inbox poll). WhatsApp group messages belong to the group's conversation (participant id group:<groupId>; metadata.groupId and metadata.sender); Messenger standby messages (another app owns the thread) carry metadata.standby true","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"message.received"},"data":{"type":"object","properties":{"eventId":{"type":["string","null"],"description":"Inbound event id; null for messages sent through Postgale"},"platform":{"type":"string","enum":["instagram","facebook","whatsapp","x","telegram"]},"accountId":{"type":"string"},"externalId":{"type":["string","null"]},"conversationId":{"type":"string","description":"Postgale conversation id"},"messageId":{"type":["string","null"],"description":"Postgale message id, when known"},"platformMessageId":{"type":["string","null"],"description":"Meta mid"},"platformMessageIds":{"type":"array","items":{"type":"string"},"description":"Every mid concerned (deliveries may list several)"},"direction":{"type":"string","enum":["inbound","outbound"]},"participant":{"type":"object","properties":{"id":{"type":"string","description":"IGSID or PSID"},"username":{"type":["string","null"]},"name":{"type":["string","null"]}}},"text":{"type":["string","null"]},"attachments":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"url":{"type":"string"}}}},"postback":{"type":["object","null"],"properties":{"title":{"type":"string"},"payload":{"type":"string"}}},"reaction":{"type":["object","null"],"properties":{"action":{"type":"string","enum":["react","unreact"]},"emoji":{"type":["string","null"]}}},"watermark":{"type":["string","null"],"format":"date-time","description":"read / delivered: up to this time"},"sentAt":{"type":"string","format":"date-time"},"receivedAt":{"type":"string","format":"date-time"},"type":{"type":"string","description":"WhatsApp only: message type (text, image, template, interactive, button, reaction, location, ...)"},"content":{"description":"WhatsApp only: the type-specific object"},"contact":{"type":"object","properties":{"phone":{"type":["string","null"]},"userId":{"type":["string","null"]},"parentUserId":{"type":["string","null"]},"name":{"type":["string","null"]},"username":{"type":["string","null"]}},"description":"WhatsApp only: the person"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"message.sent":{"post":{"summary":"A message sent by the account: through Postgale, or elsewhere (Meta echo, e.g. from the Instagram app or, with WhatsApp coexistence, the WhatsApp Business app)","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"message.sent"},"data":{"type":"object","properties":{"eventId":{"type":["string","null"],"description":"Inbound event id; null for messages sent through Postgale"},"platform":{"type":"string","enum":["instagram","facebook","whatsapp","x","telegram"]},"accountId":{"type":"string"},"externalId":{"type":["string","null"]},"conversationId":{"type":"string","description":"Postgale conversation id"},"messageId":{"type":["string","null"],"description":"Postgale message id, when known"},"platformMessageId":{"type":["string","null"],"description":"Meta mid"},"platformMessageIds":{"type":"array","items":{"type":"string"},"description":"Every mid concerned (deliveries may list several)"},"direction":{"type":"string","enum":["inbound","outbound"]},"participant":{"type":"object","properties":{"id":{"type":"string","description":"IGSID or PSID"},"username":{"type":["string","null"]},"name":{"type":["string","null"]}}},"text":{"type":["string","null"]},"attachments":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"url":{"type":"string"}}}},"postback":{"type":["object","null"],"properties":{"title":{"type":"string"},"payload":{"type":"string"}}},"reaction":{"type":["object","null"],"properties":{"action":{"type":"string","enum":["react","unreact"]},"emoji":{"type":["string","null"]}}},"watermark":{"type":["string","null"],"format":"date-time","description":"read / delivered: up to this time"},"sentAt":{"type":"string","format":"date-time"},"receivedAt":{"type":"string","format":"date-time"},"type":{"type":"string","description":"WhatsApp only: message type (text, image, template, interactive, button, reaction, location, ...)"},"content":{"description":"WhatsApp only: the type-specific object"},"contact":{"type":"object","properties":{"phone":{"type":["string","null"]},"userId":{"type":["string","null"]},"parentUserId":{"type":["string","null"]},"name":{"type":["string","null"]},"username":{"type":["string","null"]}},"description":"WhatsApp only: the person"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"message.read":{"post":{"summary":"The person read the account's messages (up to watermark / platformMessageId)","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"message.read"},"data":{"type":"object","properties":{"eventId":{"type":["string","null"],"description":"Inbound event id; null for messages sent through Postgale"},"platform":{"type":"string","enum":["instagram","facebook","whatsapp","x","telegram"]},"accountId":{"type":"string"},"externalId":{"type":["string","null"]},"conversationId":{"type":"string","description":"Postgale conversation id"},"messageId":{"type":["string","null"],"description":"Postgale message id, when known"},"platformMessageId":{"type":["string","null"],"description":"Meta mid"},"platformMessageIds":{"type":"array","items":{"type":"string"},"description":"Every mid concerned (deliveries may list several)"},"direction":{"type":"string","enum":["inbound","outbound"]},"participant":{"type":"object","properties":{"id":{"type":"string","description":"IGSID or PSID"},"username":{"type":["string","null"]},"name":{"type":["string","null"]}}},"text":{"type":["string","null"]},"attachments":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"url":{"type":"string"}}}},"postback":{"type":["object","null"],"properties":{"title":{"type":"string"},"payload":{"type":"string"}}},"reaction":{"type":["object","null"],"properties":{"action":{"type":"string","enum":["react","unreact"]},"emoji":{"type":["string","null"]}}},"watermark":{"type":["string","null"],"format":"date-time","description":"read / delivered: up to this time"},"sentAt":{"type":"string","format":"date-time"},"receivedAt":{"type":"string","format":"date-time"},"type":{"type":"string","description":"WhatsApp only: message type (text, image, template, interactive, button, reaction, location, ...)"},"content":{"description":"WhatsApp only: the type-specific object"},"contact":{"type":"object","properties":{"phone":{"type":["string","null"]},"userId":{"type":["string","null"]},"parentUserId":{"type":["string","null"]},"name":{"type":["string","null"]},"username":{"type":["string","null"]}},"description":"WhatsApp only: the person"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"message.delivered":{"post":{"summary":"Messenger delivered the account's messages (platformMessageIds and/or watermark)","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"message.delivered"},"data":{"type":"object","properties":{"eventId":{"type":["string","null"],"description":"Inbound event id; null for messages sent through Postgale"},"platform":{"type":"string","enum":["instagram","facebook","whatsapp","x","telegram"]},"accountId":{"type":"string"},"externalId":{"type":["string","null"]},"conversationId":{"type":"string","description":"Postgale conversation id"},"messageId":{"type":["string","null"],"description":"Postgale message id, when known"},"platformMessageId":{"type":["string","null"],"description":"Meta mid"},"platformMessageIds":{"type":"array","items":{"type":"string"},"description":"Every mid concerned (deliveries may list several)"},"direction":{"type":"string","enum":["inbound","outbound"]},"participant":{"type":"object","properties":{"id":{"type":"string","description":"IGSID or PSID"},"username":{"type":["string","null"]},"name":{"type":["string","null"]}}},"text":{"type":["string","null"]},"attachments":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"url":{"type":"string"}}}},"postback":{"type":["object","null"],"properties":{"title":{"type":"string"},"payload":{"type":"string"}}},"reaction":{"type":["object","null"],"properties":{"action":{"type":"string","enum":["react","unreact"]},"emoji":{"type":["string","null"]}}},"watermark":{"type":["string","null"],"format":"date-time","description":"read / delivered: up to this time"},"sentAt":{"type":"string","format":"date-time"},"receivedAt":{"type":"string","format":"date-time"},"type":{"type":"string","description":"WhatsApp only: message type (text, image, template, interactive, button, reaction, location, ...)"},"content":{"description":"WhatsApp only: the type-specific object"},"contact":{"type":"object","properties":{"phone":{"type":["string","null"]},"userId":{"type":["string","null"]},"parentUserId":{"type":["string","null"]},"name":{"type":["string","null"]},"username":{"type":["string","null"]}},"description":"WhatsApp only: the person"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"message.reaction":{"post":{"summary":"A reaction was added or removed on a message (reaction.action react | unreact)","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"message.reaction"},"data":{"type":"object","properties":{"eventId":{"type":["string","null"],"description":"Inbound event id; null for messages sent through Postgale"},"platform":{"type":"string","enum":["instagram","facebook","whatsapp","x","telegram"]},"accountId":{"type":"string"},"externalId":{"type":["string","null"]},"conversationId":{"type":"string","description":"Postgale conversation id"},"messageId":{"type":["string","null"],"description":"Postgale message id, when known"},"platformMessageId":{"type":["string","null"],"description":"Meta mid"},"platformMessageIds":{"type":"array","items":{"type":"string"},"description":"Every mid concerned (deliveries may list several)"},"direction":{"type":"string","enum":["inbound","outbound"]},"participant":{"type":"object","properties":{"id":{"type":"string","description":"IGSID or PSID"},"username":{"type":["string","null"]},"name":{"type":["string","null"]}}},"text":{"type":["string","null"]},"attachments":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"url":{"type":"string"}}}},"postback":{"type":["object","null"],"properties":{"title":{"type":"string"},"payload":{"type":"string"}}},"reaction":{"type":["object","null"],"properties":{"action":{"type":"string","enum":["react","unreact"]},"emoji":{"type":["string","null"]}}},"watermark":{"type":["string","null"],"format":"date-time","description":"read / delivered: up to this time"},"sentAt":{"type":"string","format":"date-time"},"receivedAt":{"type":"string","format":"date-time"},"type":{"type":"string","description":"WhatsApp only: message type (text, image, template, interactive, button, reaction, location, ...)"},"content":{"description":"WhatsApp only: the type-specific object"},"contact":{"type":"object","properties":{"phone":{"type":["string","null"]},"userId":{"type":["string","null"]},"parentUserId":{"type":["string","null"]},"name":{"type":["string","null"]},"username":{"type":["string","null"]}},"description":"WhatsApp only: the person"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"message.status":{"post":{"summary":"WhatsApp: status of a message sent by the account (sent, delivered, read, failed with errors; pricing)","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"message.status"},"data":{"type":"object","properties":{"eventId":{"type":"string","description":"Inbound event id"},"platform":{"type":"string","enum":["whatsapp"]},"accountId":{"type":"string"},"externalId":{"type":["string","null"]},"receivedAt":{"type":"string","format":"date-time"},"conversationId":{"type":["string","null"]},"messageId":{"type":["string","null"],"description":"Postgale message id, when known"},"platformMessageId":{"type":["string","null"],"description":"wamid"},"status":{"type":"string","enum":["sent","delivered","read","failed","deleted"]},"errors":{"type":"array","items":{"type":"object"},"description":"failed: Meta errors [{code, title, message, error_data}]"},"pricing":{"type":["object","null"],"description":"{billable, pricing_model, category, type}"},"conversation":{"type":["object","null"],"description":"Meta conversation {id, origin, expiration_timestamp}"},"recipient":{"type":"object","properties":{"phone":{"type":["string","null"]},"userId":{"type":["string","null"]}}},"timestamp":{"type":"string","format":"date-time"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"message.edited":{"post":{"summary":"A message was edited (by the person or the account), where the platform reports edits","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"message.edited"},"data":{"type":"object","properties":{"eventId":{"type":["string","null"],"description":"Inbound event id; null for messages sent through Postgale"},"platform":{"type":"string","enum":["instagram","facebook","whatsapp","x","telegram"]},"accountId":{"type":"string"},"externalId":{"type":["string","null"]},"conversationId":{"type":"string","description":"Postgale conversation id"},"messageId":{"type":["string","null"],"description":"Postgale message id, when known"},"platformMessageId":{"type":["string","null"],"description":"Meta mid"},"platformMessageIds":{"type":"array","items":{"type":"string"},"description":"Every mid concerned (deliveries may list several)"},"direction":{"type":"string","enum":["inbound","outbound"]},"participant":{"type":"object","properties":{"id":{"type":"string","description":"IGSID or PSID"},"username":{"type":["string","null"]},"name":{"type":["string","null"]}}},"text":{"type":["string","null"]},"attachments":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"url":{"type":"string"}}}},"postback":{"type":["object","null"],"properties":{"title":{"type":"string"},"payload":{"type":"string"}}},"reaction":{"type":["object","null"],"properties":{"action":{"type":"string","enum":["react","unreact"]},"emoji":{"type":["string","null"]}}},"watermark":{"type":["string","null"],"format":"date-time","description":"read / delivered: up to this time"},"sentAt":{"type":"string","format":"date-time"},"receivedAt":{"type":"string","format":"date-time"},"type":{"type":"string","description":"WhatsApp only: message type (text, image, template, interactive, button, reaction, location, ...)"},"content":{"description":"WhatsApp only: the type-specific object"},"contact":{"type":"object","properties":{"phone":{"type":["string","null"]},"userId":{"type":["string","null"]},"parentUserId":{"type":["string","null"]},"name":{"type":["string","null"]},"username":{"type":["string","null"]}},"description":"WhatsApp only: the person"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"message.deleted":{"post":{"summary":"A message was deleted (unsent), where the platform reports deletions","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"message.deleted"},"data":{"type":"object","properties":{"eventId":{"type":["string","null"],"description":"Inbound event id; null for messages sent through Postgale"},"platform":{"type":"string","enum":["instagram","facebook","whatsapp","x","telegram"]},"accountId":{"type":"string"},"externalId":{"type":["string","null"]},"conversationId":{"type":"string","description":"Postgale conversation id"},"messageId":{"type":["string","null"],"description":"Postgale message id, when known"},"platformMessageId":{"type":["string","null"],"description":"Meta mid"},"platformMessageIds":{"type":"array","items":{"type":"string"},"description":"Every mid concerned (deliveries may list several)"},"direction":{"type":"string","enum":["inbound","outbound"]},"participant":{"type":"object","properties":{"id":{"type":"string","description":"IGSID or PSID"},"username":{"type":["string","null"]},"name":{"type":["string","null"]}}},"text":{"type":["string","null"]},"attachments":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"url":{"type":"string"}}}},"postback":{"type":["object","null"],"properties":{"title":{"type":"string"},"payload":{"type":"string"}}},"reaction":{"type":["object","null"],"properties":{"action":{"type":"string","enum":["react","unreact"]},"emoji":{"type":["string","null"]}}},"watermark":{"type":["string","null"],"format":"date-time","description":"read / delivered: up to this time"},"sentAt":{"type":"string","format":"date-time"},"receivedAt":{"type":"string","format":"date-time"},"type":{"type":"string","description":"WhatsApp only: message type (text, image, template, interactive, button, reaction, location, ...)"},"content":{"description":"WhatsApp only: the type-specific object"},"contact":{"type":"object","properties":{"phone":{"type":["string","null"]},"userId":{"type":["string","null"]},"parentUserId":{"type":["string","null"]},"name":{"type":["string","null"]},"username":{"type":["string","null"]}},"description":"WhatsApp only: the person"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"message.failed":{"post":{"summary":"A message the account sent could not be delivered (error in the payload)","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"message.failed"},"data":{"type":"object","properties":{"eventId":{"type":["string","null"],"description":"Inbound event id; null for messages sent through Postgale"},"platform":{"type":"string","enum":["instagram","facebook","whatsapp","x","telegram"]},"accountId":{"type":"string"},"externalId":{"type":["string","null"]},"conversationId":{"type":"string","description":"Postgale conversation id"},"messageId":{"type":["string","null"],"description":"Postgale message id, when known"},"platformMessageId":{"type":["string","null"],"description":"Meta mid"},"platformMessageIds":{"type":"array","items":{"type":"string"},"description":"Every mid concerned (deliveries may list several)"},"direction":{"type":"string","enum":["inbound","outbound"]},"participant":{"type":"object","properties":{"id":{"type":"string","description":"IGSID or PSID"},"username":{"type":["string","null"]},"name":{"type":["string","null"]}}},"text":{"type":["string","null"]},"attachments":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"url":{"type":"string"}}}},"postback":{"type":["object","null"],"properties":{"title":{"type":"string"},"payload":{"type":"string"}}},"reaction":{"type":["object","null"],"properties":{"action":{"type":"string","enum":["react","unreact"]},"emoji":{"type":["string","null"]}}},"watermark":{"type":["string","null"],"format":"date-time","description":"read / delivered: up to this time"},"sentAt":{"type":"string","format":"date-time"},"receivedAt":{"type":"string","format":"date-time"},"type":{"type":"string","description":"WhatsApp only: message type (text, image, template, interactive, button, reaction, location, ...)"},"content":{"description":"WhatsApp only: the type-specific object"},"contact":{"type":"object","properties":{"phone":{"type":["string","null"]},"userId":{"type":["string","null"]},"parentUserId":{"type":["string","null"]},"name":{"type":["string","null"]},"username":{"type":["string","null"]}},"description":"WhatsApp only: the person"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"reaction.received":{"post":{"summary":"A person reacted to a message or post of the account (Zernio's name; message.reaction also fires for messages)","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"reaction.received"},"data":{"type":"object","properties":{"eventId":{"type":["string","null"],"description":"Inbound event id; null for messages sent through Postgale"},"platform":{"type":"string","enum":["instagram","facebook","whatsapp","x","telegram"]},"accountId":{"type":"string"},"externalId":{"type":["string","null"]},"conversationId":{"type":"string","description":"Postgale conversation id"},"messageId":{"type":["string","null"],"description":"Postgale message id, when known"},"platformMessageId":{"type":["string","null"],"description":"Meta mid"},"platformMessageIds":{"type":"array","items":{"type":"string"},"description":"Every mid concerned (deliveries may list several)"},"direction":{"type":"string","enum":["inbound","outbound"]},"participant":{"type":"object","properties":{"id":{"type":"string","description":"IGSID or PSID"},"username":{"type":["string","null"]},"name":{"type":["string","null"]}}},"text":{"type":["string","null"]},"attachments":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"url":{"type":"string"}}}},"postback":{"type":["object","null"],"properties":{"title":{"type":"string"},"payload":{"type":"string"}}},"reaction":{"type":["object","null"],"properties":{"action":{"type":"string","enum":["react","unreact"]},"emoji":{"type":["string","null"]}}},"watermark":{"type":["string","null"],"format":"date-time","description":"read / delivered: up to this time"},"sentAt":{"type":"string","format":"date-time"},"receivedAt":{"type":"string","format":"date-time"},"type":{"type":"string","description":"WhatsApp only: message type (text, image, template, interactive, button, reaction, location, ...)"},"content":{"description":"WhatsApp only: the type-specific object"},"contact":{"type":"object","properties":{"phone":{"type":["string","null"]},"userId":{"type":["string","null"]},"parentUserId":{"type":["string","null"]},"name":{"type":["string","null"]},"username":{"type":["string","null"]}},"description":"WhatsApp only: the person"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"template.status":{"post":{"summary":"WhatsApp: a template was approved, rejected, paused, disabled... (one per organization with an account on the WABA)","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"template.status"},"data":{"type":"object","properties":{"eventId":{"type":"string","description":"Inbound event id"},"platform":{"type":"string","enum":["whatsapp"]},"accountId":{"type":"string"},"externalId":{"type":["string","null"]},"receivedAt":{"type":"string","format":"date-time"},"wabaId":{"type":["string","null"]},"kind":{"type":"string","enum":["status","quality","category"]},"templateId":{"type":["string","null"]},"name":{"type":["string","null"]},"language":{"type":["string","null"]},"event":{"type":["string","null"],"description":"status: APPROVED, REJECTED, PENDING, PAUSED, DISABLED, ..."},"reason":{"type":["string","null"]},"otherInfo":{"description":"status only"},"previousQualityScore":{"type":["string","null"]},"newQualityScore":{"type":["string","null"]},"previousCategory":{"type":["string","null"]},"newCategory":{"type":["string","null"]},"correctCategory":{"type":["string","null"]}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"template.quality":{"post":{"summary":"WhatsApp: a template's quality score or category changed (kind quality | category)","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"template.quality"},"data":{"type":"object","properties":{"eventId":{"type":"string","description":"Inbound event id"},"platform":{"type":"string","enum":["whatsapp"]},"accountId":{"type":"string"},"externalId":{"type":["string","null"]},"receivedAt":{"type":"string","format":"date-time"},"wabaId":{"type":["string","null"]},"kind":{"type":"string","enum":["status","quality","category"]},"templateId":{"type":["string","null"]},"name":{"type":["string","null"]},"language":{"type":["string","null"]},"event":{"type":["string","null"],"description":"status: APPROVED, REJECTED, PENDING, PAUSED, DISABLED, ..."},"reason":{"type":["string","null"]},"otherInfo":{"description":"status only"},"previousQualityScore":{"type":["string","null"]},"newQualityScore":{"type":["string","null"]},"previousCategory":{"type":["string","null"]},"newCategory":{"type":["string","null"]},"correctCategory":{"type":["string","null"]}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"account.quality":{"post":{"summary":"WhatsApp: the number's quality rating or messaging limit changed (stored on the account)","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"account.quality"},"data":{"type":"object","properties":{"eventId":{"type":"string","description":"Inbound event id"},"platform":{"type":"string","enum":["whatsapp"]},"accountId":{"type":"string"},"externalId":{"type":["string","null"]},"receivedAt":{"type":"string","format":"date-time"},"wabaId":{"type":["string","null"]},"displayPhoneNumber":{"type":["string","null"]},"event":{"type":["string","null"],"description":"e.g. FLAGGED, UNFLAGGED, UPGRADE, DOWNGRADE"},"currentLimit":{"type":["string","null"]},"oldLimit":{"type":["string","null"]},"qualityRating":{"type":["string","null"]},"maxDailyConversations":{}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"account.connected":{"post":{"summary":"An account was connected or reconnected","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"account.connected"},"data":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string"},"accountName":{"type":"string"},"externalId":{"type":["string","null"]}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"account.disconnected":{"post":{"summary":"The platform rejected the account token (status needs_reconnect)","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"account.disconnected"},"data":{"type":"object","properties":{"accountId":{"type":"string"},"platform":{"type":"string"},"accountName":{"type":"string"},"externalId":{"type":["string","null"]},"reason":{"type":"string"},"error":{"type":"string"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"connection.pending":{"post":{"summary":"OAuth finished with a choice to make (e.g. several Facebook Pages): pick within 30 minutes via GET /connect/pending/{pendingId} and POST /connect/pending/{pendingId}/select","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"connection.pending"},"data":{"type":"object","properties":{"pendingId":{"type":"string"},"platform":{"type":"string"},"externalId":{"type":["string","null"]},"optionCount":{"type":"integer"},"expiresAt":{"type":"string","format":"date-time"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"phone_number.provisioned":{"post":{"summary":"A number bought by Postgale is verified, registered and connected (account: the new WhatsApp account)","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"phone_number.provisioned"},"data":{"type":"object","properties":{"numberId":{"type":"string","description":"Provisioned number id"},"phoneNumber":{"type":"string","description":"E.164"},"provider":{"type":"string"},"accountId":{"type":["string","null"]},"wabaId":{"type":["string","null"]},"phoneNumberId":{"type":["string","null"]},"status":{"type":"string"},"verifiedName":{"type":"string"},"account":{"type":"object"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"phone_number.release_scheduled":{"post":{"summary":"A bought number had no production message for WHATSAPP_NUMBERS_IDLE_DAYS - 3 days: it is released at releaseAt unless a message is sent or received","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"phone_number.release_scheduled"},"data":{"type":"object","properties":{"numberId":{"type":"string","description":"Provisioned number id"},"phoneNumber":{"type":"string","description":"E.164"},"provider":{"type":"string"},"accountId":{"type":["string","null"]},"wabaId":{"type":["string","null"]},"phoneNumberId":{"type":["string","null"]},"status":{"type":"string"},"reason":{"type":"string","enum":["idle"]},"idleDays":{"type":"integer"},"lastProductionMessageAt":{"type":["string","null"],"format":"date-time"},"releaseAt":{"type":"string","format":"date-time"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"phone_number.released":{"post":{"summary":"A bought number was released (manual, idle) and returned to the carrier","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"phone_number.released"},"data":{"type":"object","properties":{"numberId":{"type":"string","description":"Provisioned number id"},"phoneNumber":{"type":"string","description":"E.164"},"provider":{"type":"string"},"accountId":{"type":["string","null"]},"wabaId":{"type":["string","null"]},"phoneNumberId":{"type":["string","null"]},"status":{"type":"string"},"reason":{"type":"string"},"releasedAt":{"type":"string","format":"date-time"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"phone_number.failed":{"post":{"summary":"Provisioning a bought number failed at a step (retry with POST /whatsapp/numbers/{id}/retry)","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"phone_number.failed"},"data":{"type":"object","properties":{"numberId":{"type":"string","description":"Provisioned number id"},"phoneNumber":{"type":"string","description":"E.164"},"provider":{"type":"string"},"accountId":{"type":["string","null"]},"wabaId":{"type":["string","null"]},"phoneNumberId":{"type":["string","null"]},"status":{"type":"string"},"step":{"type":"string","description":"purchase_refused (nothing bought), purchase_failed (outcome unknown: the number stays held until released), add_failed, request_code_failed, verify_failed, register_failed, connect_failed, otp_timeout"},"error":{"type":"string"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}},"webhook.test":{"post":{"summary":"Sent only by POST /webhooks/{id}/test","parameters":[{"name":"X-SocialAPI-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-SocialAPI-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"webhook.test"},"data":{"type":"object","properties":{"webhookId":{"type":"string"},"test":{"type":"boolean"},"message":{"type":"string"},"sentAt":{"type":"string"}}}}}]}}}},"responses":{"2XX":{"description":"Acknowledged; anything else is retried (6 attempts, exponential backoff)"}}}}}}