# API reference

> Page: https://docs.flung.dev/reference/api. Index of every page: https://docs.flung.dev/llms.txt

Every endpoint of the Flung REST API, grouped by what it does, with a page each that has its parameters, its answers and code samples in curl, TypeScript and fetch.

## TL;DR

| Question | Answer |
|---|---|
| Where is it? | `https://api.flung.dev`. Every path below is relative to it. Preview, for trying changes, is `https://api-preview.flung.dev`. |
| How do I authenticate? | Send `Authorization: Bearer <credential>`: an API key (`flung_sk_...`), an OAuth access token, or, for the few calls a connect panel makes, a connect token (`flung_ct_...`). See [Authentication](https://docs.flung.dev/authentication.md). |
| What format? | JSON in and out, except uploading a file's bytes. Times are ISO 8601 in UTC. |
| What does an error look like? | One shape for every failure, with a stable `code`. See [Errors](https://docs.flung.dev/reference/api/errors.md). |
| Is it safe to retry a POST? | Yes, with an `Idempotency-Key` header: the same key returns the first answer instead of doing the work twice. The SDK sends one on every POST. |
| How fast may I call it? | 600 requests a minute per API key or OAuth app. Past that the answer is `429` with `Retry-After`. |
| Is there a typed client? | [`@flung.dev/sdk`](https://docs.flung.dev/reference/sdk.md): every endpoint below as a typed method. |
| Where is the machine-readable form? | `https://api.flung.dev/openapi.json` (OpenAPI 3.1), also at `https://docs.flung.dev/openapi.json`. |

## Endpoints

67 endpoints, grouped by what they do.

### Posts

| Method | Path | What it does |
|---|---|---|
| GET | [`/v1/posts`](https://docs.flung.dev/reference/api/get-v1-posts.md) | List posts |
| POST | [`/v1/posts`](https://docs.flung.dev/reference/api/post-v1-posts.md) | Schedule a post |
| GET | [`/v1/posts/{id}`](https://docs.flung.dev/reference/api/get-v1-posts-id.md) | Get a post |
| PATCH | [`/v1/posts/{id}`](https://docs.flung.dev/reference/api/patch-v1-posts-id.md) | Change a scheduled post |
| DELETE | [`/v1/posts/{id}`](https://docs.flung.dev/reference/api/delete-v1-posts-id.md) | Delete a post |
| POST | [`/v1/posts/{id}/cancel`](https://docs.flung.dev/reference/api/post-v1-posts-id-cancel.md) | Cancel a scheduled post |
| POST | [`/v1/posts/{id}/retry`](https://docs.flung.dev/reference/api/post-v1-posts-id-retry.md) | Retry the failed accounts of a post |
| GET | [`/v1/posts/{id}/metrics`](https://docs.flung.dev/reference/api/get-v1-posts-id-metrics.md) | Read a post's counts |

### Accounts

| Method | Path | What it does |
|---|---|---|
| GET | [`/v1/accounts`](https://docs.flung.dev/reference/api/get-v1-accounts.md) | List connected accounts |
| GET | [`/v1/accounts/{id}`](https://docs.flung.dev/reference/api/get-v1-accounts-id.md) | Get a connected account |
| PATCH | [`/v1/accounts/{id}`](https://docs.flung.dev/reference/api/patch-v1-accounts-id.md) | Change an account's settings |
| DELETE | [`/v1/accounts/{id}`](https://docs.flung.dev/reference/api/delete-v1-accounts-id.md) | Disconnect an account |
| POST | [`/v1/accounts/{id}/refresh`](https://docs.flung.dev/reference/api/post-v1-accounts-id-refresh.md) | Refresh an account now |
| GET | [`/v1/accounts/{id}/boards`](https://docs.flung.dev/reference/api/get-v1-accounts-id-boards.md) | List Pinterest boards |
| GET | [`/v1/accounts/{id}/posting-options`](https://docs.flung.dev/reference/api/get-v1-accounts-id-posting-options.md) | Read what a post may choose |
| POST | [`/v1/connect-tokens`](https://docs.flung.dev/reference/api/post-v1-connect-tokens.md) | Make a connect token for a page |
| POST | [`/v1/connect/{platform}`](https://docs.flung.dev/reference/api/post-v1-connect-platform.md) | Start connecting an account |
| POST | [`/v1/accounts/{id}/reconnect`](https://docs.flung.dev/reference/api/post-v1-accounts-id-reconnect.md) | Start reconnecting an account |
| GET | [`/v1/connect-sessions/{id}`](https://docs.flung.dev/reference/api/get-v1-connect-sessions-id.md) | Get a connect session |

### Webhooks

| Method | Path | What it does |
|---|---|---|
| GET | [`/v1/webhook-endpoints`](https://docs.flung.dev/reference/api/get-v1-webhook-endpoints.md) | List webhook endpoints |
| POST | [`/v1/webhook-endpoints`](https://docs.flung.dev/reference/api/post-v1-webhook-endpoints.md) | Add a webhook endpoint |
| POST | [`/v1/webhook-endpoints/{id}/rotate-secret`](https://docs.flung.dev/reference/api/post-v1-webhook-endpoints-id-rotate-secret.md) | Rotate a signing secret |
| PATCH | [`/v1/webhook-endpoints/{id}`](https://docs.flung.dev/reference/api/patch-v1-webhook-endpoints-id.md) | Change an endpoint |
| DELETE | [`/v1/webhook-endpoints/{id}`](https://docs.flung.dev/reference/api/delete-v1-webhook-endpoints-id.md) | Delete a webhook endpoint |
| POST | [`/v1/webhook-endpoints/{id}/ping`](https://docs.flung.dev/reference/api/post-v1-webhook-endpoints-id-ping.md) | Send a test event |
| GET | [`/v1/webhook-endpoints/{id}/deliveries`](https://docs.flung.dev/reference/api/get-v1-webhook-endpoints-id-deliveries.md) | List deliveries |

### API keys

| Method | Path | What it does |
|---|---|---|
| GET | [`/v1/api-keys`](https://docs.flung.dev/reference/api/get-v1-api-keys.md) | List API keys |
| POST | [`/v1/api-keys`](https://docs.flung.dev/reference/api/post-v1-api-keys.md) | Create an API key |
| DELETE | [`/v1/api-keys/{id}`](https://docs.flung.dev/reference/api/delete-v1-api-keys-id.md) | Revoke an API key |

### Members

| Method | Path | What it does |
|---|---|---|
| GET | [`/v1/me`](https://docs.flung.dev/reference/api/get-v1-me.md) | Who is calling |
| GET | [`/v1/members`](https://docs.flung.dev/reference/api/get-v1-members.md) | List members |
| POST | [`/v1/members`](https://docs.flung.dev/reference/api/post-v1-members.md) | Add a member |
| DELETE | [`/v1/members/{userId}`](https://docs.flung.dev/reference/api/delete-v1-members-userid.md) | Remove a member |

### Media

| Method | Path | What it does |
|---|---|---|
| GET | [`/v1/media`](https://docs.flung.dev/reference/api/get-v1-media.md) | List files |
| POST | [`/v1/media`](https://docs.flung.dev/reference/api/post-v1-media.md) | Start an upload |
| PUT | [`/v1/media/{id}/parts/{partNumber}`](https://docs.flung.dev/reference/api/put-v1-media-id-parts-partnumber.md) | Upload one part |
| POST | [`/v1/media/{id}/complete`](https://docs.flung.dev/reference/api/post-v1-media-id-complete.md) | Finish a multipart upload |
| PUT | [`/v1/media/{id}/content`](https://docs.flung.dev/reference/api/put-v1-media-id-content.md) | Upload the bytes |
| POST | [`/v1/media/import`](https://docs.flung.dev/reference/api/post-v1-media-import.md) | Import a file from a URL |
| GET | [`/v1/media/{id}`](https://docs.flung.dev/reference/api/get-v1-media-id.md) | Get a file |
| DELETE | [`/v1/media/{id}`](https://docs.flung.dev/reference/api/delete-v1-media-id.md) | Delete a file |

### Templates

| Method | Path | What it does |
|---|---|---|
| GET | [`/v1/templates`](https://docs.flung.dev/reference/api/get-v1-templates.md) | List templates |
| POST | [`/v1/templates`](https://docs.flung.dev/reference/api/post-v1-templates.md) | Create a template |
| GET | [`/v1/templates/{id}`](https://docs.flung.dev/reference/api/get-v1-templates-id.md) | Get a template |
| PATCH | [`/v1/templates/{id}`](https://docs.flung.dev/reference/api/patch-v1-templates-id.md) | Change a template |
| DELETE | [`/v1/templates/{id}`](https://docs.flung.dev/reference/api/delete-v1-templates-id.md) | Delete a template |
| POST | [`/v1/templates/{id}/deploy`](https://docs.flung.dev/reference/api/post-v1-templates-id-deploy.md) | Schedule a post from a template |

### Variables

| Method | Path | What it does |
|---|---|---|
| GET | [`/v1/variables`](https://docs.flung.dev/reference/api/get-v1-variables.md) | List variables |
| PUT | [`/v1/variables/{name}`](https://docs.flung.dev/reference/api/put-v1-variables-name.md) | Set a variable |
| DELETE | [`/v1/variables/{name}`](https://docs.flung.dev/reference/api/delete-v1-variables-name.md) | Delete a variable |

### Feeds

| Method | Path | What it does |
|---|---|---|
| GET | [`/v1/feeds`](https://docs.flung.dev/reference/api/get-v1-feeds.md) | List feeds |
| POST | [`/v1/feeds`](https://docs.flung.dev/reference/api/post-v1-feeds.md) | Follow an RSS or Atom feed |
| PATCH | [`/v1/feeds/{id}`](https://docs.flung.dev/reference/api/patch-v1-feeds-id.md) | Change a feed |
| DELETE | [`/v1/feeds/{id}`](https://docs.flung.dev/reference/api/delete-v1-feeds-id.md) | Stop following a feed |

### Platforms

| Method | Path | What it does |
|---|---|---|
| GET | [`/v1/platforms`](https://docs.flung.dev/reference/api/get-v1-platforms.md) | List platforms and their limits |
| GET | [`/v1/posting-times`](https://docs.flung.dev/reference/api/get-v1-posting-times.md) | Suggest when to post |

### Analytics

| Method | Path | What it does |
|---|---|---|
| GET | [`/v1/usage`](https://docs.flung.dev/reference/api/get-v1-usage.md) | API requests per credential per day |
| GET | [`/v1/stats`](https://docs.flung.dev/reference/api/get-v1-stats.md) | Workspace statistics |

### Inbox

| Method | Path | What it does |
|---|---|---|
| GET | [`/v1/inbox`](https://docs.flung.dev/reference/api/get-v1-inbox.md) | List comments and mentions |
| GET | [`/v1/inbox/{id}`](https://docs.flung.dev/reference/api/get-v1-inbox-id.md) | Get an inbox item |
| PATCH | [`/v1/inbox/{id}`](https://docs.flung.dev/reference/api/patch-v1-inbox-id.md) | Mark an item read, unread or archived |
| POST | [`/v1/inbox/{id}/reply`](https://docs.flung.dev/reference/api/post-v1-inbox-id-reply.md) | Reply publicly |
| POST | [`/v1/accounts/{id}/inbox/sync`](https://docs.flung.dev/reference/api/post-v1-accounts-id-inbox-sync.md) | Read an account's inbox now |

### Experience

| Method | Path | What it does |
|---|---|---|
| GET | [`/v1/experience`](https://docs.flung.dev/reference/api/get-v1-experience.md) | Read XP, level and achievements |
| GET | [`/v1/leaderboard`](https://docs.flung.dev/reference/api/get-v1-leaderboard.md) | Read the leaderboard |
| PUT | [`/v1/leaderboard/entry`](https://docs.flung.dev/reference/api/put-v1-leaderboard-entry.md) | Join the leaderboard |
| DELETE | [`/v1/leaderboard/entry`](https://docs.flung.dev/reference/api/delete-v1-leaderboard-entry.md) | Leave the leaderboard |

## See also

| Doc | Why |
|---|---|
| [Schemas](https://docs.flung.dev/reference/api/schemas.md) | Every request and response type |
| [Errors](https://docs.flung.dev/reference/api/errors.md) | Every error code |
| [TypeScript SDK](https://docs.flung.dev/reference/sdk.md) | The same calls, typed, with retries |
| [MCP tools](https://docs.flung.dev/reference/mcp.md) | The same operations for AI agents |
