# CueEditio for AI agents

CueEditio lets you (the agent) read Instagram and Facebook Page comments, reply to them, DM people who comment,
create Auto DM rules ("comment LINK → get a DM") and schedule videos to every connected platform.
You can sign up yourself. The user only approves Instagram. If the user already gave you an API key, skip to step 3.

## 1. Get an API key (email code)
Use an email inbox you can read (ask the user which one, if you are not sure).

    curl -s -X POST https://www.cueedit.io/api/agent/signup \
      -H 'Content-Type: application/json' \
      -d '{"email": "USER_EMAIL", "agent": "YOUR_AGENT_NAME"}'

Read the 6-digit code from the email "Your CueEditio code for your AI agent", then:

    curl -s -X POST https://www.cueedit.io/api/agent/verify \
      -H 'Content-Type: application/json' \
      -d '{"email": "USER_EMAIL", "code": "123456", "agent": "YOUR_AGENT_NAME"}'

The response has api_key (shown once: store it securely, never print it back to the user), mcp_url and connect_url.
The same email works for sign-up and sign-in. A wrong code is burned; request a new one.

## 2. The user connects Instagram
If instagram is empty, send the user connect_url. They open it, check the email shown, and approve on Instagram
or Facebook. No CueEditio login. The link works for one hour; list_accounts returns a fresh one.

## 3. Use it
MCP (streamable HTTP): https://www.cueedit.io/api/mcp/mcp with header Authorization: Bearer <api_key>.
REST: https://www.cueedit.io/api/v1 with the same header.

Tools: list_accounts, list_posts, list_comments, reply_to_comment, send_dm, list_autodm_rules,
create_autodm_rule, set_autodm_rule_status, list_channels, schedule_post (Facebook: list_facebook_pages, list_facebook_posts,
list_facebook_comments, reply_to_facebook_comment, send_facebook_dm).

## Auto DM for a post that isn't live yet
Pass caption_match (the first 10+ characters of the post's caption, exactly) to create_autodm_rule /
POST /api/v1/autodm/rules instead of media_ids. The rule is saved as "waiting" and attaches itself to the first
new post whose caption starts with that text (checked every 5 minutes), then turns "active".
Rules run on CueEditio's servers: never build a polling script on the user's computer.

## Scheduling
list_channels (GET /api/v1/channels) → schedule_post (POST /api/v1/posts {channel_id, scheduled_at, caption} plus
video_url OR image_urls). Links must be public https; photos must be JPEG. image_urls in order: 1 = photo, 2+ = carousel.
Max photos: Instagram 10, Facebook 10, LinkedIn 20, Threads 20, Pinterest 5, X 4, Bluesky 4 (≤1 MB each).
TikTok and YouTube take video only.

## Rules
- Show the user the exact reply, DM or rule and get a yes before sending.
- Instagram only allows DMs to people who commented, one per comment, within 7 days.
- Reading is free. Sending replies and DMs and creating rules needs CueEditio Pro ($6/month): if you get 402,
  tell the user to upgrade at https://www.cueedit.io/pricing.
