Skip to content
Connect an agent

Get started

Quick start

Connect a social account and publish your first post through Flung, from your server or from an AI agent.

Claude Codeclaude mcp add --transport http flung https://mcp.flung.dev/mcp-oauth

TL;DR

QuestionAnswer
What do I need?A Flung API key (it starts flung_sk_), kept on your server.
How long does it take?A few minutes: install, connect one account, post.
Can an AI agent do this for me?Yes. Skip to Connect an AI agent, then ask it to "connect my LinkedIn and post that we're live".

1. Install the SDK

bash
npm install @flung.dev/sdk

The SDK runs on a server: Node 20 or newer, Cloudflare Workers, Deno or Bun. Keep the key in an environment variable such as FLUNG_API_KEY.

2. Connect an account

Start a connect, send the person to the authorizationUrl it returns, and wait until they approve on the platform.

bash
curl -X POST 'https://api.flung.dev/v1/connect/linkedin' \  --header "Authorization: Bearer $FLUNG_API_KEY" \  --header 'Content-Type: application/json' \  --header "Idempotency-Key: $(uuidgen)" \  --data '{  "redirectUrl": "https://app.example.com/settings/social",  "handle": "alice.bsky.social"}'

The SDK waits for you:

ts
const session = await flung.accounts.connect({ platform: 'linkedin' })console.warn(`Open ${session.authorizationUrl}`)const done = await flung.waitForConnection(session.id)

To let your own users connect accounts on your website instead, use the connect panel.

3. Publish a post

List the connected accounts, then post to them. Leave out publishAt to publish now, or give a time to schedule it.

bash
curl -X GET 'https://api.flung.dev/v1/accounts?reconnectBefore=2026-11-30T00%3A00%3A00Z' \  --header "Authorization: Bearer $FLUNG_API_KEY"
bash
curl -X POST 'https://api.flung.dev/v1/posts' \  --header "Authorization: Bearer $FLUNG_API_KEY" \  --header 'Content-Type: application/json' \  --header "Idempotency-Key: $(uuidgen)" \  --data '{  "content": "Launching today.",  "accountIds": [    "acct_aaaaaaaaaaaaaaaaaaaaaaaa"  ],  "platformOverrides": {    "x": {      "content": "Launching today. #launch"    }  },  "variables": {    "product": "Flung"  }}'

The answer has a target per account. Read the post again, or listen for webhooks, to see each one published or failed.

Where next

ToRead
Let your users connect accounts on your siteAdd account connecting to your site
Attach images and videoImages and video
Be told when posts go outWebhooks
Give an AI agent the same powersConnect an AI agent
See every endpointAPI reference