# Refresh tokens

> Refresh the OAuth tokens of every connection in a profile.

Canonical: <https://www.tryadeli.com/docs/api/accounts/refresh-tokens>

`POST https://app.tryadeli.com/api/v1/profiles/{profileId}/accounts/refresh`

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

Attempts an OAuth token refresh for every Instagram, TikTok, Facebook, and YouTube
connection in the profile. For YouTube it also re-reads the channel's title,
avatar, and counts. Takes no body. Each account appears in the response only after its new
token and expiry have been written, so a success here means the credential is
durable, not merely fetched.

> **Warning: This response is not a list of accounts**
>
> It uses the aggregate envelope with the `accounts` key, but the **elements are
> a different shape** — refresh results, not account records. Code that reuses an
> account parser here will not find `displayName` or `connectionStatus`.

**Path parameters**

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

Per-account error codes: `provider_not_configured`, `connection_expired`,
`account_not_found`, `provider_error`.

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

## Request examples

**cURL**

```bash
curl --fail-with-body -X POST "https://app.tryadeli.com/api/v1/profiles/00000000-0000-4000-8000-000000000001/accounts/refresh" \
  -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/refresh", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ADELI_API_KEY}`,
  },
});
console.log(await response.json());
```

**Python**

```python
import os

import requests

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

## Responses

### 200

```json
{
  "status": "partial",
  "accounts": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "accountId": "00000000-0000-0000-0000-000000000000",
      "profileId": "00000000-0000-4000-8000-000000000001",
      "platform": "instagram",
      "refreshed": true,
      "expiresAt": "2026-11-07T12:00:00.000Z"
    }
  ],
  "errors": [
    {
      "platform": "tiktok",
      "accountId": "00000000-0000-0000-0000-000000000001",
      "code": "connection_expired",
      "message": "TikTok requires reconnection"
    }
  ]
}
```

### 404

```json
{
  "error": {
    "code": "profile_not_found",
    "message": "Profile not found"
  }
}
```
