This is the documentation for Recommendations AI, Retail Search, and the new Retail console. To use Retail Search in the restricted GA phase, contact Cloud sales.

If you are only using Recommendations AI, remain on the Recommendations console and refer to the Recommendations AI documentation.

Package google.cloud.retail.v2alpha

Index

CatalogService

Service for managing catalog configuration.

GetDefaultBranch

rpc GetDefaultBranch(GetDefaultBranchRequest) returns (GetDefaultBranchResponse)

Get which branch is currently default branch set by CatalogService.SetDefaultBranch method under a specified parent catalog.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

ListCatalogs

rpc ListCatalogs(ListCatalogsRequest) returns (ListCatalogsResponse)

Lists all the Catalogs associated with the project.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • retail.catalogs.list

For more information, see the IAM documentation.

SetDefaultBranch

rpc SetDefaultBranch(SetDefaultBranchRequest) returns (Empty)

Set a specified branch id as default branch. API methods such as SearchService.Search, ProductService.GetProduct, ProductService.ListProducts will treat requests using "default_branch" to the actual branch id set as default.

For example, if projects/*/locations/*/catalogs/*/branches/1 is set as default, setting SearchRequest.branch to projects/*/locations/*/catalogs/*/branches/default_branch is equivalent to setting SearchRequest.branch to projects/*/locations/*/catalogs/*/branches/1.

Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using projects/*/locations/*/catalogs/*/branches/default_branch as SearchRequest.branch to route the traffic to this staging branch.

CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one.

More specifically:

  • PredictionService will only return product IDs from branch {newBranch}.
  • SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set).
  • UserEventService will only join events with products from branch {newBranch}.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the catalog resource:

  • retail.catalogs.update

For more information, see the IAM documentation.

UpdateCatalog

rpc UpdateCatalog(UpdateCatalogRequest) returns (Catalog)

Updates the Catalogs.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • retail.catalogs.update

For more information, see the IAM documentation.

CompletionService

Auto-completion service for retail.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.

CompleteQuery

rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse)

Completes the specified prefix with keyword suggestions.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the catalog resource:

  • retail.catalogs.completeQuery

For more information, see the IAM documentation.

ImportCompletionData

rpc ImportCompletionData(ImportCompletionDataRequest) returns (Operation)

Bulk import of processed completion dataset.

Request processing may be synchronous. Partial updating is not supported.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • retail.catalogs.import

For more information, see the IAM documentation.

PredictionService

Service for making recommendation prediction.

Predict

rpc Predict(PredictRequest) returns (PredictResponse)

Makes a recommendation prediction.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the placement resource:

  • retail.placements.predict

For more information, see the IAM documentation.

ProductService

Service for ingesting Product information of the customer's website.

AddFulfillmentPlaces

rpc AddFulfillmentPlaces(AddFulfillmentPlacesRequest) returns (Operation)

Incrementally adds place IDs to Product.fulfillment_info.place_ids.

This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the Product queried by GetProduct or ListProducts.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the product resource:

  • retail.products.update

For more information, see the IAM documentation.

AddLocalInventories

rpc AddLocalInventories(AddLocalInventoriesRequest) returns (Operation)

Updates local inventory information for a Product at a list of places, while respecting the last update timestamps of each inventory field.

This process is asynchronous and does not require the Product to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the Product queried by GetProduct or ListProducts.

Store inventory information can only be modified using this method. CreateProduct and UpdateProduct has no effect on local inventories.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact Cloud sales if you are interested in using Retail Search.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the product resource:

  • retail.products.update

For more information, see the IAM documentation.

CreateProduct

rpc CreateProduct(CreateProductRequest) returns (Product)

Creates a Product.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • retail.products.create

For more information, see the IAM documentation.

DeleteProduct

rpc DeleteProduct(DeleteProductRequest) returns (Empty)

Deletes a Product.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • retail.products.delete

For more information, see the IAM documentation.

GetProduct

rpc GetProduct(GetProductRequest) returns (Product)

Gets a Product.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • retail.products.get

For more information, see the IAM documentation.

ImportProducts

rpc ImportProducts(ImportProductsRequest) returns (Operation)

Bulk import of multiple Products.

Request processing may be synchronous. No partial updating is supported. Non-existing items are created.

Note that it is possible for a subset of the Products to be successfully updated.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • retail.products.import

For more information, see the IAM documentation.

ListProducts

rpc ListProducts(ListProductsRequest) returns (ListProductsResponse)

Gets a list of Products.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • retail.products.list

For more information, see the IAM documentation.

RemoveFulfillmentPlaces

rpc RemoveFulfillmentPlaces(RemoveFulfillmentPlacesRequest) returns (Operation)

Incrementally removes place IDs from a Product.fulfillment_info.place_ids.

This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the Product queried by GetProduct or ListProducts.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the product resource:

  • retail.products.update

For more information, see the IAM documentation.

RemoveLocalInventories

rpc RemoveLocalInventories(RemoveLocalInventoriesRequest) returns (Operation)

Remove local inventory information for a Product at a list of places at a removal timestamp.

This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the Product queried by GetProduct or ListProducts.

Store inventory information can only be removed using this method. CreateProduct and UpdateProduct has no effect on local inventories.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact Cloud sales if you are interested in using Retail Search.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the product resource:

  • retail.products.update

For more information, see the IAM documentation.

SetInventory

rpc SetInventory(SetInventoryRequest) returns (Operation)

Updates inventory information for a Product while respecting the last update timestamps of each inventory field.

This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the Product queried by GetProduct or ListProducts.

When inventory is updated with CreateProduct and UpdateProduct, the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the CreateProduct or UpdateProduct request.

If no inventory fields are set in CreateProductRequest.product, then any pre-existing inventory information for this product will be used.

If no inventory fields are set in [UpdateProductRequest.set_mask][], then any existing inventory information will be preserved.

Pre-existing inventory information can only be updated with SetInventory, AddFulfillmentPlaces, and RemoveFulfillmentPlaces.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • retail.products.update

For more information, see the IAM documentation.

UpdateProduct

rpc UpdateProduct(UpdateProductRequest) returns (Product)

Updates a Product.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • retail.products.update

For more information, see the IAM documentation.

SearchService

Service for search.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.

Search

rpc Search(SearchRequest) returns (SearchResponse)

Performs a search.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the placement resource:

  • retail.placements.search

For more information, see the IAM documentation.

UserEventService

Service for ingesting end user actions on the customer website.

CollectUserEvent

rpc CollectUserEvent(CollectUserEventRequest) returns (HttpBody)

Writes a single user event from the browser. This uses a GET request to due to browser restriction of POST-ing to a 3rd party domain.

This method is used only by the Retail API JavaScript pixel and Google Tag Manager. Users should not call this method directly.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

ImportUserEvents

rpc ImportUserEvents(ImportUserEventsRequest) returns (Operation)

Bulk import of User events. Request processing might be synchronous. Events that already exist are skipped. Use this method for backfilling historical user events.

Operation.response is of type ImportResponse. Note that it is possible for a subset of the items to be successfully inserted. Operation.metadata is of type ImportMetadata.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • retail.userEvents.import

For more information, see the IAM documentation.

PurgeUserEvents

rpc PurgeUserEvents(PurgeUserEventsRequest) returns (Operation)

Deletes permanently all user events specified by the filter provided. Depending on the number of events specified by the filter, this operation could take hours or days to complete. To test a filter, use the list command first.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • retail.userEvents.purge

For more information, see the IAM documentation.

RejoinUserEvents

rpc RejoinUserEvents(RejoinUserEventsRequest) returns (Operation)

Triggers a user event rejoin operation with latest product catalog. Events will not be annotated with detailed product information if product is missing from the catalog at the time the user event is ingested, and these events are stored as unjoined events with a limited usage on training and serving. This API can be used to trigger a 'join' operation on specified events with latest version of product catalog. It can also be used to correct events joined with wrong product catalog.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • retail.userEvents.rejoin

For more information, see the IAM documentation.

WriteUserEvent

rpc WriteUserEvent(WriteUserEventRequest) returns (UserEvent)

Writes a single user event.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • retail.userEvents.create

For more information, see the IAM documentation.

AddFulfillmentPlacesMetadata

Metadata related to the progress of the AddFulfillmentPlaces operation. Currently empty because there is no meaningful metadata populated from the [AddFulfillmentPlaces][] method.

AddFulfillmentPlacesRequest

Request message for [AddFulfillmentPlaces][] method.

Fields
product

string

Required. Full resource name of Product, such as projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id.

If the caller does not have permission to access the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

type

string

Required. The fulfillment type, including commonly used types (such as pickup in store and same day delivery), and custom types.

Supported values:

  • "pickup-in-store"
  • "ship-to-store"
  • "same-day-delivery"
  • "next-day-delivery"
  • "custom-type-1"
  • "custom-type-2"
  • "custom-type-3"
  • "custom-type-4"
  • "custom-type-5"

If this field is set to an invalid value other than these, an INVALID_ARGUMENT error is returned.

This field directly corresponds to [Product.fulfillment_info.type][].

place_ids[]

string

Required. The IDs for this type, such as the store IDs for "pickup-in-store" or the region IDs for "same-day-delivery" to be added for this type. Duplicate IDs will be automatically ignored.

At least 1 value is required, and a maximum of 2000 values are allowed. Each value must be a string with a length limit of 10 characters, matching the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is returned.

If the total number of place IDs exceeds 2000 for this type after adding, then the update will be rejected.

add_time

Timestamp

The time when the fulfillment updates are issued, used to prevent out-of-order updates on fulfillment information. If not provided, the internal system time will be used.

allow_missing

bool

If set to true, and the Product is not found, the fulfillment information will still be processed and retained for at most 1 day and processed once the Product is created. If set to false, a NOT_FOUND error is returned if the Product is not found.

AddFulfillmentPlacesResponse

Response of the AddFulfillmentPlacesRequest. Currently empty because there is no meaningful response populated from the [AddFulfillmentPlaces][] method.

AddLocalInventoriesMetadata

Metadata related to the progress of the AddLocalInventories operation. Currently empty because there is no meaningful metadata populated from the [AddLocalInventories][] method.

AddLocalInventoriesRequest

Request message for [AddLocalInventories][] method.

Fields
product

string

Required. Full resource name of Product, such as projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id.

If the caller does not have permission to access the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

local_inventories[]

LocalInventory

Required. A list of inventory information at difference places. Each place is identified by its place ID. At most 1000 inventories are allowed per request.

add_mask

FieldMask

Indicates which inventory fields in the provided list of LocalInventory to update. The field is updated to the provided value.

If a field is set while the place does not have a previous local inventory, the local inventory at that store is created.

If a field is set while the value of that field is not provided, the original field value, if it exists, is deleted.

If the mask is not set or set with empty paths, all inventory fields will be updated.

If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned and the entire update will be ignored.

add_time

Timestamp

The time when the inventory updates are issued. Used to prevent out-of-order updates on local inventory fields. If not provided, the internal system time will be used.

allow_missing

bool

If set to true, and the Product is not found, the local inventory will still be processed and retained for at most 1 day and processed once the Product is created. If set to false, a NOT_FOUND error is returned if the Product is not found.

AddLocalInventoriesResponse

Response of the [AddLocalInventories][] API. Currently empty because there is no meaningful response populated from the [AddLocalInventories][] method.

Audience

An intended audience of the Product for whom it's sold.

Fields
genders[]

string

The genders of the audience. Strongly encouraged to use the standard values: "male", "female", "unisex".

At most 5 values are allowed. Each value must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Google Merchant Center property gender. Schema.org property Product.audience.suggestedGender.

age_groups[]

string

The age groups of the audience. Strongly encouraged to use the standard values: "newborn" (up to 3 months old), "infant" (3–12 months old), "toddler" (1–5 years old), "kids" (5–13 years old), "adult" (typically teens or older).

At most 5 values are allowed. Each value must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Google Merchant Center property age_group. Schema.org property Product.audience.suggestedMinAge and Product.audience.suggestedMaxAge.

BigQuerySource

BigQuery source import data from.

Fields
project_id

string

The project ID (can be project # or ID) that the BigQuery source is in with a length limit of 128 characters. If not specified, inherits the project ID from the parent request.

dataset_id

string

Required. The BigQuery data set to copy the data from with a length limit of 1,024 characters.

table_id

string

Required. The BigQuery table to copy the data from with a length limit of 1,024 characters.

gcs_staging_dir

string

Intermediate Cloud Storage directory used for the import with a length limit of 2,000 characters. Can be specified if one wants to have the BigQuery export to a specific Cloud Storage directory.

data_schema

string

The schema to use when parsing the data from the source.

Supported values for product imports:

Supported values for user events imports:

partition_date

Date

BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.

Only supported when ImportProductsRequest.reconciliation_mode is set to FULL.

Catalog

The catalog configuration.

Fields
name

string

Required. Immutable. The fully qualified resource name of the catalog.

display_name

string

Required. Immutable. The catalog display name.

This field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

product_level_config

ProductLevelConfig

Required. The product level configuration.

merchant_center_linking_config

MerchantCenterLinkingConfig

The Merchant Center linking configuration. Once a link is added, the data stream from Merchant Center to Cloud Retail will be enabled automatically. The requester must have access to the merchant center account in order to make changes to this field.

CollectUserEventRequest

Request message for CollectUserEvent method.

Fields
parent

string

Required. The parent catalog name, such as projects/1234/locations/global/catalogs/default_catalog.

user_event

string

Required. URL encoded UserEvent proto with a length limit of 2,000,000 characters.

uri

string

The URL including cgi-parameters but excluding the hash fragment with a length limit of 5,000 characters. This is often more useful than the referer URL, because many browsers only send the domain for 3rd party requests.

ets

int64

The event timestamp in milliseconds. This prevents browser caching of otherwise identical get requests. The name is abbreviated to reduce the payload bytes.

ColorInfo

The color information of a Product.

Fields
color_families[]

string

The standard color families. Strongly recommended to use the following standard color groups: "Red", "Pink", "Orange", "Yellow", "Purple", "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and "Mixed". Normally it is expected to have only 1 color family. May consider using single "Mixed" instead of multiple values.

A maximum of 5 values are allowed. Each value must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Google Merchant Center property color. Schema.org property Product.color.

colors[]

string

The color display names, which may be different from standard color family names, such as the color aliases used in the website frontend. Normally it is expected to have only 1 color. May consider using single "Mixed" instead of multiple values.

A maximum of 25 colors are allowed. Each value must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Google Merchant Center property color. Schema.org property Product.color.

CompleteQueryRequest

Auto-complete parameters.

Fields
catalog

string

Required. Catalog for which the completion is performed.

Full resource name of catalog, such as projects/*/locations/global/catalogs/default_catalog.

query

string

Required. The query used to generate suggestions.

The maximum number of allowed characters is 255.

visitor_id

string

A unique identifier for tracking visitors. For example, this could be implemented with an HTTP cookie, which should be able to uniquely identify a visitor on a single device. This unique identifier should not change if the visitor logs in or out of the website.

The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

language_codes[]

string

The list of languages of the query. This is the BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see Tags for Identifying Languages.

The maximum number of allowed characters is 255. Only "en-US" is currently supported.

device_type

string

The device type context for completion suggestions. It is useful to apply different suggestions on different device types, e.g. DESKTOP, MOBILE. If it is empty, the suggestions are across all device types.

Supported formats:

  • UNKNOWN_DEVICE_TYPE

  • DESKTOP

  • MOBILE

  • A customized string starts with OTHER_, e.g. OTHER_IPHONE.

dataset

string

Determines which dataset to use for fetching completion. "user-data" will use the imported dataset through CompletionService.ImportCompletionData. "cloud-retail" will use the dataset generated by cloud retail based on user events. If leave empty, it will use the "user-data".

Current supported values:

  • user-data

  • cloud-retail This option requires additional allowlisting. Before using cloud-retail, contact Cloud Retail support team first.

max_suggestions

int32

Completion max suggestions. If left unset or set to 0, then will fallback to the configured value CompletionConfig.max_suggestions.

The maximum allowed max suggestions is 20. If it is set higher, it will be capped by 20.

CompleteQueryResponse

Response of the auto-complete query.

Fields
completion_results[]

CompletionResult

Results of the matching suggestions. The result list is ordered and the first result is top suggestion.

attribution_token

string

A unique complete token. This should be included in the SearchRequest resulting from this completion, which enables accurate attribution of complete model performance.

recent_search_results[]

RecentSearchResult

Matched recent searches of this user. The maximum number of recent searches is 10. This field is a restricted feature. Contact Retail Search support team if you are interested in enabling it.

This feature is only available when CompleteQueryRequest.visitor_id field is set and UserEvent is imported. The recent searches satisfy the follow rules: * They are ordered from latest to oldest. * They are matched with CompleteQueryRequest.query case insensitively. * They are transformed to lower cases. * They are UTF-8 safe.

Recent searches are deduplicated. More recent searches will be reserved when duplication happens.

CompletionResult

Resource that represents completion results.

Fields
suggestion

string

The suggestion for the query.

attributes

map<string, CustomAttribute>

Additional custom attributes ingested through BigQuery.

RecentSearchResult

Recent search of this user.

Fields

CompletionDataInputConfig

The input config source for completion data.

Fields
big_query_source

BigQuerySource

Required. BigQuery input source.

Add the IAM permission "BigQuery Data Viewer" for cloud-retail-customer-data-access@system.gserviceaccount.com before using this feature otherwise an error is thrown.

CompletionDetail

Detailed completion information including completion attribution token and clicked completion info.

Fields
completion_attribution_token

string

Completion attribution token in CompleteQueryResponse.attribution_token.

selected_suggestion

string

End user selected CompleteQueryResponse.CompletionResult.suggestion.

selected_position

int32

End user selected CompleteQueryResponse.CompletionResult.suggestion position, starting from 0.

CreateProductRequest

Request message for [CreateProduct][] method.

Fields
parent

string

Required. The parent catalog resource name, such as projects/*/locations/global/catalogs/default_catalog/branches/default_branch.

product

Product

Required. The Product to create.

product_id

string

Required. The ID to use for the Product, which will become the final component of the Product.name.

If the caller does not have permission to create the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

This field must be unique among all Products with the same parent. Otherwise, an ALREADY_EXISTS error is returned.

This field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

CustomAttribute

A custom attribute that is not explicitly modeled in Product.

Fields
text[]

string

The textual values of this custom attribute. For example, ["yellow", "green"] when the key is "color".

At most 400 values are allowed. Empty values are not allowed. Each value must be a UTF-8 encoded string with a length limit of 256 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Exactly one of text or numbers should be set. Otherwise, an INVALID_ARGUMENT error is returned.

numbers[]

double

The numerical values of this custom attribute. For example, [2.3, 15.4] when the key is "lengths_cm".

At most 400 values are allowed.Otherwise, an INVALID_ARGUMENT error is returned.

Exactly one of text or numbers should be set. Otherwise, an INVALID_ARGUMENT error is returned.

searchable

bool

If true, custom attribute values are searchable by text queries in SearchService.Search.

This field is ignored in a UserEvent.

Only set if type text is set. Otherwise, a INVALID_ARGUMENT error is returned.

indexable

bool

If true, custom attribute values are indexed, so that it can be filtered, faceted or boosted in SearchService.Search.

This field is ignored in a UserEvent.

See SearchRequest.filter, SearchRequest.facet_specs and SearchRequest.boost_spec for more details.

DeleteProductRequest

Request message for [DeleteProduct][] method.

Fields
name

string

Required. Full resource name of Product, such as projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id.

If the caller does not have permission to delete the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the Product to delete does not exist, a NOT_FOUND error is returned.

The Product to delete can neither be a Product.Type.COLLECTION Product member nor a Product.Type.PRIMARY Product with more than one variants. Otherwise, an INVALID_ARGUMENT error is returned.

All inventory information for the named Product will be deleted.

ExportErrorsConfig

Configuration of destination for Export related errors.

Fields
gcs_prefix

string

Google Cloud Storage path for import errors. This must be an empty, existing Cloud Storage bucket. Export errors will be written to a file in this bucket, one per line, as a JSON-encoded google.rpc.Status message.

ExportMetadata

Metadata related to the progress of the Export operation. This will be returned by the google.longrunning.Operation.metadata field.

Fields
create_time

Timestamp

Operation create time.

update_time

Timestamp

Operation last update time. If the operation is done, this is also the finish time.

ExportProductsResponse

Response of the ExportProductsRequest. If the long running operation is done, then this message is returned by the google.longrunning.Operations.response field if the operation was successful.

Fields
error_samples[]

Status

A sample of errors encountered while processing the request.

errors_config

ExportErrorsConfig

Echoes the destination for the complete errors in the request if set.

ExportUserEventsResponse

Response of the ExportUserEventsRequest. If the long running operation was successful, then this message is returned by the google.longrunning.Operations.response field if the operation was successful.

Fields
error_samples[]

Status

A sample of errors encountered while processing the request.

errors_config

ExportErrorsConfig

Echoes the destination for the complete errors if this field was set in the request.

FulfillmentInfo

Fulfillment information, such as the store IDs for in-store pickup or region IDs for different shipping methods.

Fields
type

string

The fulfillment type, including commonly used types (such as pickup in store and same day delivery), and custom types. Customers have to map custom types to their display names before rendering UI.

Supported values:

  • "pickup-in-store"
  • "ship-to-store"
  • "same-day-delivery"
  • "next-day-delivery"
  • "custom-type-1"
  • "custom-type-2"
  • "custom-type-3"
  • "custom-type-4"
  • "custom-type-5"

If this field is set to an invalid value other than these, an INVALID_ARGUMENT error is returned.

place_ids[]

string

The IDs for this type, such as the store IDs for FulfillmentInfo.type.pickup-in-store or the region IDs for FulfillmentInfo.type.same-day-delivery.

A maximum of 3000 values are allowed. Each value must be a string with a length limit of 30 characters, matching the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is returned.

GcsSource

Google Cloud Storage location for input content. format.

Fields
input_uris[]

string

Required. Google Cloud Storage URIs to input files. URI can be up to 2000 characters long. URIs can match the full object path (for example, gs://bucket/directory/object.json) or a pattern matching one or more files, such as gs://bucket/directory/*.json. A request can contain at most 100 files, and each file can be up to 2 GB. See Importing product information for the expected file format and setup instructions.

data_schema

string

The schema to use when parsing the data from the source.

Supported values for product imports:

Supported values for user events imports:

GetDefaultBranchRequest

Request message to show which branch is currently the default branch.

Fields
catalog

string

The parent catalog resource name, such as projects/*/locations/global/catalogs/default_catalog.

GetDefaultBranchResponse

Response message of CatalogService.GetDefaultBranch.

Fields
branch

string

Full resource name of the branch id currently set as default branch.

set_time

Timestamp

The time when this branch is set to default.

note

string

This corresponds to SetDefaultBranchRequest.note field, when this branch was set as default.

GetProductRequest

Request message for [GetProduct][] method.

Fields
name

string

Required. Full resource name of Product, such as projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id.

If the caller does not have permission to access the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the requested Product does not exist, a NOT_FOUND error is returned.

Image

Product thumbnail/detail image.

Fields
uri

string

Required. URI of the image.

This field must be a valid UTF-8 encoded URI with a length limit of 5,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Google Merchant Center property image_link. Schema.org property Product.image.

height

int32

Height of the image in number of pixels.

This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is returned.

width

int32

Width of the image in number of pixels.

This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is returned.

ImportCompletionDataRequest

Request message for ImportCompletionData methods.

Fields
parent

string

Required. The catalog which the suggestions dataset belongs to.

Format: projects/1234/locations/global/catalogs/default_catalog.

input_config

CompletionDataInputConfig

Required. The desired input location of the data.

notification_pubsub_topic

string

Pub/Sub topic for receiving notification. If this field is set, when the import is finished, a notification will be sent to specified Pub/Sub topic. The message data will be JSON string of a Operation. Format of the Pub/Sub topic is projects/{project}/topics/{topic}.

ImportCompletionDataResponse

Response of the ImportCompletionDataRequest. If the long running operation is done, this message is returned by the google.longrunning.Operations.response field if the operation is successful.

Fields
error_samples[]

Status

A sample of errors encountered while processing the request.

ImportErrorsConfig

Configuration of destination for Import related errors.

Fields
gcs_prefix

string

Google Cloud Storage path for import errors. This must be an empty, existing Cloud Storage bucket. Import errors will be written to a file in this bucket, one per line, as a JSON-encoded google.rpc.Status message.

ImportMetadata

Metadata related to the progress of the Import operation. This will be returned by the google.longrunning.Operation.metadata field.

Fields
create_time

Timestamp

Operation create time.

update_time

Timestamp

Operation last update time. If the operation is done, this is also the finish time.

success_count

int64

Count of entries that were processed successfully.

failure_count

int64

Count of entries that encountered errors while processing.

request_id

string

Id of the request / operation. This is parroting back the requestId that was passed in the request.

notification_pubsub_topic

string

Pub/Sub topic for receiving notification. If this field is set, when the import is finished, a notification will be sent to specified Pub/Sub topic. The message data will be JSON string of a Operation. Format of the Pub/Sub topic is projects/{project}/topics/{topic}.

ImportProductsRequest

Request message for Import methods.

Fields
parent

string

Required. projects/1234/locations/global/catalogs/default_catalog/branches/default_branch

If no updateMask is specified, requires products.create permission. If updateMask is specified, requires products.update permission.

request_id

string

Unique identifier provided by client, within the ancestor dataset scope. Ensures idempotency and used for request deduplication. Server-generated if unspecified. Up to 128 characters long and must match the pattern: [a-zA-Z0-9_]+. This is returned as [Operation.name][] in ImportMetadata.

Only supported when ImportProductsRequest.reconciliation_mode is set to FULL.

input_config

ProductInputConfig

Required. The desired input location of the data.

errors_config

ImportErrorsConfig

The desired location of errors incurred during the Import.

update_mask

FieldMask

Indicates which fields in the provided imported 'products' to update. If not set, will by default update all fields.

reconciliation_mode

ReconciliationMode

The mode of reconciliation between existing products and the products to be imported. Defaults to ReconciliationMode.INCREMENTAL.

notification_pubsub_topic

string

Pub/Sub topic for receiving notification. If this field is set, when the import is finished, a notification will be sent to specified Pub/Sub topic. The message data will be JSON string of a Operation. Format of the Pub/Sub topic is projects/{project}/topics/{topic}.

Only supported when ImportProductsRequest.reconciliation_mode is set to FULL.

ReconciliationMode

Indicates how imported products are reconciled with the existing products created or imported before.

Enums
RECONCILIATION_MODE_UNSPECIFIED Defaults to INCREMENTAL.
INCREMENTAL Inserts new products or updates existing products.
FULL

Calculates diff and replaces the entire product dataset. Existing products may be deleted if they are not present in the source location.

Can only be while using BigQuerySource.

Add the IAM permission "BigQuery Data Viewer" for cloud-retail-customer-data-access@system.gserviceaccount.com before using this feature otherwise an error is thrown.

This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.

ImportProductsResponse

Response of the ImportProductsRequest. If the long running operation is done, then this message is returned by the google.longrunning.Operations.response field if the operation was successful.

Fields
error_samples[]

Status

A sample of errors encountered while processing the request.

errors_config

ImportErrorsConfig

Echoes the destination for the complete errors in the request if set.

ImportUserEventsRequest

Request message for the ImportUserEvents request.

Fields
parent

string

Required. projects/1234/locations/global/catalogs/default_catalog

input_config

UserEventInputConfig

Required. The desired input location of the data.

errors_config

ImportErrorsConfig

The desired location of errors incurred during the Import. Cannot be set for inline user event imports.

ImportUserEventsResponse

Response of the ImportUserEventsRequest. If the long running operation was successful, then this message is returned by the google.longrunning.Operations.response field if the operation was successful.

Fields
error_samples[]

Status

A sample of errors encountered while processing the request.

errors_config

ImportErrorsConfig

Echoes the destination for the complete errors if this field was set in the request.

import_summary

UserEventImportSummary

Aggregated statistics of user event import status.

Interval

A floating point interval.

Fields

Union field min. The lower bound of the interval. If neither of the min fields are set, then the lower bound is negative infinity.

This field must be not larger than [max][google.cloud.retail.v2alpha.Interval.max]. Otherwise, an INVALID_ARGUMENT error is returned. min can be only one of the following:

minimum

double

Inclusive lower bound.

exclusive_minimum

double

Exclusive lower bound.

Union field max. The upper bound of the interval. If neither of the max fields are set, then the upper bound is positive infinity.

This field must be not smaller than [min][google.cloud.retail.v2alpha.Interval.min]. Otherwise, an INVALID_ARGUMENT error is returned. max can be only one of the following:

maximum

double

Inclusive upper bound.

exclusive_maximum

double

Exclusive upper bound.

ListCatalogsRequest

Request for CatalogService.ListCatalogs method.

Fields
parent

string

Required. The account resource name with an associated location.

If the caller does not have permission to list Catalogs under this location, regardless of whether or not this location exists, a PERMISSION_DENIED error is returned.

page_size

int32

Maximum number of Catalogs to return. If unspecified, defaults to 50. The maximum allowed value is 1000. Values above 1000 will be coerced to 1000.

If this field is negative, an INVALID_ARGUMENT is returned.

page_token

string

A page token ListCatalogsResponse.next_page_token, received from a previous CatalogService.ListCatalogs call. Provide this to retrieve the subsequent page.

When paginating, all other parameters provided to CatalogService.ListCatalogs must match the call that provided the page token. Otherwise, an INVALID_ARGUMENT error is returned.

ListCatalogsResponse

Response for CatalogService.ListCatalogs method.

Fields
catalogs[]

Catalog

All the customer's Catalogs.

next_page_token

string

A token that can be sent as ListCatalogsRequest.page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.

ListProductsRequest

Request message for ProductService.ListProducts method.

Fields
parent

string

Required. The parent branch resource name, such as projects/*/locations/global/catalogs/default_catalog/branches/0. Use default_branch as the branch ID, to list products under the default branch.

If the caller does not have permission to list Products under this branch, regardless of whether or not this branch exists, a PERMISSION_DENIED error is returned.

page_size

int32

Maximum number of Products to return. If unspecified, defaults to 100. The maximum allowed value is 1000. Values above 1000 will be coerced to 1000.

If this field is negative, an INVALID_ARGUMENT error is returned.

page_token

string

A page token ListProductsResponse.next_page_token, received from a previous ProductService.ListProducts call. Provide this to retrieve the subsequent page.

When paginating, all other parameters provided to ProductService.ListProducts must match the call that provided the page token. Otherwise, an INVALID_ARGUMENT error is returned.

filter

string

A filter to apply on the list results. Supported features:

If the field is unrecognizable, an INVALID_ARGUMENT error is returned.

If the specified Product.Type.PRIMARY Product or Product.Type.COLLECTION Product does not exist, a NOT_FOUND error is returned.

read_mask

FieldMask

The fields of Product to return in the responses. If not set or empty, the following fields are returned:

If "*" is provided, all fields are returned. Product.name is always returned no matter what mask is set.

If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned.

require_total_size

bool

If true and page_token is empty, ListProductsResponse.total_size is set to the total count of matched items irrespective of pagination.

Notice that setting this field to true affects the performance.

ListProductsResponse

Response message for ProductService.ListProducts method.

Fields
products[]

Product

The Products.

next_page_token

string

A token that can be sent as ListProductsRequest.page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.

total_size

int32

The total count of matched Products irrespective of pagination. The total number of Products returned by pagination may be less than the total_size that matches.

This field is ignored if ListProductsRequest.require_total_size is not set or ListProductsRequest.page_token is not empty.

LocalInventory

The inventory information at a place (e.g. a store) identified by a place ID.

Fields
place_id

string

The place ID for the current set of inventory information.

price_info

PriceInfo

Product price and cost information.

Google Merchant Center property price.

attributes

map<string, CustomAttribute>

Additional local inventory attributes, for example, store name, promotion tags, etc. * At most 5 values are allowed. Otherwise, an INVALID_ARGUMENT error is returned. * The key must be a UTF-8 encoded string with a length limit of 10 characters. * The key must match the pattern: [a-zA-Z0-9][a-zA-Z0-9_]*. For example, key0LikeThis or KEY_1_LIKE_THIS. * The attribute values must be of the same type (text or number). * The max number of values per attribute is 10. * For text values, the length limit is 10 UTF-8 characters. * The attribute does not support search. The searchable field should be unset or set to false. * The max summed total bytes of custom attribute keys and values per product is 5MiB.

MerchantCenterLinkingConfig

Configures Merchant Center linking. Links contained in the config will be used to sync data from a Merchant Center account to a Cloud Retail branch.

Fields

PredictRequest

Request message for Predict method.

Fields
placement

string

Required. Full resource name of the format: {name=projects/*/locations/global/catalogs/default_catalog/placements/*} The ID of the Recommendations AI placement. Before you can request predictions from your model, you must create at least one placement for it. For more information, see Managing placements.

The full list of available placements can be seen at https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements

user_event

UserEvent

Required. Context about the user, what they are looking at and what action they took to trigger the predict request. Note that this user event detail won't be ingested to userEvent logs. Thus, a separate userEvent write request is required for event logging.

page_size

int32

Maximum number of results to return per page. Set this property to the number of prediction results needed. If zero, the service will choose a reasonable default. The maximum allowed value is 100. Values above 100 will be coerced to 100.

page_token

string

The previous PredictResponse.next_page_token.

filter

string

Filter for restricting prediction results with a length limit of 5,000 characters. Accepts values for tags and the filterOutOfStockItems flag.

  • Tag expressions. Restricts predictions to products that match all of the specified tags. Boolean operators OR and NOT are supported if the expression is enclosed in parentheses, and must be separated from the tag values by a space. -"tagA" is also supported and is equivalent to NOT "tagA". Tag values must be double quoted UTF-8 encoded strings with a size limit of 1,000 characters.

Note: "Recently viewed" models don't support tag filtering at the moment.

  • filterOutOfStockItems. Restricts predictions to products that do not have a stockState value of OUT_OF_STOCK.

Examples:

  • tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
  • filterOutOfStockItems tag=(-"promotional")
  • filterOutOfStockItems

If your filter blocks all prediction results, nothing will be returned. If you want generic (unfiltered) popular products to be returned instead, set strictFiltering to false in PredictRequest.params.

validate_only

bool

Use validate only mode for this prediction query. If set to true, a dummy model will be used that returns arbitrary products. Note that the validate only mode should only be used for testing the API, or if the model is not ready.

params

map<string, Value>

Additional domain specific parameters for the predictions.

Allowed values:

  • returnProduct: Boolean. If set to true, the associated product object will be returned in the results.metadata field in the prediction response.
  • returnScore: Boolean. If set to true, the prediction 'score' corresponding to each returned product will be set in the results.metadata field in the prediction response. The given 'score' indicates the probability of an product being clicked/purchased given the user's context and history.
  • strictFiltering: Boolean. True by default. If set to false, the service will return generic (unfiltered) popular products instead of empty if your filter blocks all prediction results.
  • priceRerankLevel: String. Default empty. If set to be non-empty, then it needs to be one of {'no-price-reranking', 'low-price-reranking', 'medium-price-reranking', 'high-price-reranking'}. This gives request-level control and adjusts prediction results based on product price.
  • diversityLevel: String. Default empty. If set to be non-empty, then it needs to be one of {'no-diversity', 'low-diversity', 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives request-level control and adjusts prediction results based on product category.
labels

map<string, string>

The labels applied to a resource must meet the following requirements:

  • Each resource can have multiple labels, up to a maximum of 64.
  • Each label must be a key-value pair.
  • Keys have a minimum length of 1 character and a maximum length of 63 characters, and cannot be empty. Values can be empty, and have a maximum length of 63 characters.
  • Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.
  • The key portion of a label must be unique. However, you can use the same key with multiple resources.
  • Keys must start with a lowercase letter or international character.

See Google Cloud Document for more details.

PredictResponse

Response message for predict method.

Fields
results[]

PredictionResult

A list of recommended products. The order represents the ranking (from the most relevant product to the least).

attribution_token

string

A unique attribution token. This should be included in the UserEvent logs resulting from this recommendation, which enables accurate attribution of recommendation model performance.

missing_ids[]

string

IDs of products in the request that were missing from the inventory.

validate_only

bool

True if the validateOnly property was set in the request.

PredictionResult

PredictionResult represents the recommendation prediction results.

Fields
id

string

ID of the recommended product

metadata

map<string, Value>

Additional product metadata / annotations.

Possible values:

  • product: JSON representation of the product. Will be set if returnProduct is set to true in PredictRequest.params.
  • score: Prediction score in double value. Will be set if returnScore is set to true in PredictRequest.params.

PriceInfo

The price information of a Product.

Fields
currency_code

string

The 3-letter currency code defined in ISO 4217.

If this field is an unrecognizable currency code, an INVALID_ARGUMENT error is returned.

The Product.Type.VARIANT Products with the same Product.primary_product_id must share the same currency_code. Otherwise, a FAILED_PRECONDITION error is returned.

price

float

Price of the product.

Google Merchant Center property price. Schema.org property Offer.priceSpecification.

original_price

float

Price of the product without any discount. If zero, by default set to be the price.

cost

float

The costs associated with the sale of a particular product. Used for gross profit reporting.

Google Merchant Center property cost_of_goods_sold.

price_effective_time

Timestamp

The timestamp when the price starts to be effective. This can be set as a future timestamp, and the price is only used for search after price_effective_time. If so, the original_price must be set and original_price is used before price_effective_time.

Do not set if price is always effective because it will cause additional latency during search.

price_expire_time

Timestamp

The timestamp when the price stops to be effective. The price is used for search before price_expire_time. If this field is set, the original_price must be set and original_price is used after price_expire_time.

Do not set if price is always effective because it will cause additional latency during search.

price_range

PriceRange

Output only. The price range of all the child Product.Type.VARIANT Products grouped together on the Product.Type.PRIMARY Product. Only populated for Product.Type.PRIMARY Products.

Note: This field is OUTPUT_ONLY for ProductService.GetProduct. Do not set this field in API requests.

PriceRange

The price range of all variant Product having the same Product.primary_product_id.

Fields
price

Interval

The inclusive Product.pricing_info.price interval of all variant Product having the same Product.primary_product_id.

original_price

Interval

The inclusive Product.pricing_info.original_price internal of all variant Product having the same Product.primary_product_id.

Product

Product captures all metadata information of items to be recommended or searched.

Fields
name

string

Immutable. Full resource name of the product, such as projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id.

id

string

Immutable. Product identifier, which is the final component of name. For example, this field is "id_1", if name is projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1.

This field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Corresponding properties: Google Merchant Center property id. Schema.org property Product.sku.

type

Type

Immutable. The type of the product. Default to Catalog.product_level_config.ingestion_product_type if unset.

primary_product_id

string

Variant group identifier. Must be an id, with the same parent branch with this product. Otherwise, an error is thrown.

For Type.PRIMARY Products, this field can only be empty or set to the same value as id.

For VARIANT Products, this field cannot be empty. A maximum of 2,000 products are allowed to share the same Type.PRIMARY Product. Otherwise, an INVALID_ARGUMENT error is returned.

Corresponding properties: Google Merchant Center property item_group_id. Schema.org property Product.inProductGroupWithID.

collection_member_ids[]

string

The id of the collection members when type is Type.COLLECTION.

Should not set it for other types. A maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is return.

gtin

string

The Global Trade Item Number (GTIN) of the product.

This field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

This field must be a Unigram. Otherwise, an INVALID_ARGUMENT error is returned.

Corresponding properties: Google Merchant Center property gtin. Schema.org property Product.isbn, Product.gtin8, Product.gtin12, Product.gtin13, or Product.gtin14.

If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned.

categories[]

string

Product categories. This field is repeated for supporting one product belonging to several parallel categories. Strongly recommended using the full path for better search / recommendation quality.

To represent full path of category, use '>' sign to separate different hierarchies. If '>' is part of the category name, please replace it with other character(s).

For example, if a shoes product belongs to both ["Shoes & Accessories" -> "Shoes"] and ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be represented as:

 "categories": [
   "Shoes & Accessories > Shoes",
   "Sports & Fitness > Athletic Clothing > Shoes"
 ]

Must be set for Type.PRIMARY Product otherwise an INVALID_ARGUMENT error is returned.

At most 250 values are allowed per Product. Empty values are not allowed. Each value must be a UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Corresponding properties: Google Merchant Center property google_product_category. Schema.org property Product.category.

title

string

Required. Product title.

This field must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Corresponding properties: Google Merchant Center property title. Schema.org property Product.name.

brands[]

string

The brands of the product.

A maximum of 30 brands are allowed. Each brand must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Corresponding properties: Google Merchant Center property brand. Schema.org property Product.brand.

description

string

Product description.

This field must be a UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Corresponding properties: Google Merchant Center property description. Schema.org property Product.description.

language_code

string

Language of the title/description and other string attributes. Use language tags defined by BCP 47.

For product prediction, this field is ignored and the model automatically detects the text language. The Product can include text in different languages, but duplicating Products to provide text in multiple languages can result in degraded model performance.

For product search this field is in use. It defaults to "en-US" if unset.

attributes

map<string, CustomAttribute>

Highly encouraged. Extra product attributes to be included. For example, for products, this could include the store name, vendor, style, color, etc. These are very strong signals for recommendation model, thus we highly recommend providing the attributes here.

Features that can take on one of a limited number of possible values. Two types of features can be set are:

Textual features. some examples would be the brand/maker of a product, or country of a customer. Numerical features. Some examples would be the height/weight of a product, or age of a customer.

For example: { "vendor": {"text": ["vendor123", "vendor456"]}, "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]} }.

This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT error is returned:

  • Max entries count: 200.
  • The key must be a UTF-8 encoded string with a length limit of 128 characters.
  • For indexable attribute, the key must match the pattern: [a-zA-Z0-9][a-zA-Z0-9_]*. For example, key0LikeThis or KEY_1_LIKE_THIS.
tags[]

string

Custom tags associated with the product.

At most 250 values are allowed per Product. This value must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

This tag can be used for filtering recommendation results by passing the tag as part of the PredictRequest.filter.

Corresponding properties: Google Merchant Center property custom_label_0–4.

price_info

PriceInfo

Product price and cost information.

Corresponding properties: Google Merchant Center property price.

rating

Rating

The rating of this product.

available_time

Timestamp

The timestamp when this Product becomes available for SearchService.Search.

availability

Availability

The online availability of the Product. Default to Availability.IN_STOCK.

Corresponding properties: Google Merchant Center property availability. Schema.org property Offer.availability.

available_quantity

Int32Value

The available quantity of the item.

fulfillment_info[]

FulfillmentInfo

Fulfillment information, such as the store IDs for in-store pickup or region IDs for different shipping methods.

All the elements must have distinct FulfillmentInfo.type. Otherwise, an INVALID_ARGUMENT error is returned.

uri

string

Canonical URL directly linking to the product detail page.

It is strongly recommended to provide a valid uri for the product, otherwise the service performance could be significantly degraded.

This field must be a UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Corresponding properties: Google Merchant Center property link. Schema.org property Offer.url.

images[]

Image

Product images for the product.Highly recommended to put the main image to the first.

A maximum of 300 images are allowed.

Corresponding properties: Google Merchant Center property image_link. Schema.org property Product.image.

audience

Audience

The target group associated with a given audience (e.g. male, veterans, car owners, musicians, etc.) of the product.

color_info

ColorInfo

The color of the product.

Corresponding properties: Google Merchant Center property color. Schema.org property Product.color.

sizes[]

string

The size of the product. To represent different size systems or size types, consider using this format: [[[size_system:]size_type:]size_value].

For example, in "US:MENS:M", "US" represents size system; "MENS" represents size type; "M" represents size value. In "GIRLS:27", size system is empty; "GIRLS" represents size type; "27" represents size value. In "32 inches", both size system and size type are empty, while size value is "32 inches".

A maximum of 20 values are allowed per Product. Each value must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Corresponding properties: Google Merchant Center property size, size_type, and size_system. Schema.org property Product.size.

materials[]

string

The material of the product. For example, "leather", "wooden".

A maximum of 20 values are allowed. Each value must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Corresponding properties: Google Merchant Center property material. Schema.org property Product.material.

patterns[]

string

The pattern or graphic print of the product. For example, "striped", "polka dot", "paisley".

A maximum of 20 values are allowed per Product. Each value must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Corresponding properties: Google Merchant Center property pattern. Schema.org property Product.pattern.

conditions[]

string

The condition of the product. Strongly encouraged to use the standard values: "new", "refurbished", "used".

A maximum of 5 values are allowed per Product. Each value must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Corresponding properties: Google Merchant Center property condition. Schema.org property Offer.itemCondition.

promotions[]

Promotion

The promotions applied to the product. A maximum of 10 values are allowed per Product.

publish_time

Timestamp

The timestamp when the product is published by the retailer for the first time, which indicates the freshness of the products. Note that this field is different from available_time, given it purely describes product freshness regardless of when it is available on search and recommendation.

retrievable_fields

FieldMask

Indicates which fields in the Products are returned in SearchResponse.

Supported fields for all types:

Supported fields only for Type.PRIMARY and Type.COLLECTION:

Supported fields only for Type.VARIANT:

  • Only the first image in images

To mark attributes as retrievable, include paths of the form "attributes.key" where "key" is the key of a custom attribute, as specified in attributes.

For Type.PRIMARY and Type.COLLECTION, the following fields are always returned in SearchResponse by default:

For Type.VARIANT, the following fields are always returned in by default:

Maximum number of paths is 30. Otherwise, an INVALID_ARGUMENT error is returned.

Note: Returning more fields in SearchResponse may increase response payload size and serving latency.

variants[]

Product

Output only. Product variants grouped together on primary product which share similar product attributes. It's automatically grouped by primary_product_id for all the product variants. Only populated for Type.PRIMARY Products.

Note: This field is OUTPUT_ONLY for ProductService.GetProduct. Do not set this field in API requests.

local_inventories[]

LocalInventory

Output only. A list of local inventories specific to different places.

Union field expiration.

expiration can be only one of the following:

expire_time

Timestamp

The timestamp when this product becomes unavailable for SearchService.Search.

If it is set, the Product is not available for SearchService.Search after expire_time. However, the product can still be retrieved by ProductService.GetProduct and ProductService.ListProducts.

expire_time must be later than available_time and publish_time, otherwise an INVALID_ARGUMENT error is thrown.

Corresponding properties: Google Merchant Center property expiration_date.

ttl

Duration

Input only. The TTL (time to live) of the product.

If it is set, it must be a non-negative value, and expire_time is set as current timestamp plus ttl. The derived expire_time is returned in the output and ttl is left blank when retrieving the Product.

If it is set, the product is not available for SearchService.Search after current timestamp plus ttl. However, the product can still be retrieved by ProductService.GetProduct and ProductService.ListProducts.

Availability

Product availability. If this field is unspecified, the product is assumed to be in stock.

Enums
AVAILABILITY_UNSPECIFIED Default product availability. Default to Availability.IN_STOCK if unset.
IN_STOCK Product in stock.
OUT_OF_STOCK Product out of stock.
PREORDER Product that is in pre-order state.
BACKORDER Product that is back-ordered (i.e. temporarily out of stock).

Type

The type of this product.

Enums
TYPE_UNSPECIFIED Default value. Default to Catalog.product_level_config.ingestion_product_type if unset.
PRIMARY

The primary type.

As the primary unit for predicting, indexing and search serving, a Type.PRIMARY Product is grouped with multiple Type.VARIANT Products.

VARIANT

The variant type.

Type.VARIANT Products usually share some common attributes on the same Type.PRIMARY Products, but they have variant attributes like different colors, sizes and prices, etc.

COLLECTION The collection type. Collection products are bundled Type.PRIMARY Products or Type.VARIANT Products that are sold together, such as a jewelry set with necklaces, earrings and rings, etc.

ProductDetail

Detailed product information associated with a user event.

Fields
product

Product

Required. Product information.

Required field(s):

Optional override field(s):

If any supported optional fields are provided, we will treat them as a full override when looking up product information from the catalog. Thus, it is important to ensure that the overriding fields are accurate and complete.

All other product fields are ignored and instead populated via catalog lookup after event ingestion.

quantity

Int32Value

Quantity of the product associated with the user event.

For example, this field will be 2 if two products are added to the shopping cart for purchase-complete event. Required for add-to-cart and purchase-complete event types.

ProductInlineSource

The inline source for the input config for ImportProducts method.

Fields
products[]

Product

Required. A list of products to update/create. Each product must have a valid Product.id. Recommended max of 100 items.

ProductInputConfig

The input config source for products.

Fields
Union field source. Required. The source of the input. source can be only one of the following:
product_inline_source

ProductInlineSource

The Inline source for the input content for products.

gcs_source

GcsSource

Google Cloud Storage location for the input content.

big_query_source

BigQuerySource

BigQuery input source.

ProductLevelConfig

Configures what level the product should be uploaded with regards to how users will be send events and how predictions will be made.

Fields
ingestion_product_type

string

The type of Products allowed to be ingested into the catalog. Acceptable values are:

If this field is set to an invalid value other than these, an INVALID_ARGUMENT error is returned.

If this field is variant and merchant_center_product_id_field is itemGroupId, an INVALID_ARGUMENT error is returned.

See Using product levels for more details.

merchant_center_product_id_field

string

Which field of Merchant Center Product should be imported as Product.id. Acceptable values are:

  • offerId (default): Import offerId as the product ID.
  • itemGroupId: Import itemGroupId as the product ID. Notice that Retail API will choose one item from the ones with the same itemGroupId, and use it to represent the item group.

If this field is set to an invalid value other than these, an INVALID_ARGUMENT error is returned.

If this field is itemGroupId and ingestion_product_type is variant, an INVALID_ARGUMENT error is returned.

See Using product levels for more details.

Promotion

Promotion information.

Fields
promotion_id

string

ID of the promotion. For example, "free gift".

The value value must be a UTF-8 encoded string with a length limit of 128 characters, and match the pattern: [a-zA-Z][a-zA-Z0-9_]*. For example, id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is returned.

Google Merchant Center property promotion.

PurchaseTransaction

A transaction represents the entire purchase transaction.

Fields
id

string

The transaction ID with a length limit of 128 characters.

revenue

float

Required. Total non-zero revenue or grand total associated with the transaction. This value include shipping, tax, or other adjustments to total revenue that you want to include as part of your revenue calculations.

tax

float

All the taxes associated with the transaction.

cost

float

All the costs associated with the products. These can be manufacturing costs, shipping expenses not borne by the end user, or any other costs, such that:

currency_code

string

Required. Currency code. Use three-character ISO-4217 code.

PurgeMetadata

Metadata related to the progress of the Purge operation. This will be returned by the google.longrunning.Operation.metadata field.

PurgeUserEventsRequest

Request message for PurgeUserEvents method.

Fields
parent

string

Required. The resource name of the catalog under which the events are created. The format is projects/${projectId}/locations/global/catalogs/${catalogId}

filter

string

Required. The filter string to specify the events to be deleted with a length limit of 5,000 characters. Empty string filter is not allowed. The eligible fields for filtering are:

  • eventType: Double quoted UserEvent.event_type string.
  • eventTime: in ISO 8601 "zulu" format.
  • visitorId: Double quoted string. Specifying this will delete all events associated with a visitor.
  • userId: Double quoted string. Specifying this will delete all events associated with a user.

Examples:

  • Deleting all events in a time range: eventTime > "2012-04-23T18:25:43.511Z" eventTime < "2012-04-23T18:30:43.511Z"
  • Deleting specific eventType in time range: eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"
  • Deleting all events for a specific visitor: visitorId = "visitor1024"

The filtering fields are assumed to have an implicit AND.

force

bool

Actually perform the purge. If force is set to false, the method will return the expected purge count without deleting any user events.

PurgeUserEventsResponse

Response of the PurgeUserEventsRequest. If the long running operation is successfully done, then this message is returned by the google.longrunning.Operations.response field.

Fields
purged_events_count

int64

The total count of events purged as a result of the operation.

Rating

The rating of a Product.

Fields
rating_count

int32

The total number of ratings. This value is independent of the value of rating_histogram.

This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is returned.

average_rating

float

The average rating of the Product.

The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is returned.

rating_histogram[]

int32

List of rating counts per rating value (index = rating - 1). The list is empty if there is no rating. If the list is non-empty, its size is always 5. Otherwise, an INVALID_ARGUMENT error is returned.

For example, [41, 14, 13, 47, 303]. It means that the Product got 41 ratings with 1 star, 14 ratings with 2 star, and so on.