chalk / Docs
← Back to home

Chalk API & MCP Docs

Connect any AI agent or script to your Instagram Reels, scheduled posts, transcripts, watch-time stats, and auto-DMs using MCP or REST.

Authentication

Pass your CHALK_API_KEY as a Bearer token in the Authorization header on /mcp and /api/*.

MCP endpoint
API key Sign in to generate or rotate your Chalk API key. Sign in Join waitlist

Connect an agent

Chalk exposes a stateless Streamable HTTP MCP server at /mcp. Choose your client below and copy the configuration.


        

Tool reference

Every tool below is discovered automatically when an agent connects to /mcp (or via local stdio with npm run mcp).

list_automations
Returns all configured Comment-to-DM and DM keyword triggers with active status and target Reel IDs.
create_automation
Creates a trigger with comma-separated keywords, rotated public reply variations, DM copy, and up to 3 link buttons.
toggle_automation
Enables or pauses an existing automation by ID.
delete_automation
Permanently deletes an automation by ID.
list_recent_runs
Lists recent follower triggers with handle, matched text, and delivery status (queued, sent, retrying, failed).
get_queue_status
Returns counts of pending, processing, sent, and failed jobs in the send queue.
sync_instagram_posts
Pulls fresh profile stats, Reels, thumbnails, and insights (views, reach, saves, shares, avg watch time) from Meta.
transcribe_posts
Transcribes untranscribed Reels (highest views first) via OpenRouter using ElevenLabs Scribe.
get_post_analytics
Queries synced Reels sorted by views, saves, shares, reach, likes, or recent, including full spoken transcripts.
create_draft
Saves a draft or schedules an Instagram Reel/Image post (supports mediaUrl, scheduledFor, shareToFeed, thumbOffsetMs, and optional autoDm to activate a Comment-to-DM trigger on publish).
list_drafts
Lists drafted, scheduled, publishing, published, or failed Instagram posts in Chalk's queue.
update_draft
Edits caption, media URL, scheduled time, or attached Auto-DM config on a draft or scheduled post.
publish_draft_now
Immediately publishes a saved draft or scheduled post to Instagram (respects DRY_RUN).
delete_draft
Cancels a scheduled post or deletes a draft by ID.

REST API endpoints

All programmatic endpoints accept JSON and authenticate via Authorization: Bearer <CHALK_API_KEY>.

GET/api/automations
List all automations.
POST/api/automations
Create a new automation.
PATCH/api/automations/:id
Update an automation's keywords, replies, DM text, or link buttons.
DELETE/api/automations/:id
Delete an automation.
POST/api/uploads
Multipart upload for Reels (MP4/MOV up to 300 MB) or Image posts (JPEG up to 8 MB). Returns storageKey.
GET/api/drafts
List drafts and scheduled posts (optional ?status=draft|scheduled|published|failed).
POST/api/drafts
Create a draft, schedule a post, or publish immediately with optional autoDmConfig.
PATCH/api/drafts/:id
Update caption, media, scheduled time, or attached Auto-DM trigger.
POST/api/drafts/:id/publish
Publish a draft or scheduled post right away.
POST/api/drafts/:id/retry
Retry a failed scheduled post.
DELETE/api/drafts/:id
Cancel a scheduled post or delete a draft.
GET/api/posts
Return synced Reels with views, reach, saves, shares, avg watch time, and transcripts.
POST/api/sync
Trigger a live Meta Graph API sync.
POST/api/transcribe?limit=5
Transcribe the next batch of untranscribed Reels.
GET/api/queue
Inspect send queue counts.
POST/api/simulate/comment
Dry-run a mock comment against active automations.
POST/api/simulate/dm
Dry-run a mock DM against active keyword automations.

Send queue & retries

Incoming webhooks at /webhooks/instagram verify Meta's X-Hub-Signature-256 header, deduplicate per user, enqueue matching replies into SQLite (send_queue), and respond 200 OK immediately.

The background worker paces outgoing Meta API calls at 1 job every 500ms and retries transient rate-limit failures up to 5 times with exponential backoff (15s → 60s → 5m → 15m → 60m), so comment spikes don't drop DMs.