# Select the Page whose Instagram account to connect

Selects the Page whose Instagram account to connect.

```http
POST https://api.pozy.ai/v1/connect/instagram/select-account
```

- Area: Accounts & connections / Connect
- Auth: API key plus X-Connect-Token header

## Request body

Content type: `application/json`

- `profileId`, string, required
- `pageId`, string
- `pageIds`, array of string: At least 1 item. Up to 25 items
- `tempToken`, string
- `connectFlow`, string: Matches `^[a-f0-9]{32}$`
- `redirect_url`, string (URL)

## Example request

```bash
curl -X POST "https://api.pozy.ai/v1/connect/instagram/select-account" \
  -H "X-Connect-Token: $CONNECT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "profileId": "6a0b6573846efc28aaa9a3ff"
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/connect/instagram/select-account", {
  method: "POST",
  headers: {
    "X-Connect-Token": process.env.CONNECT_TOKEN!,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    profileId: "6a0b6573846efc28aaa9a3ff"
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.post(
    "https://api.pozy.ai/v1/connect/instagram/select-account",
    headers={"X-Connect-Token": os.environ["CONNECT_TOKEN"]},
    json={
        "profileId": "6a0b6573846efc28aaa9a3ff",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `message`, string
- `redirect_url`, string
- `adsAccountId`, string
- `account`, object
  - `accountId`, string
  - `platform`, string: One of `instagram`
  - `username`, string
  - `displayName`, string
  - `profilePicture`, string
  - `isActive`, boolean
  - `loginMethod`, string: One of `facebook_login`
- `accounts`, array of object
- `failed`, array of object
  - `id`, string
  - `code`, string
  - `message`, string

```json
{
  "message": "Hello from Pozy",
  "redirect_url": "https://pozy.ai/media/example-1.jpg",
  "adsAccountId": "689782c4c50e3b783a5acd69",
  "account": {
    "accountId": "696e0b682d0a31188e7a2ba9",
    "platform": "instagram",
    "username": "acme",
    "displayName": "Acme",
    "profilePicture": "string",
    "isActive": true,
    "loginMethod": "facebook_login"
  },
  "accounts": [
    {}
  ],
  "failed": [
    {
      "id": "6bfebd43ddc270f6d2c56fc5",
      "code": "string",
      "message": "Hello from Pozy"
    }
  ]
}
```
