This is the documentation for Recommendations AI only. To try Retail Search and the unified Retail console in the restricted GA phase, contact Cloud sales. If you are not planning to use Retail Search, remain on the Recommendations console until further notice.

If you are using the v1beta version of Recommendations AI, migrate to the Retail API version.

REST Resource: projects.locations.catalogs.branches.products

Resource: Product

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

JSON representation
{
  "name": string,
  "id": string,
  "type": enum (Type),
  "primaryProductId": string,
  "collectionMemberIds": [
    string
  ],
  "gtin": string,
  "categories": [
    string
  ],
  "title": string,
  "brands": [
    string
  ],
  "description": string,
  "languageCode": string,
  "attributes": {
    string: {
      "text": [
        string
      ],
      "numbers": [
        number
      ],
      "searchable": boolean,
      "indexable": boolean
    },
    ...
  },
  "tags": [
    string
  ],
  "priceInfo": {
    object (PriceInfo)
  },
  "rating": {
    object (Rating)
  },
  "availableTime": string,
  "availability": enum (Availability),
  "availableQuantity": integer,
  "fulfillmentInfo": [
    {
      object (FulfillmentInfo)
    }
  ],
  "uri": string,
  "images": [
    {
      object (Image)
    }
  ],
  "audience": {
    object (Audience)
  },
  "colorInfo": {
    object (ColorInfo)
  },
  "sizes": [
    string
  ],
  "materials": [
    string
  ],
  "patterns": [
    string
  ],
  "conditions": [
    string
  ],
  "promotions": [
    {
      object (Promotion)
    }
  ],
  "publishTime": string,
  "retrievableFields": string,
  "variants": [
    {
      object (Product)
    }
  ],

  // Union field expiration can be only one of the following:
  "expireTime": string,
  "ttl": string
  // End of list of possible types for union field expiration.
}
Fields
name

string

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

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

enum (Type)

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

primaryProductId

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.

collectionMemberIds[]

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.

languageCode

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 (key: string, value: object)

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.
attributes[].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.

attributes[].numbers[]

number

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.

attributes[].searchable

boolean

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.

attributes[].indexable

boolean

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.

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.

priceInfo

object (PriceInfo)

Product price and cost information.

Corresponding properties: Google Merchant Center property price.

rating

object (Rating)

The rating of this product.

availableTime

string (Timestamp format)

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

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

availability

enum (Availability)

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

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

availableQuantity

integer

The available quantity of the item.

fulfillmentInfo[]

object (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[]

object (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

object (Audience)

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

colorInfo

object (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[]

object (Promotion)

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

publishTime

string (Timestamp format)

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 availableTime, given it purely describes product freshness regardless of when it is available on search and recommendation.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

retrievableFields

string (FieldMask format)

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.

This is a comma-separated list of fully qualified names of fields. Example: "user.displayName,photo".

variants[]

object (Product)

Output only. Product variants grouped together on primary product which share similar product attributes. It's automatically grouped by primaryProductId 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.

Union field expiration.

expiration can be only one of the following:

expireTime

string (Timestamp format)

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

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

expireTime must be later than availableTime and publishTime, otherwise an INVALID_ARGUMENT error is thrown.

Corresponding properties: Google Merchant Center property expiration_date.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

ttl

string (Duration format)

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

If it is set, it must be a non-negative value, and expireTime is set as current timestamp plus ttl. The derived expireTime 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.

A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

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.

PriceInfo

The price information of a Product.

JSON representation
{
  "currencyCode": string,
  "price": number,
  "originalPrice": number,
  "cost": number,
  "priceEffectiveTime": string,
  "priceExpireTime": string,
  "priceRange": {
    object (PriceRange)
  }
}
Fields
currencyCode

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 currencyCode. Otherwise, a FAILED_PRECONDITION error is returned.

price

number

Price of the product.

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

originalPrice

number

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

cost

number

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

Google Merchant Center property cost_of_goods_sold.

priceEffectiveTime

string (Timestamp format)

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 priceEffectiveTime. If so, the originalPrice must be set and originalPrice is used before priceEffectiveTime.

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

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

priceExpireTime

string (Timestamp format)

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

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

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

priceRange

object (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.

JSON representation
{
  "price": {
    object (Interval)
  },
  "originalPrice": {
    object (Interval)
  }
}
Fields
price

object (Interval)

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

originalPrice

object (Interval)

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

Interval

A floating point interval.

JSON representation
{

  // Union field min can be only one of the following:
  "minimum": number,
  "exclusiveMinimum": number
  // End of list of possible types for union field min.

  // Union field max can be only one of the following:
  "maximum": number,
  "exclusiveMaximum": number
  // End of list of possible types for union field max.
}
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.v2.Interval.max]. Otherwise, an INVALID_ARGUMENT error is returned. min can be only one of the following:

minimum

number

Inclusive lower bound.

exclusiveMinimum

number

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.v2.Interval.min]. Otherwise, an INVALID_ARGUMENT error is returned. max can be only one of the following:

maximum

number

Inclusive upper bound.

exclusiveMaximum

number

Exclusive upper bound.

Rating

The rating of a Product.

JSON representation
{
  "ratingCount": integer,
  "averageRating": number,
  "ratingHistogram": [
    integer
  ]
}
Fields
ratingCount

integer

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

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

averageRating

number

The average rating of the Product.

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

ratingHistogram[]

integer

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.

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).

FulfillmentInfo

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

JSON representation
{
  "type": string,
  "placeIds": [
    string
  ]
}
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.

placeIds[]

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.

Image

Product thumbnail/detail image.

JSON representation
{
  "uri": string,
  "height": integer,
  "width": integer
}
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

integer

Height of the image in number of pixels.

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

width

integer

Width of the image in number of pixels.

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

Audience

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

JSON representation
{
  "genders": [
    string
  ],
  "ageGroups": [
    string
  ]
}
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.

ageGroups[]

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.

ColorInfo

The color information of a Product.

JSON representation
{
  "colorFamilies": [
    string
  ],
  "colors": [
    string
  ]
}
Fields
colorFamilies[]

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.

Promotion

Promotion information.

JSON representation
{
  "promotionId": string
}
Fields
promotionId

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.

Methods

addFulfillmentPlaces

Incrementally adds place IDs to Product.fulfillment_info.place_ids.

create

Creates a Product.

delete

Deletes a Product.

get

Gets a Product.

import

Bulk import of multiple Products.

list

Gets a list of Products.

patch

Updates a Product.

removeFulfillmentPlaces

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

setInventory

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