Accounts
Disconnect an account
Deletes the stored tokens.
DELETE
/v1/accounts/{id}TL;DR
| Question | Answer |
|---|---|
| What does it do? | Disconnect an account. |
| What does it need? | An API key, an OAuth access token, or a connect token (this is one of the calls a connect token may make). |
| What does it take? | id in the path. |
| What does it return? | Status 200 with a body of type Account. |
| In the SDK? | flung.accounts.disconnect() |
| As an MCP tool? | disconnect_account |
| What can go wrong? | 401 Missing, unknown, revoked or expired API key; 404 No such account in this workspace; 422 The request failed validation; 429 Too many requests for this credential; wait for retry-after seconds. Every failure has the same error shape. |
What it does
Deletes the stored tokens. The account stays listed as disconnected so past posts keep their results.
Example
bash
curl -X DELETE 'https://api.flung.dev/v1/accounts/acct_aaaaaaaaaaaaaaaaaaaaaaaa' \ --header "Authorization: Bearer $FLUNG_API_KEY"ts
import { Flung } from '@flung.dev/sdk'
const flung = new Flung({ apiKey: process.env.FLUNG_API_KEY! })const result = await flung.accounts.disconnect({ id: 'acct_aaaaaaaaaaaaaaaaaaaaaaaa',})js
const response = await fetch('https://api.flung.dev/v1/accounts/acct_aaaaaaaaaaaaaaaaaaaaaaaa', { method: 'DELETE', headers: { 'Authorization': `Bearer ${process.env.FLUNG_API_KEY}`, },})if (!response.ok) throw new Error((await response.json()).error.message)const result = await response.json()A successful answer looks like this:
json
{ "id": "acct_aaaaaaaaaaaaaaaaaaaaaaaa", "platform": "x", "platformUserId": "string", "username": "string", "profileId": "string", "status": "active", "renewal": "automatic", "tokenExpiresAt": "2026-11-01T09:00:00.000Z", "reconnectBy": "2026-11-01T09:00:00.000Z", "defaultBoard": { "id": "string", "name": "string" }, "inbox": { "enabled": true, "readAt": "2026-11-01T09:00:00.000Z", "error": "string" }, "createdAt": "2026-11-01T09:00:00.000Z", "updatedAt": "2026-11-01T09:00:00.000Z"}Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes |
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | The disconnected account. | Account |
| 401 | Missing, unknown, revoked or expired API key. | Error |
| 404 | No such account in this workspace. | Error |
| 422 | The request failed validation. | Error |
| 429 | Too many requests for this credential; wait for retry-after seconds. | Error |
Response body
A 200 answer has the type Account.
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
platform | Platform | yes | |
platformUserId | string | yes | |
username | string | null | yes | |
profileId | string | null | yes | |
status | "active" | "needs_reconnect" | "disconnected" | yes | needs_reconnect: the platform refused the token; start a reconnect. |
renewal | "automatic" | "manual" | "not_needed" | yes | automatic: Flung refreshes the token before it expires, until reconnectBy if set. manual: only a reconnect renews it, by reconnectBy. not_needed: the token does not expire. |
tokenExpiresAt | string | null | yes | When the current access token expires. Flung renews automatic ones about a day before. |
reconnectBy | string | null | yes | The last moment the account works without a reconnect; null when it renews indefinitely. Flung sends account.reconnect_required_soon a week before. |
defaultBoard | object | null | yes | Pinterest only: where pins go unless a post picks another board. |
defaultBoard.id | string | yes | |
defaultBoard.name | string | null | yes | |
inbox | object | yes | Reading comments and mentions into GET /v1/inbox. |
inbox.enabled | boolean | null | yes | Whether comments and mentions are read. null is the platform's default: on, except X, where reading costs money. |
inbox.readAt | string | null | yes | |
inbox.error | string | null | yes | Why the last read failed, such as a missing permission. |
createdAt | string | yes | |
updatedAt | string | yes |
See also
| Doc | Why |
|---|---|
| API reference | Every endpoint |
| Schemas | Every request and response type |
| Errors | Every error code and what to do about it |
disconnect_account | The same operation as an MCP tool |