# Create conversation

Creates a conversation.

```http
POST https://api.pozy.ai/v1/inbox/conversations
```

- Area: Inbox / Messages
- Auth: Authorization: Bearer pz_live_...

## Request body

Content type: `application/json`

- `accountId`, string, required
- `participantId`, string
- `participantUsername`, string
- `message`, string
- `subject`, string: Up to 998 characters
- `cc`, array of string (email): Up to 50 items
- `skipDmCheck`, boolean: Default `false`
- `templateName`, string
- `category`, string: One of `utility`
- `linkPreview`, boolean: Default `true`
- `templateLanguage`, string
- `templateParams`, array of string
- `templateButtonParams`, array of object: Up to 10 items
  - `index`, integer, required: 0 to 9
  - `subType`, string, required: One of `url`, `copy_code`, `flow`
  - `value`, string, required
- `templateCards`, array of object: Up to 10 items
  - `cardIndex`, integer, required: 0 to 9
  - `params`, array of string
  - `headerMedia`, object
    - `type`, string, required: One of `image`, `video`, `document`
    - `link`, string
    - `id`, string
  - `buttons`, array of object: Up to 2 items
    - `index`, integer, required: 0 to 1
    - `subType`, string, required: One of `quick_reply`, `url`
    - `value`, string, required
- `headerMedia`, object
  - `type`, string, required: One of `image`, `video`, `document`
  - `link`, string
  - `id`, string
  - `filename`, string
- `headerLocation`, object
  - `latitude`, number, required
  - `longitude`, number, required
  - `name`, string
  - `address`, string

## Example request

```bash
curl -X POST "https://api.pozy.ai/v1/inbox/conversations" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "accountId": "696e0b682d0a31188e7a2ba9"
}'
```

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

## Response 201

- `success`, boolean
- `data`, object
  - `messageId`, string
  - `conversationId`, string
  - `participantId`, string
  - `participantName`, string: Can be null
  - `participantUsername`, string: Can be null

```json
{
  "success": true,
  "data": {
    "messageId": "62d191e7089bc48b8ea56b35",
    "conversationId": "6e525f3820fc636aa96d2ee9",
    "participantId": "6f0150243551cb6ee41f35e0",
    "participantName": "Acme",
    "participantUsername": "acme"
  }
}
```
