# Create invite token

Creates an invite token.

```http
POST https://api.pozy.ai/v1/invite/tokens
```

- Area: Workspace / Invites
- Auth: Authorization: Bearer pz_live_...

## Request body

Content type: `application/json`

- `scope`, string, required: One of `all`, `profiles`
- `profileIds`, array of string
- `role`, string: One of `admin`, `member`, `billing_admin`, `viewer`. Default `member`
- `disabledResourceGroups`, array of string: Each item: one of `publishing`, `engagement`, `messages`, `contacts`, `analytics`, `ads`, `telephony`, `accounts`, `billing`, `webhooks`, `commerce`
- `readOnly`, boolean
- `email`, string (email): Optional. Pozy emails the invitation to this address.

## Example request

```bash
curl -X POST "https://api.pozy.ai/v1/invite/tokens" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "scope": "all"
}'
```

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

## Response 201

- `token`, string
- `scope`, string
- `invitedProfileIds`, array of string
- `disabledResourceGroups`, array of string
- `expiresAt`, string (date-time)
- `inviteUrl`, string (URL)
- `role`, string: One of `admin`, `member`, `billing_admin`, `viewer`
- `email`, string (email): Can be null
- `emailSent`, boolean: True when Pozy emailed the invitation. False when no email address was given or the email could not be sent: share inviteUrl yourself.

```json
{
  "token": "string",
  "scope": "string",
  "invitedProfileIds": [
    "string"
  ],
  "disabledResourceGroups": [
    "string"
  ],
  "expiresAt": "2026-10-02T09:00:00.000Z",
  "inviteUrl": "https://pozy.ai/media/example-1.jpg",
  "role": "admin",
  "email": "alex@example.com",
  "emailSent": true
}
```
