Skip to content
Connect an agent

AI agents

Flung for AI agents

What an AI agent needs to use Flung, and to build Flung into someone's product: which way in to choose, the order of calls, and the rules that keep posts and accounts safe.

TL;DR

QuestionAnswer
What is Flung?An API that connects social media accounts (X, Instagram, Facebook, Threads, LinkedIn, TikTok, YouTube, Pinterest, Bluesky, Mastodon, Discord, Farcaster) and publishes posts to them, now or on a schedule.
I am an agent posting for a personUse the MCP server: https://mcp.flung.dev/mcp-oauth. See Connect an AI agent.
I am a coding agent adding Flung to a websiteFollow Add Flung to a website step by step. Every file it shows is from a working example.
I need every page in one filehttps://docs.flung.dev/llms-full.txt. The index is https://docs.flung.dev/llms.txt, and any page is Markdown with .md added to its address.
I need the exact APIhttps://docs.flung.dev/openapi.json (OpenAPI 3.1) and https://docs.flung.dev/tools.json (the MCP tools with JSON Schemas).

Choose the way in

The taskUseWhy
Post, schedule, or check accounts for a person, in a chatThe MCP serverThe person signs in once in their browser; no key is handled.
Call Flung from a server or a script@flung.dev/sdk, or the REST APITyped, retried, idempotent.
Let people connect their accounts on a web page@flung.dev/connect with a connect tokenThe API key never reaches the browser.
React to posts being published or failingWebhooksSigned events, retried until your endpoint answers.

What the server tells every agent

The MCP server sends this when a client connects. It holds over HTTP too.

  • Flung connects social media accounts and schedules posts to them.
  • To keep accounts working, start with find_accounts_needing_attention. Accounts with renewal "automatic" renew themselves; the others need a person before reconnectBy.
  • Connecting or reconnecting needs a person: call connect_account or reconnect_account, give the person the authorizationUrl, then poll get_connect_session until it is not pending. The link expires in ten minutes.
  • To post, call list_accounts for ids, then schedule_post with an idempotencyKey you reuse on retry, then get_post for the outcome.
  • A refused call is an answer, not a fault: its text says what to do next.

Rules

  • Never put an API key (flung_sk_...) in a browser, a page, a commit or a log. A page gets a connect token from its own server.
  • A person must approve every connect and reconnect on the platform's own page. Give them the link; never try to complete it.
  • Send an Idempotency-Key with every POST, and reuse it when you retry the same request, or a post may go out twice.
  • Ask the person before calling anything that disconnects an account, cancels a post, or replies publicly.
  • Branch on error.code, never on the message. A refusal says what to do next.

See also

DocWhy
Add Flung to a websiteThe recipe for coding agents
Rules fileA block to paste into CLAUDE.md or AGENTS.md
Prompts and recipesRequests that work, and the tools behind them
Files for agentsEvery machine-readable file this site serves