This page describes how to view, edit, delete, export, and import serving
controls.

For general information about serving controls and instructions on how to create
serving controls, see [About serving controls](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/serving-control-rules.md.txt) and
[Create serving controls](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/create-controls.md.txt).

## View and edit serving controls

You can view serving controls for AI Commerce Search using the console
and the API.

### View and edit serving controls in the console

The
[**Serving Controls** tab](https://console.cloud.google.com/ai/retail/catalogs/default_catalog/controls/serving)
of the Controls page lists all of your serving controls and their associated
serving configs. Click the
**Edit control** icon for a control to change
its settings and associated serving configs in the **Edit control**
panel. Click the **Delete control** icon for
a control to delete it, which also removes it from all serving configs.

You can also see and edit the controls for a specific serving config on
the [**Serving Configs** page](https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs/).
Click a serving config to see its **Details** page, which lists all
serving controls for that configuration. Click the
**Edit control** icon for a control to change
its settings in the **Edit control** panel. Click the
**Remove control** icon to
dissociate the control from the serving config (this does not delete the
control).


It takes a few minutes for newly created or updated controls to be ready to
serve live traffic. You can test if your changes have been applied on
the console [**Evaluate** page](https://console.cloud.google.com/ai/retail/catalogs/default_catalog/evaluate/).

### View serving controls inline

To see a single serving control inline, use `Control.get`.

For more about this method, see the
[`Control.get` API reference](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2beta/projects.locations.catalogs.controls/get.md.txt).

```bash
curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
'https://retail.googleapis.com/v2beta/projects/PROJECT_NUMBER/locations/global/catalogs/default_catalog/controls/CONTROL_ID'
```

To list multiple serving controls inline, use `Controls.list`.

Optionally, you can use the parameter `pageSize` to set a maximum number of
results to return. If more results are available, the `list` response includes a
page token. You can pass a page token in the `pageToken` parameter of a `list`
request to retrieve the next page of results.

To list only the controls associated with a certain serving config, use
the `filter` query parameter to specify the serving config ID.

For more about this method, see the
[`Control.list` API reference](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2beta/projects.locations.catalogs.controls/list.md.txt).

```bash
curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
'https://retail.googleapis.com/v2beta/projects/PROJECT_NUMBER/locations/global/catalogs/default_catalog/controls?pageSize=PAGE_SIZE&pageToken=PAGE_TOKEN&filter=servingConfig=SERVING_CONFIG_ID
```

### Patch serving controls inline

To update fields in a serving control, use `Controls.patch`
and include an instance of `Control` in the request body. Specify the
fields to update with the `updateMask` parameter, or leave it unset to update
all supported fields.

For more about this method, see the
[`Controls.patch` API reference](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2beta/projects.locations.catalogs.controls/patch.md.txt).

```bash
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d '{
      "name": "projects/PROJECT_NUMBER/locations/global/catalogs/default_catalog/controls/CONTROL_ID",
      "FIELD_NAME_1": "NEW_FIELD_VALUE_1"
      "FIELD_NAME_2": "NEW_FIELD_VALUE_2"
    }' \
'https://retail.googleapis.com/v2beta/projects/PROJECT_NUMBER/locations/global/catalogs/default_catalog/controls/CONTROL_ID?updateMask=FIELD_NAME_1,FIELD_NAME_2'
```

### Add controls to serving configs inline

To add a control to a serving config, use `ServingConfig.addControl`.

For more about this method, see the
[`ServingConfig.addControl` API reference](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2beta/projects.locations.catalogs.servingConfigs/addControl.md.txt).

For an example of this method, see
[Manage serving configs](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/manage-configs.md.txt).

### Remove controls from serving configs inline

To remove a control from a serving config, use
`ServingConfig.removeControl`.

For more about this method, see the
[`ServingConfig.addControl` API reference](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2beta/projects.locations.catalogs.servingConfigs/addControl.md.txt).

For an example of this method, see
[Manage serving configs](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/manage-configs.md.txt).

## Delete a serving control

You can delete a serving control from the console or inline using the
`Controls.delete` method.

### Delete a serving control in the console

Delete a serving control to remove that control from all serving configs
that are using it.

1.
   Go to the **Controls** page in the AI Commerce Search in Gemini Enterprise for Customer Experience console.  


   [Go to the Controls page](https://console.cloud.google.com/ai/retail/catalogs/default_catalog/controls/)

2. In the table row of the control you plan to remove, click
   **Delete**.

3. In the confirmation window, click **Delete** to complete the deletion.

### Delete a serving control inline

To delete serving controls inline, use `Controls.delete`.

For more about this method, see the
[`Controls.delete` API reference](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2beta/projects.locations.catalogs.controls/delete.md.txt).

```bash
curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
'https://retail.googleapis.com/v2beta/projects/PROJECT_NUMBER/locations/global/catalogs/default_catalog/controls/SERVING_CONTROL_ID'
```

## Export serving controls


> [!WARNING]
>
> **Preview**
>
>
> This feature is
>
> subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the
> [Service Specific
> Terms](https://docs.cloud.google.com/terms/service-terms#1).
>
> Pre-GA features are available "as is" and might have limited support.
>
> For more information, see the
> [launch stage descriptions](https://cloud.google.com/products/#product-launch-stages).

<br />

You can export your serving controls to a file in a Cloud Storage bucket.

There are two reasons that you might want to export and import serving controls:

- To move serving controls from one project to another.

- To perform a bulk edit on all or some serving controls. Export the serving
  controls, edit the exported file, and then import the file to change or add
  serving controls.

You can export and import through the AI Commerce Search in Gemini Enterprise for Customer Experience console.
When you export serving controls, you export all the serving controls in the
project.

To export serving controls, do the following:

1.
   Go to the **Controls** page in the AI Commerce Search in Gemini Enterprise for Customer Experience console.  


   [Go to the Controls page](https://console.cloud.google.com/ai/retail/catalogs/default_catalog/controls/)

2. On the **Serving controls** tab, click **Export controls**.

3. In the **Export Serving Controls** window, select the Cloud Storage bucket
   to which you want to export the controls file.

4. Click **Export**.

   The exported controls are saved to a NDJSON file in the selected bucket with
   a name in the following format:

   ```bash
   projects_PROJECT_ID_TIMESTAMP_exported_controls.ndjson
   ```
5. After the export operation completes, you can see the operation status in
   the **Bulk import, export, delete activities** list in the **Export
   activity** window. Open the **Export activity** window by clicking **Show**
   in the message window or by following the instructions in [See status for a
   specific integration operation](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/error-reporting#activity-panel).

## Import serving controls


> [!WARNING]
>
> **Preview**
>
>
> This feature is
>
> subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the
> [Service Specific
> Terms](https://docs.cloud.google.com/terms/service-terms#1).
>
> Pre-GA features are available "as is" and might have limited support.
>
> For more information, see the
> [launch stage descriptions](https://cloud.google.com/products/#product-launch-stages).

<br />

To add serving controls or modify existing ones in bulk, you can make your
changes in an exported controls file. You can then import them into
the original project or into a different
project.

Things to know about importing serving controls:

- You can't import a serving control file if it contains both
  search and recommendations serving controls.

- When you import serving controls, all the serving controls in the file become
  associated with the serving config that you specify on import. If a
  serving control is already associated with another serving config in
  the project, that association is also maintained.

To import serving controls, do the following:

1. Edit and review an exported serving control file and place the file in a
   Cloud Storage bucket. (To export serving controls, see the preceding task
   [Export serving controls](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/manage-controls.md.txt#export).)

   Ensure that the file contains only search serving controls or
   only recommendations serving controls. You cannot import a
   file that contains both types.
2.
   Go to the **Controls** page in the AI Commerce Search in Gemini Enterprise for Customer Experience console.  


   [Go to the Controls page](https://console.cloud.google.com/ai/retail/catalogs/default_catalog/controls/)

3. On the **Serving controls** tab, click **Import controls**.

4. In the **Import Serving Controls** window:

   1. Browse and select the
      Cloud Storage bucket and NDJSON file that contains the controls that you
      want to import.

   2. Select the serving config that you want to associate the imported serving
      controls with.

   3. Review the Import Preview plan. The controls that will be created are
      displayed on the **New** tab and the controls that will be
      modified are displayed on the **Modified** tab.

5. Click **Import**.

   A long-running operation is started to import the new and modified
   controls.
6. After the import operation completes, you can see the operation status in the
   **Controls** tab of the **Activity status** window. Open the **Activity
   status** window by clicking **Show** in the message window or by following
   the instructions in
   [See status for a specific integration operation](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/error-reporting.md.txt#activity-panel).