# Instagram accounts

> The Instagram accounts a Meta ad account can run ads as.

Canonical: <https://www.tryadeli.com/docs/api/ads/list-instagram-accounts>

`GET https://app.tryadeli.com/api/v1/ads/instagram-accounts`

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

**Meta Ads.** The Instagram accounts an ad account can run ads as. Pass an
`id` as `instagramAccountId` to [Create campaign](https://www.tryadeli.com/docs/api/ads/create-campaign)
to show the ad as that account on Instagram, or to boost one of its posts.
Adeli reads them from the ad account with the Meta Ads connection's own Ads
permissions. If Meta asks for `instagram_basic`, which the Meta Ads connection
does not request today, the response is `403 permission_required` naming it.

**Query parameters**

| Name          | Type     | Required | Description                                      |
| ------------- | -------- | -------- | ------------------------------------------------ |
| `adAccountId` | `string` | Yes      | A Meta ad account id.                            |
| `accountId`   | `uuid`   |          | The Meta Ads account. Defaults to the profile's. |

## Request examples

**cURL**

```bash
curl "https://app.tryadeli.com/api/v1/ads/instagram-accounts?adAccountId=act_1234567890&accountId=00000000-0000-0000-0000-000000000000" \
  -H "Authorization: Bearer $ADELI_API_KEY"
```

**JavaScript**

```javascript
const response = await fetch("https://app.tryadeli.com/api/v1/ads/instagram-accounts?adAccountId=act_1234567890&accountId=00000000-0000-0000-0000-000000000000", {
  headers: {
    Authorization: `Bearer ${process.env.ADELI_API_KEY}`,
  },
});
console.log(await response.json());
```

**Python**

```python
import os

import requests

response = requests.get(
    "https://app.tryadeli.com/api/v1/ads/instagram-accounts",
    headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"},
    params={
        "adAccountId": "act_1234567890",
        "accountId": "00000000-0000-0000-0000-000000000000",
    },
)
print(response.json())
```

## Responses

### 200

```json
{
  "platform": "meta_ads",
  "accountId": "00000000-0000-0000-0000-000000000000",
  "adAccountId": "act_1234567890",
  "instagramAccounts": [
    { "id": "17841400000000001", "username": "acmecoffee", "avatarUrl": null }
  ]
}
```

### 400

```json
{
  "error": {
    "code": "invalid_request",
    "message": "adAccountId is required"
  }
}
```
