# Create a Discord public thread

Creates a Discord public thread.

```http
POST https://api.pozy.ai/v1/discord/channels/{channelId}/threads
```

- Area: Messaging / Discord
- Auth: Authorization: Bearer pz_live_...
- Coming soon: Discord accounts cannot be connected yet (GET /v1/connect/discord returns 403 feature_not_available)

## Path parameters

- `channelId` (string, required)

## Query parameters

- `accountId` (string, required)

## Request body

Content type: `application/json`

- `name`, string, required: 1 to 100 characters
- `messageId`, string
- `autoArchiveDuration`, integer: One of `60`, `1440`, `4320`, `10080`

## Example request

```bash
curl -X POST "https://api.pozy.ai/v1/discord/channels/6750a975638e9df035530f04/threads?accountId=696e0b682d0a31188e7a2ba9" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Acme"
}'
```

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

## Response 200

- `data`, object
  - `id`, string
  - `name`, string

```json
{
  "data": {
    "id": "6bfebd43ddc270f6d2c56fc5",
    "name": "Acme"
  }
}
```
