# Create a collection

`POST /v1/collections`

Creates an empty collection in your organization's default workspace.
Add images with [Upload images to a collection](/api/collections/uploadCollectionImages).

Names are unique within your default workspace: a name another
collection there already holds answers `409 COLLECTION_NAME_EXISTS`.

With a `product_category_id`, the collection is scored against the
category's own Vizit benchmark and against `default_benchmark` when
one is set. Those scorings are requested in the background and never
fail the create.

## Request Body

### application/json

- **object**
  - `name` (string, required) — Collection name, unique within your default workspace. Surrounding
whitespace is trimmed and a blank name is rejected.

  - `image_type` (enum: "hero" | "carousel", required)
  - `product_category_id` (any) — Category the collection's images are scored under. Must be one
returned by [List product categories](/api/product-details/listProductCategories).

  - `product_title` (any) — Product title used when scoring the collection's hero images. Surrounding whitespace is trimmed and a blank title means none.
  - `default_benchmark` (any) — Scored against as soon as the collection has a product category.
  - `asset_type` (any) — Label for a collection of Other carousel assets. Surrounding
whitespace is trimmed and a blank label means none. A `hero`
collection cannot have one (`422 HERO_ASSET_TYPE`).


## Responses

### 200 — The new collection

**application/json**

- **object** — A collection: a set of your own images scored together against a
benchmark. Collections live in your organization's default workspace.

  - `id` (string, required)
  - `name` (string, required)
  - `image_type` (enum: "hero" | "carousel", required) — The image type the collection holds. A collection of Other assets reads `carousel`.
  - `asset_type` (any, required) — Label of a collection of Other carousel assets; `null` for a hero or standard carousel collection.
  - `product_category_id` (any, required)
  - `image_count` (integer, required) — Images in the collection.
  - `last_scoring` (any, required) — The scoring last selected for the collection; `null` before the first one.

### 400 — Check `error_code`:
  - NO_DEFAULT_PORTFOLIO: your organization has no default portfolio
  - NO_DEFAULT_WORKSPACE: your default portfolio has no default workspace
  - CATEGORY_NOT_IN_ORG_ICP: `product_category_id` is outside your organization's categories
  - BENCHMARK_SCOPE_MISMATCH: the custom benchmark's scope is not the collection's `image_type`
  - RETAILER_MISMATCH: the product category has no category at the requested retailer


**application/json**

- **object** — Standardized error format for all `/v1/*` endpoints. `error_code` is a
stable SCREAMING_SNAKE_CASE identifier clients can switch on.

  - `detail` (string) — Human-readable error message
  - `status_code` (integer) — HTTP status code
  - `error_code` (string) — Stable machine-readable error code
  - `request_id` (any) — Request identifier for correlation
  - `extra` (any) — Endpoint-specific additional context. For example,
IMAGE_DOWNLOAD_FAILED populates extra.failed_urls with per-URL
failure reasons so clients can triage bulk submissions.

  - `timestamp` (string)

### 401 — Missing or invalid Bearer token

### 404 — Check `error_code`:
  - NOT_FOUND: custom benchmarks are not enabled for your organization
  - PRODUCT_CATEGORY_NOT_FOUND: `product_category_id` does not exist
  - BENCHMARK_NOT_FOUND: `default_benchmark.benchmark_id` is not a custom benchmark in your default workspace


**application/json**

- **object** — Standardized error format for all `/v1/*` endpoints. `error_code` is a
stable SCREAMING_SNAKE_CASE identifier clients can switch on.

  - `detail` (string) — Human-readable error message
  - `status_code` (integer) — HTTP status code
  - `error_code` (string) — Stable machine-readable error code
  - `request_id` (any) — Request identifier for correlation
  - `extra` (any) — Endpoint-specific additional context. For example,
IMAGE_DOWNLOAD_FAILED populates extra.failed_urls with per-URL
failure reasons so clients can triage bulk submissions.

  - `timestamp` (string)

### 409 — Another collection in your default workspace has this name (error_code COLLECTION_NAME_EXISTS)

**application/json**

- **object** — Standardized error format for all `/v1/*` endpoints. `error_code` is a
stable SCREAMING_SNAKE_CASE identifier clients can switch on.

  - `detail` (string) — Human-readable error message
  - `status_code` (integer) — HTTP status code
  - `error_code` (string) — Stable machine-readable error code
  - `request_id` (any) — Request identifier for correlation
  - `extra` (any) — Endpoint-specific additional context. For example,
IMAGE_DOWNLOAD_FAILED populates extra.failed_urls with per-URL
failure reasons so clients can triage bulk submissions.

  - `timestamp` (string)

### 422 — Check `error_code`:
  - HERO_ASSET_TYPE: a `hero` collection was given an `asset_type`
  - INVALID_SCORING_PAIR: `default_benchmark` has not exactly one of `benchmark_id` or `retailer`
  - VALIDATION_ERROR: request validation failed


**application/json**

- **object** — Standardized error format for all `/v1/*` endpoints. `error_code` is a
stable SCREAMING_SNAKE_CASE identifier clients can switch on.

  - `detail` (string) — Human-readable error message
  - `status_code` (integer) — HTTP status code
  - `error_code` (string) — Stable machine-readable error code
  - `request_id` (any) — Request identifier for correlation
  - `extra` (any) — Endpoint-specific additional context. For example,
IMAGE_DOWNLOAD_FAILED populates extra.failed_urls with per-URL
failure reasons so clients can triage bulk submissions.

  - `timestamp` (string)

### 429 — Rate limit exceeded for this organization
