# Create a collection

Creates a collection. Works with Shopify and WooCommerce accounts.

```http
POST https://api.pozy.ai/v1/commerce/collections
```

- Area: Commerce / Commerce
- Auth: Authorization: Bearer pz_live_...

## Request body

Content type: `application/json`

- `accountId`, string, required
- `title`, string, required
- `descriptionHtml`, string
- `handle`, string
- `sortOrder`, string: One of `manual`, `best_selling`, `alpha_asc`, `alpha_desc`, `price_asc`, `price_desc`, `created`, `created_desc`, `most_relevant`
- `seo`, object
  - `title`, string
  - `description`, string
- `image`, object
  - `url`, string (URL), required
  - `altText`, string
- `productIds`, array of string: Up to 250 items

## Example request

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

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

## Response 201

- `collection`, object
  - `id`, string
  - `accountId`, string
  - `platform`, string: One of `shopify`, `woocommerce`
  - `title`, string
  - `handle`, string: Can be null
  - `descriptionHtml`, string: Can be null
  - `image`, object
    - one of: Commerce Image
      - `id`, string: Can be null
      - `url`, string
      - `altText`, string: Can be null
  - `sortOrder`, string: One of `manual`, `best_selling`, `alpha_asc`, `alpha_desc`, `price_asc`, `price_desc`, `created`, `created_desc`, `most_relevant`
  - `productCount`, integer: Can be null
  - `seo`, object
    - `title`, string: Can be null
    - `description`, string: Can be null
  - `updatedAt`, string (date-time): Can be null
  - `platformData`, object: Can be null

```json
{
  "collection": {
    "id": "6bfebd43ddc270f6d2c56fc5",
    "accountId": "696e0b682d0a31188e7a2ba9",
    "platform": "shopify",
    "title": "Launch day",
    "handle": "acme",
    "descriptionHtml": "string",
    "image": {
      "id": "6bfebd43ddc270f6d2c56fc5",
      "url": "https://pozy.ai/media/example-1.jpg",
      "altText": "Hello from Pozy"
    },
    "sortOrder": "manual",
    "productCount": 42,
    "seo": {
      "title": "Launch day",
      "description": "A short description"
    },
    "updatedAt": "2026-10-02T09:00:00.000Z",
    "platformData": {}
  }
}
```
