# Disconnect account

> Delete Adeli's credentials and cached history for one connection.

Canonical: <https://www.tryadeli.com/docs/api/accounts/disconnect-account>

`DELETE https://app.tryadeli.com/api/v1/profiles/{profileId}/accounts/{accountId}`

Authorization: `Bearer <API key>` — see [Authentication](https://www.tryadeli.com/docs/authentication)

Deletes Adeli's stored credentials and cached history for that connection. It
never deletes the account, its posts, or its messages on the provider.

For TikTok, YouTube, X, and Bluesky, Adeli first tries to revoke the authorization with the
provider and then guarantees local deletion either way. X usage already recorded
stays on your bill. `revocationFailed: true`
means the local credential is gone but the provider may still list the
authorization, and the customer can remove it from their TikTok settings or
their [Google account permissions](https://security.google.com/settings/security/permissions).

**Path parameters**

| Name        | Type   | Required | Description                                                                           |
| ----------- | ------ | -------- | ------------------------------------------------------------------------------------- |
| `profileId` | `uuid` | Yes      | A profile in your organization. Any other value returns 404 profile\_not\_found.      |
| `accountId` | `uuid` | Yes      | A connected account in that profile. Any other value returns 404 account\_not\_found. |

**Errors** — `401 unauthorized`, `400 invalid_request`, `404 profile_not_found`,
`404 account_not_found`, `502 database_error`.

## Request examples

**cURL**

```bash
curl --fail-with-body -X DELETE "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts/00000000-0000-0000-0000-000000000000" \
  -H "Authorization: Bearer $ADELI_API_KEY"
```

**JavaScript**

```javascript
const response = await fetch("https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts/00000000-0000-0000-0000-000000000000", {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${process.env.ADELI_API_KEY}`,
  },
});
console.log(await response.json());
```

**Python**

```python
import os

import requests

response = requests.delete(
    "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts/00000000-0000-0000-0000-000000000000",
    headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"},
)
print(response.json())
```

## Responses

### 200

```json
{ "id": "00000000-0000-0000-0000-000000000000", "disconnected": true }
```

### 200

```json
{ "id": "00000000-0000-0000-0000-000000000001", "disconnected": true, "revocationFailed": false }
```

### 404

```json
{
  "error": {
    "code": "account_not_found",
    "message": "Account not found"
  }
}
```
