# Score a collection

`POST /v1/collections/{collection_id}/scorings`

Scores the collection's visible images under `product_category_id`
against exactly one of a custom benchmark (`benchmark_id`, of the
same scope as the collection) or a retailer's Vizit benchmark
(`retailer`). A custom benchmark needs `minimum_images` visible
images. The response is `202` with a scoring `id`; poll it with
[Retrieve a collection scoring](/api/collections/getCollectionScoring).

Repeating the request for the same pair within 5 minutes returns
the same scoring without queueing it again, so a retry is safe.

## Request Body

### application/json

- **object** — Send `product_category_id` with exactly one of `benchmark_id` or `retailer`.
  - `product_category_id` (string, required) — Category to score under. Must be one returned by
[List product categories](/api/product-details/listProductCategories).

  - `benchmark_id` (any) — A custom benchmark in your default workspace, of the same scope as
the collection's `image_type`.

  - `retailer` (any) — The retailer whose Vizit benchmark to use.

## Responses

### 202 — Scoring requested

**application/json**

- **object** — A requested scoring. Poll its status with the matching `GET .../scorings/{scoring_id}`
route. Exactly one of `benchmark_id` or `retailer` is set.

  - `id` (string, required) — The `scoring_id` to poll.
  - `benchmark_id` (any, required) — The custom benchmark scored against; `null` when `retailer` is set.
  - `retailer` (any, required) — The retailer whose Vizit benchmark is scored against; `null` for a custom benchmark.
  - `collection_id` (any, required) — The collection scored; `null` when a benchmark scores its own images.
  - `product_category_id` (string, required)
  - `status` (enum: "PROCESSING" | "COMPLETED" | "ERROR", required) — Lifecycle status shared by asynchronous operations: `PROCESSING` while
work is in flight, then `COMPLETED` or `ERROR`.

  - `requested_at` (string, required)
  - `total_images` (integer, required) — Images the scoring covers.
  - `enqueued_images` (integer, required) — Images queued for scoring when the request was answered; images already scored are not counted.

### 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_TOO_SMALL: the custom benchmark has fewer than `minimum_images` visible images
  - 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
  - CATEGORY_HAS_NO_AUDIENCES: the product category cannot be scored yet


**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
  - COLLECTION_NOT_FOUND: no such collection in your default workspace
  - PRODUCT_CATEGORY_NOT_FOUND: `product_category_id` does not exist
  - BENCHMARK_NOT_FOUND: `benchmark_id` is not a custom benchmark in your default workspace, or the retailer has no Vizit benchmark for the category


**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`:
  - INVALID_SCORING_PAIR: not exactly one of `benchmark_id` or `retailer`
  - VIZIT_POOL_NOT_SCORABLE: the retailer's Vizit benchmark has no scores to rank against
  - 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
