# Create group

Creates a group.

```http
POST https://api.pozy.ai/v1/account-groups
```

- Area: Accounts & connections / Account Groups
- Auth: Authorization: Bearer pz_live_...

## Request body

Content type: `application/json`

- `name`, string, required
- `accountIds`, array of string, required
- `profileId`, string

## Example request

```bash
curl -X POST "https://api.pozy.ai/v1/account-groups" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Acme",
  "accountIds": [
    "string"
  ]
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/account-groups", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    name: "Acme",
    accountIds: [
      "string"
    ]
  }),
});
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/account-groups",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "name": "Acme",
        "accountIds": [
            "string",
        ],
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 201

- `message`, string
- `group`, object
  - `_id`, string
  - `name`, string
  - `accountIds`, array of string

```json
{
  "message": "Hello from Pozy",
  "group": {
    "_id": "635d87e261ae344ef27fd1df",
    "name": "Acme",
    "accountIds": [
      "string"
    ]
  }
}
```
