{"openapi":"3.1.0","info":{"title":"AgentChat REST API","version":"1.0.0","description":"Instagram comment and DM automations for one connected Instagram account. The same functions as the MCP server, except check_follower, subscribe_webhooks, refresh_token and billing_status (MCP only). Authenticate with the API key from your dashboard (section API key) as header Authorization: Bearer <key>. Guide: /docs#api-key. Every request only sees the data of that account. Field names in responses match the MCP tool output."},"servers":[{"url":"https://agentchat.georgkinzel.de/api/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key from the dashboard (section API key)"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]},"AutomationInput":{"type":"object","additionalProperties":false,"properties":{"name":{"type":"string","description":"Internal name, e.g. 'Reel 16.10. VAULT'"},"active":{"type":"boolean","description":"Active (default true)"},"trigger":{"type":"string","enum":["comment","dm","story_reply"],"description":"comment = comment under a post/reel, dm = direct message, story_reply = reply to a story"},"media_ids":{"type":["array","null"],"items":{"type":"string"},"description":"comment only: IDs of the posts/reels (from list_posts). Empty/null = all posts"},"next_post":{"type":"boolean","description":"comment only: wait for the next new post/reel and attach to it automatically (at most 2 minutes after posting). Ideal when the reel is not online yet"},"keywords":{"type":"array","items":{"type":"string"},"description":"Trigger words, case-insensitive"},"match_mode":{"type":"string","enum":["word","contains","exact","any"],"description":"word (default): word appears in the text. contains: substring anywhere. exact: whole text = word. any: every text"},"exclude_keywords":{"type":"array","items":{"type":"string"},"description":"Do not trigger if one of these words appears"},"public_replies":{"type":"array","items":{"type":"string"},"description":"comment only: replies under the comment, one is picked at random. E.g. ['Sent you the link {username} 📩']. Empty = no public reply"},"opening_text":{"type":"string","description":"First DM with button (default: \"Hey {username}! Tap the button and I'll send you the link.\")"},"opening_button":{"type":"string","description":"Button of the first DM (default with follower check: \"Send link\"). Without follower check and without opening_button the link goes out in the first DM"},"follow_gate":{"type":"boolean","description":"Link only for followers. Non-followers get gate_text with a button to check again"},"gate_text":{"type":"string","description":"Text for non-followers (default: \"Almost there! Follow me real quick, then tap the button again and the link comes right away.\")"},"gate_button":{"type":"string","description":"Button to check again (default: \"I follow you now\")"},"link_url":{"type":"string","description":"Target link (https://...)"},"link_text":{"type":"string","description":"Text of the DM with the link (default: \"Here's your link 👇\")"},"link_button":{"type":"string","description":"Title of the link button (default: \"Open\")"},"extra_links":{"type":"array","maxItems":2,"items":{"type":"object","properties":{"title":{"type":"string"},"url":{"type":"string"}},"required":["title","url"]},"description":"Up to 2 more link buttons in the link DM"},"follow_up_text":{"type":"string","description":"Reminder for people who did not click the link, e.g. 'Did you check it out yet? 👀'. Sent once, with the link button, only inside the 24h window"},"follow_up_minutes":{"type":"integer","description":"Minutes without a click before the reminder (e.g. 120). 0 = off, max 1380"},"email_gate":{"type":"boolean","description":"Ask for the email before sending the link (default false). See the server instructions for the order with comments and follow_gate"},"email_text":{"type":"string","description":"Email question (default: \"Quick one: which email should I send it to? 📩\")"},"email_retry_text":{"type":"string","description":"Sent once if the reply contains no email; after the second miss the link goes out anyway (default: \"Hm, that didn't look like an email. Just type it in here 🙂\")"},"email_skip_if_known":{"type":"boolean","description":"Skip the email question for contacts with a stored email (default true)"},"webhook_url":{"type":["string","null"],"description":"Optional https URL that gets a POST on email_captured and link_sent. No private or local addresses. null = off"},"webhook_secret":{"type":["string","null"],"description":"Optional secret; the body is signed as header X-AgentChat-Signature: sha256=<HMAC-SHA256 hex>. Never shown again in responses"},"track_clicks":{"type":"boolean","description":"Count clicks through our own redirect (default true)"},"tags":{"type":"array","items":{"type":"string"},"description":"Tags the contact gets"},"once_per_user":{"type":"boolean","description":"Each user gets this automation only once (default true)"},"priority":{"type":"integer","description":"Higher number wins when several match (default 0)"},"notes":{"type":"string","description":"Note"},"skip_if_answered":{"type":"boolean","description":"comment only: skip the comment if your account already replied to it without AgentChat, e.g. ManyChat (default true). The run gets state skipped_other_tool"}}},"Automation":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string","description":"Internal name, e.g. 'Reel 16.10. VAULT'"},"active":{"type":"boolean","description":"Active (default true)"},"trigger":{"type":"string","enum":["comment","dm","story_reply"],"description":"comment = comment under a post/reel, dm = direct message, story_reply = reply to a story"},"media_ids":{"type":["array","null"],"items":{"type":"string"},"description":"comment only: IDs of the posts/reels (from list_posts). Empty/null = all posts"},"next_post":{"type":"boolean","description":"comment only: wait for the next new post/reel and attach to it automatically (at most 2 minutes after posting). Ideal when the reel is not online yet"},"keywords":{"type":"array","items":{"type":"string"},"description":"Trigger words, case-insensitive"},"match_mode":{"type":"string","enum":["word","contains","exact","any"],"description":"word (default): word appears in the text. contains: substring anywhere. exact: whole text = word. any: every text"},"exclude_keywords":{"type":"array","items":{"type":"string"},"description":"Do not trigger if one of these words appears"},"public_replies":{"type":"array","items":{"type":"string"},"description":"comment only: replies under the comment, one is picked at random. E.g. ['Sent you the link {username} 📩']. Empty = no public reply"},"opening_text":{"type":"string","description":"First DM with button (default: \"Hey {username}! Tap the button and I'll send you the link.\")"},"opening_button":{"type":"string","description":"Button of the first DM (default with follower check: \"Send link\"). Without follower check and without opening_button the link goes out in the first DM"},"follow_gate":{"type":"boolean","description":"Link only for followers. Non-followers get gate_text with a button to check again"},"gate_text":{"type":"string","description":"Text for non-followers (default: \"Almost there! Follow me real quick, then tap the button again and the link comes right away.\")"},"gate_button":{"type":"string","description":"Button to check again (default: \"I follow you now\")"},"link_url":{"type":"string","description":"Target link (https://...)"},"link_text":{"type":"string","description":"Text of the DM with the link (default: \"Here's your link 👇\")"},"link_button":{"type":"string","description":"Title of the link button (default: \"Open\")"},"extra_links":{"type":"array","maxItems":2,"items":{"type":"object","properties":{"title":{"type":"string"},"url":{"type":"string"}},"required":["title","url"]},"description":"Up to 2 more link buttons in the link DM"},"follow_up_text":{"type":"string","description":"Reminder for people who did not click the link, e.g. 'Did you check it out yet? 👀'. Sent once, with the link button, only inside the 24h window"},"follow_up_minutes":{"type":"integer","description":"Minutes without a click before the reminder (e.g. 120). 0 = off, max 1380"},"email_gate":{"type":"boolean","description":"Ask for the email before sending the link (default false). See the server instructions for the order with comments and follow_gate"},"email_text":{"type":"string","description":"Email question (default: \"Quick one: which email should I send it to? 📩\")"},"email_retry_text":{"type":"string","description":"Sent once if the reply contains no email; after the second miss the link goes out anyway (default: \"Hm, that didn't look like an email. Just type it in here 🙂\")"},"email_skip_if_known":{"type":"boolean","description":"Skip the email question for contacts with a stored email (default true)"},"webhook_url":{"type":["string","null"],"description":"Optional https URL that gets a POST on email_captured and link_sent. No private or local addresses. null = off"},"webhook_secret":{"type":["string","null"],"description":"Optional secret; the body is signed as header X-AgentChat-Signature: sha256=<HMAC-SHA256 hex>. Never shown again in responses"},"track_clicks":{"type":"boolean","description":"Count clicks through our own redirect (default true)"},"tags":{"type":"array","items":{"type":"string"},"description":"Tags the contact gets"},"once_per_user":{"type":"boolean","description":"Each user gets this automation only once (default true)"},"priority":{"type":"integer","description":"Higher number wins when several match (default 0)"},"notes":{"type":"string","description":"Note"},"skip_if_answered":{"type":"boolean","description":"comment only: skip the comment if your account already replied to it without AgentChat, e.g. ManyChat (default true). The run gets state skipped_other_tool"},"pending_next":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"description":"webhook_secret is always masked as ***"},"AutomationResult":{"type":"object","properties":{"automation":{"$ref":"#/components/schemas/Automation"},"preview":{"type":"object","description":"Preview of the messages"},"notes":{"type":"array","items":{"type":"string"},"description":"Hints about the configuration"}}},"AutomationSummary":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"status":{"type":"string","enum":["draft","active","paused"],"description":"draft = created but answers nothing until go_live"},"active":{"type":"boolean"},"trigger":{"type":"string"},"keywords":{"type":"array","items":{"type":"string"}},"posts":{"description":"'all', 'next post (waiting)' or a list of post IDs"},"follower_check":{"type":"boolean"},"email_gate":{"type":"boolean"},"webhook":{"type":"boolean"},"link":{"type":["string","null"]},"transition_mode":{"type":"boolean","description":"Runs without follower check, button, email and reminder until finish_migration"},"origin":{"type":["string","null"],"description":"import, auto or null (created by hand)"},"triggered":{"type":"integer","description":"Runs started"},"link_sent":{"type":"integer","description":"Runs where the link DM went out"},"clicked":{"type":"integer","description":"Runs with at least one link click"},"updated_at":{"type":"string","description":"Last change (UTC, YYYY-MM-DD HH:MM:SS)"}}},"Funnel":{"type":"object","description":"Funnel per automation","properties":{"name":{"type":"string"},"trigger":{"type":"string"},"active":{"type":["integer","boolean"]},"id":{"type":["integer","null"]},"triggered":{"type":["integer","null"]},"dm_sent":{"type":["integer","null"]},"button_tapped":{"type":["integer","null"]},"gated":{"type":["integer","null"]},"gate_passed":{"type":["integer","null"]},"email_asked":{"type":["integer","null"]},"email_captured":{"type":["integer","null"]},"email_expired":{"type":["integer","null"]},"link_sent":{"type":["integer","null"]},"clicked":{"type":["integer","null"]},"followed_up":{"type":["integer","null"]},"errors":{"type":["integer","null"]},"skipped":{"type":["integer","null"]},"skipped_other_tool":{"type":["integer","null"]}}},"Post":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"date":{"type":"string"},"caption":{"type":"string"},"link":{"type":"string"},"comments_count":{"type":"integer"},"likes":{"type":"integer"},"thumbnail":{"type":["string","null"],"description":"Preview image URL (thumbnail_url for videos, media_url for images)"},"automations":{"type":"array","items":{"type":"string"}}}},"Comment":{"type":"object","properties":{"id":{"type":"string"},"user":{"type":"string"},"user_id":{"type":"string"},"text":{"type":"string"},"timestamp":{"type":"string"},"answered":{"type":"boolean","description":"already answered by the account (reply under the comment) or by AgentChat (reply or DM)"},"answered_by":{"type":["string","null"],"enum":["agentchat","other",null],"description":"agentchat, other (another tool such as ManyChat) or null"}}},"Contact":{"type":"object","properties":{"ig_id":{"type":"string"},"username":{"type":["string","null"]},"name":{"type":["string","null"]},"follows":{"type":["integer","null"],"description":"1 follows, 0 does not, null unknown"},"tags":{"type":"array","items":{"type":"string"}},"email":{"type":["string","null"]},"notes":{"type":["string","null"]},"comment_count":{"type":"integer"},"dm_count":{"type":"integer"},"first_seen_at":{"type":"string"},"last_seen_at":{"type":"string"},"last_inbound_at":{"type":["string","null"]},"source":{"type":["string","null"],"description":"Origin, e.g. the ManyChat automation or tag link_clicked (<date>)"},"imported_from":{"type":["string","null"],"description":"manychat for imported contacts"}}},"Event":{"type":"object","properties":{"id":{"type":"integer"},"created_at":{"type":"string"},"kind":{"type":"string"},"username":{"type":["string","null"]},"automation_id":{"type":["integer","null"]},"run_id":{"type":["integer","null"]},"text":{"type":["string","null"]},"ref":{"type":["string","null"]}}},"Reel":{"type":"object","properties":{"id":{"type":"integer"},"status":{"type":"string","enum":["scheduled","uploading","processing","ready","publishing","published","failed","cancelled"]},"publish_at":{"type":"string"},"caption":{"type":"string"},"source":{"type":"object","description":"{video_id, size_mb, file_status} or {video_url}"},"trial":{"type":"boolean"},"share_to_feed":{"type":["boolean","null"]},"automation_id":{"type":["integer","null"]},"container_status":{"type":["string","null"]},"media_id":{"type":["string","null"]},"permalink":{"type":["string","null"]},"published_at":{"type":["string","null"]},"error":{"type":["string","null"],"description":"Error text from Instagram if failed"},"created_at":{"type":"string"}}},"Preview":{"type":"object","properties":{"match":{"type":["object","null"],"description":"The automation that would react"},"steps":{"type":"array","items":{"type":"object"}}}}}},"paths":{"/status":{"get":{"operationId":"status","summary":"Connection status: Instagram account, token expiry, webhook subscription, counts","responses":{"200":{"description":"Status","content":{"application/json":{"schema":{"type":"object","properties":{"account_status":{"type":"string","description":"Connection state stored for this account"},"problem":{"type":["string","null"],"description":"Error text when the Instagram API does not answer (token, key, Graph), otherwise null"},"webhook_problem":{"type":["string","null"],"description":"Error text when only the webhook subscription could not be read, otherwise null"}}}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/posts":{"get":{"operationId":"listPosts","summary":"Latest posts and reels with the automations attached to them","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":50},"description":"Default 12"}],"responses":{"200":{"description":"Posts","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Post"}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Instagram API error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/automations":{"get":{"operationId":"listAutomations","summary":"All automations with short stats","responses":{"200":{"description":"Automations","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AutomationSummary"}}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createAutomation","summary":"Create an automation","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"name":{"type":"string","description":"Internal name, e.g. 'Reel 16.10. VAULT'"},"active":{"type":"boolean","description":"Active (default true)"},"trigger":{"type":"string","enum":["comment","dm","story_reply"],"description":"comment = comment under a post/reel, dm = direct message, story_reply = reply to a story"},"media_ids":{"type":["array","null"],"items":{"type":"string"},"description":"comment only: IDs of the posts/reels (from list_posts). Empty/null = all posts"},"next_post":{"type":"boolean","description":"comment only: wait for the next new post/reel and attach to it automatically (at most 2 minutes after posting). Ideal when the reel is not online yet"},"keywords":{"type":"array","items":{"type":"string"},"description":"Trigger words, case-insensitive"},"match_mode":{"type":"string","enum":["word","contains","exact","any"],"description":"word (default): word appears in the text. contains: substring anywhere. exact: whole text = word. any: every text"},"exclude_keywords":{"type":"array","items":{"type":"string"},"description":"Do not trigger if one of these words appears"},"public_replies":{"type":"array","items":{"type":"string"},"description":"comment only: replies under the comment, one is picked at random. E.g. ['Sent you the link {username} 📩']. Empty = no public reply"},"opening_text":{"type":"string","description":"First DM with button (default: \"Hey {username}! Tap the button and I'll send you the link.\")"},"opening_button":{"type":"string","description":"Button of the first DM (default with follower check: \"Send link\"). Without follower check and without opening_button the link goes out in the first DM"},"follow_gate":{"type":"boolean","description":"Link only for followers. Non-followers get gate_text with a button to check again"},"gate_text":{"type":"string","description":"Text for non-followers (default: \"Almost there! Follow me real quick, then tap the button again and the link comes right away.\")"},"gate_button":{"type":"string","description":"Button to check again (default: \"I follow you now\")"},"link_url":{"type":"string","description":"Target link (https://...)"},"link_text":{"type":"string","description":"Text of the DM with the link (default: \"Here's your link 👇\")"},"link_button":{"type":"string","description":"Title of the link button (default: \"Open\")"},"extra_links":{"type":"array","maxItems":2,"items":{"type":"object","properties":{"title":{"type":"string"},"url":{"type":"string"}},"required":["title","url"]},"description":"Up to 2 more link buttons in the link DM"},"follow_up_text":{"type":"string","description":"Reminder for people who did not click the link, e.g. 'Did you check it out yet? 👀'. Sent once, with the link button, only inside the 24h window"},"follow_up_minutes":{"type":"integer","description":"Minutes without a click before the reminder (e.g. 120). 0 = off, max 1380"},"email_gate":{"type":"boolean","description":"Ask for the email before sending the link (default false). See the server instructions for the order with comments and follow_gate"},"email_text":{"type":"string","description":"Email question (default: \"Quick one: which email should I send it to? 📩\")"},"email_retry_text":{"type":"string","description":"Sent once if the reply contains no email; after the second miss the link goes out anyway (default: \"Hm, that didn't look like an email. Just type it in here 🙂\")"},"email_skip_if_known":{"type":"boolean","description":"Skip the email question for contacts with a stored email (default true)"},"webhook_url":{"type":["string","null"],"description":"Optional https URL that gets a POST on email_captured and link_sent. No private or local addresses. null = off"},"webhook_secret":{"type":["string","null"],"description":"Optional secret; the body is signed as header X-AgentChat-Signature: sha256=<HMAC-SHA256 hex>. Never shown again in responses"},"track_clicks":{"type":"boolean","description":"Count clicks through our own redirect (default true)"},"tags":{"type":"array","items":{"type":"string"},"description":"Tags the contact gets"},"once_per_user":{"type":"boolean","description":"Each user gets this automation only once (default true)"},"priority":{"type":"integer","description":"Higher number wins when several match (default 0)"},"notes":{"type":"string","description":"Note"},"skip_if_answered":{"type":"boolean","description":"comment only: skip the comment if your account already replied to it without AgentChat, e.g. ManyChat (default true). The run gets state skipped_other_tool"}},"required":["name","trigger"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationResult"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/automations/import":{"post":{"operationId":"importAutomations","summary":"Bulk import (e.g. from ManyChat). dry_run (default) resolves posts by permalink, caption part or next_post and shows warnings; dry_run=false creates all valid entries as drafts with an import_batch","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"automations":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"Internal name, e.g. 'Reel 16.10. VAULT'"},"active":{"type":"boolean","description":"Active (default true)"},"trigger":{"type":"string","enum":["comment","dm","story_reply"],"description":"comment = comment under a post/reel, dm = direct message, story_reply = reply to a story"},"media_ids":{"type":["array","null"],"items":{"type":"string"},"description":"comment only: IDs of the posts/reels (from list_posts). Empty/null = all posts"},"next_post":{"type":"boolean","description":"comment only: wait for the next new post/reel and attach to it automatically (at most 2 minutes after posting). Ideal when the reel is not online yet"},"keywords":{"type":"array","items":{"type":"string"},"description":"Trigger words, case-insensitive"},"match_mode":{"type":"string","enum":["word","contains","exact","any"],"description":"word (default): word appears in the text. contains: substring anywhere. exact: whole text = word. any: every text"},"exclude_keywords":{"type":"array","items":{"type":"string"},"description":"Do not trigger if one of these words appears"},"public_replies":{"type":"array","items":{"type":"string"},"description":"comment only: replies under the comment, one is picked at random. E.g. ['Sent you the link {username} 📩']. Empty = no public reply"},"opening_text":{"type":"string","description":"First DM with button (default: \"Hey {username}! Tap the button and I'll send you the link.\")"},"opening_button":{"type":"string","description":"Button of the first DM (default with follower check: \"Send link\"). Without follower check and without opening_button the link goes out in the first DM"},"follow_gate":{"type":"boolean","description":"Link only for followers. Non-followers get gate_text with a button to check again"},"gate_text":{"type":"string","description":"Text for non-followers (default: \"Almost there! Follow me real quick, then tap the button again and the link comes right away.\")"},"gate_button":{"type":"string","description":"Button to check again (default: \"I follow you now\")"},"link_url":{"type":"string","description":"Target link (https://...)"},"link_text":{"type":"string","description":"Text of the DM with the link (default: \"Here's your link 👇\")"},"link_button":{"type":"string","description":"Title of the link button (default: \"Open\")"},"extra_links":{"type":"array","maxItems":2,"items":{"type":"object","properties":{"title":{"type":"string"},"url":{"type":"string"}},"required":["title","url"]},"description":"Up to 2 more link buttons in the link DM"},"follow_up_text":{"type":"string","description":"Reminder for people who did not click the link, e.g. 'Did you check it out yet? 👀'. Sent once, with the link button, only inside the 24h window"},"follow_up_minutes":{"type":"integer","description":"Minutes without a click before the reminder (e.g. 120). 0 = off, max 1380"},"email_gate":{"type":"boolean","description":"Ask for the email before sending the link (default false). See the server instructions for the order with comments and follow_gate"},"email_text":{"type":"string","description":"Email question (default: \"Quick one: which email should I send it to? 📩\")"},"email_retry_text":{"type":"string","description":"Sent once if the reply contains no email; after the second miss the link goes out anyway (default: \"Hm, that didn't look like an email. Just type it in here 🙂\")"},"email_skip_if_known":{"type":"boolean","description":"Skip the email question for contacts with a stored email (default true)"},"webhook_url":{"type":["string","null"],"description":"Optional https URL that gets a POST on email_captured and link_sent. No private or local addresses. null = off"},"webhook_secret":{"type":["string","null"],"description":"Optional secret; the body is signed as header X-AgentChat-Signature: sha256=<HMAC-SHA256 hex>. Never shown again in responses"},"track_clicks":{"type":"boolean","description":"Count clicks through our own redirect (default true)"},"tags":{"type":"array","items":{"type":"string"},"description":"Tags the contact gets"},"once_per_user":{"type":"boolean","description":"Each user gets this automation only once (default true)"},"priority":{"type":"integer","description":"Higher number wins when several match (default 0)"},"notes":{"type":"string","description":"Note"},"skip_if_answered":{"type":"boolean","description":"comment only: skip the comment if your account already replied to it without AgentChat, e.g. ManyChat (default true). The run gets state skipped_other_tool"},"media_id":{"type":"string","description":"Post/reel ID (from list_posts)"},"permalink":{"type":"string","description":"Instagram link of the reel, e.g. https://www.instagram.com/reel/ABC123/"},"caption_contains":{"type":"string","description":"Part of the caption that identifies exactly one of the latest 50 posts"}},"required":["name"],"description":"Same fields as create_automation (trigger defaults to comment). Pick the post with ONE of media_id, media_ids, permalink, caption_contains or next_post; none = all posts"},"description":"The automations to import, e.g. read from ManyChat screenshots or from suggest_automations_from_posts"},"dry_run":{"type":"boolean","description":"Default true: only check and show, create nothing"},"start_paused":{"type":"boolean","description":"Create them paused (default false). Then turn each one on with update_automation active=true"},"transition_mode":{"type":"boolean","description":"Default true until finish_migration ran: run without thread-ownership features until ManyChat is disconnected"},"draft":{"type":"boolean","description":"Default true: create as drafts that answer nothing until go_live (check preview_automation first). false = live right away"}},"required":["automations"]}}}},"responses":{"200":{"description":"Dry run","content":{"application/json":{"schema":{"type":"object"}}}},"201":{"description":"Imported","content":{"application/json":{"schema":{"type":"object","description":"results, import_batch, next_steps, manychat_pause_checklist"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Instagram API error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/automations/suggestions":{"get":{"operationId":"suggestAutomations","summary":"Comment keywords found in the captions of the latest posts, one suggested automation per post (import_input fits /automations/import)","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":50},"description":"Default 12"}],"responses":{"200":{"description":"Suggestions","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Instagram API error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/automations/go-live":{"post":{"operationId":"goLive","summary":"Switch drafts live (automation_ids, import_batch or all_drafts). Returns the ManyChat pause checklist and gap-fill calls","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"automation_ids":{"type":"array","items":{"type":"integer"}},"import_batch":{"type":"string","description":"From the import_automations result"},"all_drafts":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Live","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found (or belongs to another account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/automations/{id}/preview":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1},"description":"Automation ID"}],"get":{"operationId":"previewAutomation","summary":"How the public reply and the DMs look for the follower, plus a link check","responses":{"200":{"description":"Preview","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found (or belongs to another account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/migration/finish":{"post":{"operationId":"finishMigration","summary":"After ManyChat is disconnected: switch automations in transition mode to their target settings (needs confirm_manychat_disconnected=true)","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"confirm_manychat_disconnected":{"type":"boolean","description":"true = ManyChat is disconnected in Instagram, switch now"},"automation_ids":{"type":"array","items":{"type":"integer"},"description":"Optional: only these automations"}}}}}},"responses":{"200":{"description":"Result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/keyword-links":{"get":{"operationId":"listKeywordLinks","summary":"Keyword link library","responses":{"200":{"description":"Links","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"keyword":{"type":"string"},"url":{"type":"string"}}}}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/keyword-links/{keyword}":{"parameters":[{"name":"keyword","in":"path","required":true,"schema":{"type":"string"},"description":"Keyword (URL-encoded)"}],"put":{"operationId":"setKeywordLink","summary":"Set the link for a keyword","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"url":{"type":["string","null"],"description":"https://... ; null removes the keyword"}},"required":["url"]}}}},"responses":{"200":{"description":"Saved","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteKeywordLink","summary":"Remove a keyword","responses":{"200":{"description":"Removed","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/automations/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1},"description":"Automation ID"}],"get":{"operationId":"getAutomation","summary":"One automation with funnel numbers and preview","responses":{"200":{"description":"Automation","content":{"application/json":{"schema":{"type":"object","properties":{"automation":{"$ref":"#/components/schemas/Automation"},"funnel":{"$ref":"#/components/schemas/Funnel"},"preview":{"type":"object"}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found (or belongs to another account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateAutomation","summary":"Change fields (only the given ones). Pause with active=false","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationInput"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationResult"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found (or belongs to another account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteAutomation","summary":"Delete an automation (history stays in the export)","responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"string","description":"Name of the deleted automation"}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found (or belongs to another account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/automations/{id}/test":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1},"description":"Automation ID"}],"post":{"operationId":"testAutomation","summary":"Dry run with the automation's trigger: which automation reacts and which messages would go out. Sends nothing","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"text":{"type":"string","description":"Text to test. Default: the first keyword of the automation"},"media_id":{"type":"string","description":"Post ID for comment automations. Default: the first post of the automation"},"follows":{"type":"boolean","description":"Assumption for the follower check (default true)"}}}}}},"responses":{"200":{"description":"Preview","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Preview"},{"type":"object","properties":{"text":{"type":"string"},"matches_this_automation":{"type":"boolean"}}}]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found (or belongs to another account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/automations/{id}/run-existing":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1},"description":"Automation ID"}],"post":{"operationId":"runOnExistingComments","summary":"Apply a comment automation to comments that already exist (younger than 7 days). dry_run is the default","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"media_id":{"type":"string","description":"Post ID. Optional if the automation is attached to exactly one post"},"dry_run":{"type":"boolean","description":"Default true: only shows who would get something"},"limit":{"type":"integer","description":"Max comments, default 100, max 500"},"since_minutes":{"type":"integer","description":"Only comments from the last N minutes (e.g. 30 after switching from ManyChat)"}}}}}},"responses":{"200":{"description":"Result","content":{"application/json":{"schema":{"type":"object","properties":{"dry_run":{"type":"boolean"},"comments_checked":{"type":"integer"},"matches":{"type":"array","items":{"type":"object","properties":{"comment":{"type":"string"},"user":{"type":"string"},"result":{}}}}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found (or belongs to another account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Instagram API error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/comments":{"get":{"operationId":"listComments","summary":"Comments under a post, with a flag whether they were already answered","parameters":[{"name":"media_id","in":"query","required":true,"schema":{"type":"string"},"description":"Post ID (from /posts)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":500},"description":"Default 50"},{"name":"only_unanswered","in":"query","required":false,"schema":{"type":"boolean"},"description":"Only comments without a reply"}],"responses":{"200":{"description":"Comments","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Comment"}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Instagram API error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/comments/{id}/reply":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Comment ID"}],"post":{"operationId":"replyToComment","summary":"Reply publicly to a comment","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"text":{"type":"string","minLength":1,"maxLength":2200,"description":"Public reply text"}},"required":["text"]}}}},"responses":{"200":{"description":"Reply sent","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Instagram API error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/contacts":{"get":{"operationId":"listContacts","summary":"Filter and list contacts","parameters":[{"name":"search","in":"query","required":false,"schema":{"type":"string"},"description":"Part of the username"},{"name":"tag","in":"query","required":false,"schema":{"type":"string"},"description":"Only contacts with this tag"},{"name":"follows","in":"query","required":false,"schema":{"type":"boolean"},"description":"Follows the account"},{"name":"has_email","in":"query","required":false,"schema":{"type":"boolean"},"description":"Has a stored email"},{"name":"clicked","in":"query","required":false,"schema":{"type":"boolean"},"description":"Clicked a link"},{"name":"automation_id","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Triggered this automation"},{"name":"since","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Last active since (YYYY-MM-DD)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":500},"description":"Default 50"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0},"description":"Paging offset"}],"responses":{"200":{"description":"Contacts","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"contacts":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/contacts/import":{"post":{"operationId":"importContacts","summary":"Import contacts from the ManyChat export (csv) or a JSON list (contacts). dry_run (default) only counts new, updated, skipped and errors with examples; existing contacts are only filled in, never overwritten","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"csv":{"type":"string","description":"Text of the CSV export (first row = column names)"},"contacts":{"type":"array","items":{"type":"object"},"description":"Instead of csv: list of contact objects with the same field names"},"dry_run":{"type":"boolean","description":"Default true: only count and show examples, change nothing"},"source_map":{"type":"object","description":"Optional: ManyChat automation name or tag → AgentChat automation id, e.g. {\"Agent vault copy 4\": 12}"}}}}}},"responses":{"200":{"description":"Dry run","content":{"application/json":{"schema":{"type":"object"}}}},"201":{"description":"Imported","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/conversations/backfill":{"post":{"operationId":"backfillConversations","summary":"Load the DM history from Instagram (read only) as a background job; progress in GET /status (backfill). Instagram returns only the 20 most recent messages per conversation","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"max_conversations":{"type":"integer","description":"Stop after this many conversations (default 1000, max 10000)"},"restart":{"type":"boolean","description":"Start again from the newest conversation even if a backfill is running"},"cancel":{"type":"boolean","description":"Stop a running backfill. Loaded messages stay"}}}}}},"responses":{"200":{"description":"Started or continued; backfill holds the progress","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Instagram API error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/contacts/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Instagram ID or @username (URL-encoded)"}],"get":{"operationId":"getContact","summary":"One contact with runs, history and the DM conversation (loaded history plus live messages)","responses":{"200":{"description":"Contact","content":{"application/json":{"schema":{"type":"object","properties":{"contact":{"$ref":"#/components/schemas/Contact"},"runs":{"type":"array","items":{"type":"object"}},"history":{"type":"array","items":{"type":"object"}},"conversation":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string"},"direction":{"type":"string","enum":["in","out"]},"text":{"type":["string","null"]},"source":{"type":"string","enum":["instagram","agentchat"]},"kind":{"type":"string"}}}}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found (or belongs to another account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateContact","summary":"Change tags, email or note","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"add_tags":{"type":"array","items":{"type":"string"}},"remove_tags":{"type":"array","items":{"type":"string"}},"email":{"type":["string","null"]},"notes":{"type":["string","null"]}}}}}},"responses":{"200":{"description":"Contact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found (or belongs to another account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dm":{"post":{"operationId":"sendDm","summary":"Send a DM to a contact (only within 24 hours after their last message or button tap)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"contact":{"type":"string","minLength":1,"description":"Instagram ID or @username of the contact"},"text":{"type":"string","minLength":1,"maxLength":640,"description":"Message text, placeholders {username} and {name}"},"link_url":{"type":"string","description":"Optional link, sent as a button (https://...)"},"button_title":{"type":"string","maxLength":20,"description":"Title of the link button"}},"required":["contact","text"]}}}},"responses":{"200":{"description":"Sent","content":{"application/json":{"schema":{"type":"object","properties":{"sent":{"type":"object"},"warning":{"type":["string","null"]}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found (or belongs to another account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Instagram API error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/videos":{"post":{"operationId":"createVideoUpload","summary":"One-time upload URL for a reel video. PUT the MP4/MOV file there within 1 hour (Content-Type video/mp4 or video/quicktime), then schedule it with POST /reels. Node server only","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"filename":{"type":"string","description":"Optional original file name, only for your overview"},"content_type":{"type":"string","enum":["video/mp4","video/quicktime"],"description":"Default video/mp4"}}}}}},"responses":{"201":{"description":"Upload link","content":{"application/json":{"schema":{"type":"object","properties":{"video_id":{"type":"integer"},"upload_url":{"type":"string"},"method":{"type":"string"},"headers":{"type":"object"},"expires_at":{"type":"string"},"max_mb":{"type":"number"},"example":{"type":"string"},"note":{"type":"string"}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/reels":{"get":{"operationId":"listReels","summary":"Scheduled, published, failed and cancelled reels, newest first","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["open","published","failed","cancelled","all"]},"description":"Default open"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100},"description":"Default 20"}],"responses":{"200":{"description":"Reels","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Reel"}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"scheduleReel","summary":"Publish a reel now or at a set time (video_id from POST /videos or a public video_url). Checks Instagram's daily limit first. Optional comment automation attaches to exactly this reel","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"video_id":{"type":"integer","description":"ID from upload_video"},"video_url":{"type":"string","description":"Public https URL of an MP4/MOV, instead of video_id. Must still work at publish time"},"caption":{"type":"string","description":"Caption, max 2200 characters, 30 hashtags, 20 @mentions"},"publish_at":{"type":"string","description":"'now' or ISO 8601 with time zone, e.g. 2026-10-20T18:00:00+02:00. Uploaded files: at most 7 days after the upload"},"cover_url":{"type":"string","description":"Optional public JPEG for the cover (wins over thumb_offset)"},"thumb_offset":{"type":"integer","description":"Optional cover frame in milliseconds from the start"},"share_to_feed":{"type":"boolean","description":"true = reel may also appear in the feed, false = Reels tab only. Default: Instagram's default"},"trial":{"type":"boolean","description":"Trial reel: shown only to non-followers first; graduate it manually in the Instagram app"},"automation":{"type":"object","properties":{"name":{"type":"string","description":"Internal name, e.g. 'Reel 16.10. VAULT'"},"active":{"type":"boolean","description":"Active (default true)"},"trigger":{"type":"string","enum":["comment","dm","story_reply"],"description":"comment = comment under a post/reel, dm = direct message, story_reply = reply to a story"},"media_ids":{"type":["array","null"],"items":{"type":"string"},"description":"comment only: IDs of the posts/reels (from list_posts). Empty/null = all posts"},"next_post":{"type":"boolean","description":"comment only: wait for the next new post/reel and attach to it automatically (at most 2 minutes after posting). Ideal when the reel is not online yet"},"keywords":{"type":"array","items":{"type":"string"},"description":"Trigger words, case-insensitive"},"match_mode":{"type":"string","enum":["word","contains","exact","any"],"description":"word (default): word appears in the text. contains: substring anywhere. exact: whole text = word. any: every text"},"exclude_keywords":{"type":"array","items":{"type":"string"},"description":"Do not trigger if one of these words appears"},"public_replies":{"type":"array","items":{"type":"string"},"description":"comment only: replies under the comment, one is picked at random. E.g. ['Sent you the link {username} 📩']. Empty = no public reply"},"opening_text":{"type":"string","description":"First DM with button (default: \"Hey {username}! Tap the button and I'll send you the link.\")"},"opening_button":{"type":"string","description":"Button of the first DM (default with follower check: \"Send link\"). Without follower check and without opening_button the link goes out in the first DM"},"follow_gate":{"type":"boolean","description":"Link only for followers. Non-followers get gate_text with a button to check again"},"gate_text":{"type":"string","description":"Text for non-followers (default: \"Almost there! Follow me real quick, then tap the button again and the link comes right away.\")"},"gate_button":{"type":"string","description":"Button to check again (default: \"I follow you now\")"},"link_url":{"type":"string","description":"Target link (https://...)"},"link_text":{"type":"string","description":"Text of the DM with the link (default: \"Here's your link 👇\")"},"link_button":{"type":"string","description":"Title of the link button (default: \"Open\")"},"extra_links":{"type":"array","maxItems":2,"items":{"type":"object","properties":{"title":{"type":"string"},"url":{"type":"string"}},"required":["title","url"]},"description":"Up to 2 more link buttons in the link DM"},"follow_up_text":{"type":"string","description":"Reminder for people who did not click the link, e.g. 'Did you check it out yet? 👀'. Sent once, with the link button, only inside the 24h window"},"follow_up_minutes":{"type":"integer","description":"Minutes without a click before the reminder (e.g. 120). 0 = off, max 1380"},"email_gate":{"type":"boolean","description":"Ask for the email before sending the link (default false). See the server instructions for the order with comments and follow_gate"},"email_text":{"type":"string","description":"Email question (default: \"Quick one: which email should I send it to? 📩\")"},"email_retry_text":{"type":"string","description":"Sent once if the reply contains no email; after the second miss the link goes out anyway (default: \"Hm, that didn't look like an email. Just type it in here 🙂\")"},"email_skip_if_known":{"type":"boolean","description":"Skip the email question for contacts with a stored email (default true)"},"webhook_url":{"type":["string","null"],"description":"Optional https URL that gets a POST on email_captured and link_sent. No private or local addresses. null = off"},"webhook_secret":{"type":["string","null"],"description":"Optional secret; the body is signed as header X-AgentChat-Signature: sha256=<HMAC-SHA256 hex>. Never shown again in responses"},"track_clicks":{"type":"boolean","description":"Count clicks through our own redirect (default true)"},"tags":{"type":"array","items":{"type":"string"},"description":"Tags the contact gets"},"once_per_user":{"type":"boolean","description":"Each user gets this automation only once (default true)"},"priority":{"type":"integer","description":"Higher number wins when several match (default 0)"},"notes":{"type":"string","description":"Note"},"skip_if_answered":{"type":"boolean","description":"comment only: skip the comment if your account already replied to it without AgentChat, e.g. ManyChat (default true). The run gets state skipped_other_tool"}},"required":["name"],"description":"Same fields as an automation; trigger is always comment"}},"required":["publish_at"]}}}},"responses":{"201":{"description":"Scheduled","content":{"application/json":{"schema":{"type":"object","properties":{"reel":{"$ref":"#/components/schemas/Reel"},"limit":{"type":["object","null"]},"notes":{"type":"array","items":{"type":"string"}}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found (or belongs to another account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Instagram API error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/reels/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1},"description":"Scheduled reel ID"}],"delete":{"operationId":"cancelReel","summary":"Cancel a reel that is not published yet; the uploaded file is deleted right away","responses":{"200":{"description":"Cancelled","content":{"application/json":{"schema":{"type":"object","properties":{"cancelled":{"type":"integer"},"file_deleted":{"type":"boolean"},"note":{"type":["string","null"]}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found (or belongs to another account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/publishing-limit":{"get":{"operationId":"publishingLimit","summary":"Instagram's publishing limit: API posts in the last 24 hours, maximum, reels scheduled for the next 24 hours","responses":{"200":{"description":"Limit","content":{"application/json":{"schema":{"type":"object","properties":{"published_24h":{"type":"integer"},"maximum":{"type":"integer"},"period_hours":{"type":"integer"},"remaining":{"type":"integer"},"scheduled_next_24h":{"type":"integer"}}}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Instagram API error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/stats":{"get":{"operationId":"stats","summary":"Funnel per automation","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":3650},"description":"Period, default 30"}],"responses":{"200":{"description":"Stats","content":{"application/json":{"schema":{"type":"object","properties":{"period_days":{"type":"integer"},"automations":{"type":"array","items":{"$ref":"#/components/schemas/Funnel"}}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/activity":{"get":{"operationId":"activity","summary":"Latest events (incoming comments and DMs, sent messages, errors)","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":500},"description":"Default 50"},{"name":"kind","in":"query","required":false,"schema":{"type":"string"},"description":"e.g. comment_in, dm_in, dm_out, email_captured, error"},{"name":"automation_id","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Only events of this automation"},{"name":"contact","in":"query","required":false,"schema":{"type":"string"},"description":"Instagram ID or @username"}],"responses":{"200":{"description":"Events","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Event"}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found (or belongs to another account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/export/{table}":{"parameters":[{"name":"table","in":"path","required":true,"schema":{"type":"string","enum":["all","contacts","automations","runs","events","clicks","scheduled_posts","videos","messages"]},"description":"all = every table in one JSON object"}],"get":{"operationId":"exportData","summary":"Raw rows of one table of this account (or all tables)","parameters":[{"name":"since","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Only rows since (YYYY-MM-DD)"},{"name":"format","in":"query","required":false,"schema":{"type":"string","enum":["json","csv"]},"description":"Default json; csv not for all"}],"responses":{"200":{"description":"Rows","content":{"application/json":{"schema":{"oneOf":[{"type":"array","items":{"type":"object"}},{"type":"object"}]}},"text/csv":{"schema":{"type":"string"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found (or belongs to another account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/openapi.json":{"get":{"operationId":"openapi","summary":"This document","security":[],"responses":{"200":{"description":"OpenAPI 3.1 document","content":{"application/json":{"schema":{"type":"object"}}}}}}}}}