Relay

REST API

Publish and schedule Instagram posts over plain HTTP. If you're wiring up an AI agent, the MCP server exposes the same capabilities as tools.

Base URL & authentication

Every request authenticates with an API key from Dashboard → API keys, sent as a bearer token.
https://<your-api-url>/v1

Authorization: Bearer rly_live_...

Rate limits & idempotency

Keys are limited to 120 requests/minute; over-limit requests get 429 with a Retry-After header. Send an Idempotency-Key header on POST /v1/posts and POST /v1/media to make retries safe — a successful response replays for 24 hours (replays carry Idempotency-Replayed: true); failed responses are not cached, so the same key can retry after a fix. Note Instagram's own ceiling: each account may publish 100 API posts per rolling 24h — at the limit Relay keeps the post in publishing and retries until a slot frees up.

Endpoints

GET/v1/accounts
List connected social accounts with status, follower counts, and token expiry.
POST/v1/posts
Create a post. targets = account IDs; media = media IDs or public URLs (JPEG images, MP4/MOV video). post_type: feed (1 image), reel (1 video, optional share_to_feed), story (1 item, no caption shown), carousel (2–10 items) — omitted, it's inferred (stories never inferred). Omit schedule_at to publish now; a future ISO 8601 time schedules it.
curl -X POST https://<your-api-url>/v1/posts \
  -H "Authorization: Bearer $RELAY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 8f3c1e2a" \
  -d '{
    "targets": ["<account_id>"],
    "caption": "Fall drop is live — link in bio.",
    "media": ["https://cdn.example.com/fall-drop.jpg"],
    "schedule_at": "2026-08-04T18:30:00Z"
  }'
GET/v1/posts
List posts, newest first. Query params: status (draft|scheduled|publishing|published|partly|failed|cancelled), limit (1–100, default 20), cursor. The response includes next_cursor when more pages exist — pass it back as cursor.
GET/v1/posts/:id
Fetch one post with its per-target delivery timeline: status, Instagram post ID, permalink, and the exact error code/message when a target failed.
PATCH/v1/posts/:id
Edit a draft or scheduled post — caption and/or schedule_at. Posts that started publishing can't be edited.
DELETE/v1/posts/:id
Cancel a draft or scheduled post before it publishes.
POST/v1/media
Ingest media from a public URL into Relay's storage and get a reusable media ID. JPEG images up to 8MB (Instagram limit; 4:5–1.91:1 aspect for feed/carousel), MP4/MOV video up to 100MB.
curl -X POST https://<your-api-url>/v1/media \
  -H "Authorization: Bearer $RELAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://cdn.example.com/fall-drop.jpg" }'

Errors

Validation and domain errors return 400 with a JSON body:
{ "error": "Feed posts take exactly one image — use post_type 'reel' for a single video or 'carousel' for multiple items" }
401 — missing/invalid API key · 404 — not found · 429 — rate limited (check Retry-After) · 5xx — transient; retry with the same Idempotency-Key. Publish-time failures (Instagram rejections, token revocations) don't fail the HTTP call — they land on the post's per-target timeline with the Graph error code and message.
Questions? Reach us at support@lantean.tech. See also the MCP server for AI agents.