> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chataigne.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Select the active catalog

> Choose which location catalog the AI uses for ordering.

A location may have several attached catalogs, but the AI orders from one active catalog. Select it after the catalog exists and, for a complete snapshot, after its synchronization has succeeded.

```http theme={null}
PUT /v1/locations/{location_id}/active_catalog
```

This operation changes the location-wide selection only. It does not copy, modify, or delete either catalog.

## Select a catalog

Send the catalog’s location-scoped public `id`, as returned by the Catalogs API. Do not send an internal Chataigne database ID.

```bash theme={null}
curl https://server.chataigne.ai/v1/locations/loc_r8v4n2c6tz/active_catalog \
  -X PUT \
  -H "x-api-key: $CHATAIGNE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "catalog_id": "delivery-menu"
  }'
```

The request requires `catalog.write`. The API key must authorize the target location.

A successful request returns `200 OK` and echoes the selected public ID:

```json theme={null}
{
  "object": "active_catalog",
  "location_id": "loc_r8v4n2c6tz",
  "catalog_id": "delivery-menu"
}
```

Replacing the selection with the same `catalog_id` is allowed. To roll back, send the public ID of the previous catalog.

## Location scoping

Catalog IDs are unique only within a location. Chataigne resolves `catalog_id` against the location in the URL and stores the matching private relationship internally.

A catalog that does not exist or is not attached to that location returns `404 catalog_not_found`. This fail-closed behavior prevents a location-scoped key from selecting another location’s catalog.

## Validation and errors

| Status | Code                       | Cause                                                                |
| ------ | -------------------------- | -------------------------------------------------------------------- |
| `400`  | `catalog_validation_error` | The body is not an object, or `catalog_id` is missing or invalid.    |
| `400`  | `parameter_not_allowed`    | The body contains a field other than `catalog_id`.                   |
| `404`  | `location_not_found`       | The target location does not exist.                                  |
| `404`  | `catalog_not_found`        | The public catalog ID is unknown or is not attached to the location. |

The generated **Catalogs API** reference in the sidebar contains the complete request and response schemas.
