---
title: "POST /v1beta1/{+parent}/catalogItems:import"
method: POST
path: "/v1beta1/{+parent}/catalogItems:import"
tags: ["projects"]
---

# POST /v1beta1/{+parent}/catalogItems:import

`POST /v1beta1/{+parent}/catalogItems:import`

Bulk import of multiple catalog items. Request processing may be synchronous. No partial updating supported. Non-existing items will be created. Operation.response is of type ImportResponse. Note that it is possible for a subset of the items to be successfully updated.

## Path parameters

- `parent` string, required

## Request body

- GoogleCloudRecommendationengineV1beta1ImportCatalogItemsRequest — Request message for Import methods.
  - `requestId` string — Optional. 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. This is returned as google.longrunning.Operation.name in the response.
  - `inputConfig` GoogleCloudRecommendationengineV1beta1InputConfig — The input config source.
    - `userEventInlineSource` GoogleCloudRecommendationengineV1beta1UserEventInlineSource — The inline source for the input config for ImportUserEvents method.
      - `userEvents` GoogleCloudRecommendationengineV1beta1UserEvent[] — Optional. A list of user events to import. Recommended max of 10k items.
        - `eventSource` 'EVENT_SOURCE_UNSPECIFIED' | 'AUTOML' | 'ECOMMERCE' | 'BATCH_UPLOAD' — Optional. This field should *not* be set when using JavaScript pixel or the Recommendations AI Tag. Defaults to `EVENT_SOURCE_UNSPECIFIED`.
        - `userInfo` GoogleCloudRecommendationengineV1beta1UserInfo — Information of end users.
          - `userAgent` string — Optional. User agent as included in the HTTP header. UTF-8 encoded string with a length limit of 1 KiB. This should *not* be set when using the JavaScript pixel or if `directUserRequest` is set.
          - `visitorId` string — Required. A unique identifier for tracking visitors with a length limit of 128 bytes. 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. Maximum length 128 bytes. Cannot be empty. Don't set the field to the same fixed ID for different users. This mixes the event history of those users together, which results in degraded model quality.
          - `ipAddress` string — Optional. IP address of the user. This could be either IPv4 (e.g. 104.133.9.80) or IPv6 (e.g. 2001:0db8:85a3:0000:0000:8a2e:0370:7334). This should *not* be set when using the javascript pixel or if `direct_user_request` is set. Used to extract location information for personalization.
          - `directUserRequest` boolean — Optional. Indicates if the request is made directly from the end user in which case the user_agent and ip_address fields can be populated from the HTTP request. This should *not* be set when using the javascript pixel. This flag should be set only if the API request is made directly from the end user such as a mobile app (and not if a gateway or a server is processing and pushing the user events).
          - `userId` string — Optional. Unique identifier for logged-in user with a length limit of 128 bytes. Required only for logged-in users. Don't set for anonymous users. Don't set the field to the same fixed ID for different users. This mixes the event history of those users together, which results in degraded model quality.
        - `eventTime` string, google-datetime — Optional. Only required for ImportUserEvents method. Timestamp of user event created.
        - `productEventDetail` GoogleCloudRecommendationengineV1beta1ProductEventDetail — ProductEventDetail captures user event information specific to retail products.
          - `cartId` string — Optional. The id or name of the associated shopping cart. This id is used to associate multiple items added or present in the cart before purchase. This can only be set for `add-to-cart`, `remove-from-cart`, `checkout-start`, `purchase-complete`, or `shopping-cart-page-view` events.
          - `pageCategories` GoogleCloudRecommendationengineV1beta1CatalogItemCategoryHierarchy[] — Required for `category-page-view` events. At least one of search_query or page_categories is required for `search` events. Other event types should not set this field. The categories associated with a category page. Category pages include special pages such as sales or promotions. For instance, a special sale page may have the category hierarchy: categories : ["Sales", "2017 Black Friday Deals"].
            - `categories` string[] — Required. Catalog item categories. Each category should be a UTF-8 encoded string with a length limit of 2 KiB. Note that the order in the list denotes the specificity (from least to most specific).
          - `searchQuery` string — At least one of search_query or page_categories is required for `search` events. Other event types should not set this field. The user's search query as UTF-8 encoded text with a length limit of 5 KiB.
          - `productDetails` GoogleCloudRecommendationengineV1beta1ProductDetail[] — The main product details related to the event. This field is required for the following event types: * `add-to-cart` * `add-to-list` * `checkout-start` * `detail-page-view` * `purchase-complete` * `refund` * `remove-from-cart` * `remove-from-list` This field is optional for the following event types: * `page-visit` * `shopping-cart-page-view` - note that 'product_details' should be set for this unless the shopping cart is empty. * `search` (highly encouraged) In a `search` event, this field represents the products returned to the end user on the current page (the end user may have not finished broswing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new SEARCH event with different product_details is desired. The end user may have not finished broswing the whole page yet. This field is not allowed for the following event types: * `category-page-view` * `home-page-view`
            - `currencyCode` string — Optional. Currency code for price/costs. Use three-character ISO-4217 code. Required only if originalPrice or displayPrice is set.
            - `quantity` integer — Optional. 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 `add-to-cart` event. Required for `add-to-cart`, `add-to-list`, `remove-from-cart`, `checkout-start`, `purchase-complete`, `refund` event types.
            - `stockState` 'STOCK_STATE_UNSPECIFIED' | 'IN_STOCK' | 'OUT_OF_STOCK' | 'PREORDER' | 'BACKORDER' — Optional. Item stock state. If provided, this overrides the stock state in Catalog for items in this event.
            - `originalPrice` number, float — Optional. Original price of the product. If provided, this will override the original price in Catalog for this product.
            - `displayPrice` number, float — Optional. Display price of the product (e.g. discounted price). If provided, this will override the display price in Catalog for this product.
            - `availableQuantity` integer — Optional. Quantity of the products in stock when a user event happens. Optional. If provided, this overrides the available quantity in Catalog for this event. and can only be set if `stock_status` is set to `IN_STOCK`. Note that if an item is out of stock, you must set the `stock_state` field to be `OUT_OF_STOCK`. Leaving this field unspecified / as zero is not sufficient to mark the item out of stock.
            - `itemAttributes` GoogleCloudRecommendationengineV1beta1FeatureMap — FeatureMap represents extra features that customers want to include in the recommendation model for catalogs/user events as categorical/numerical features.
              - …
            - `id` string — Required. Catalog item ID. UTF-8 encoded string with a length limit of 128 characters.
          - `listId` string — Required for `add-to-list` and `remove-from-list` events. The id or name of the list that the item is being added to or removed from. Other event types should not set this field.
          - `purchaseTransaction` GoogleCloudRecommendationengineV1beta1PurchaseTransaction — A transaction represents the entire purchase transaction.
            - `revenue` number, float — Required. Total 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. This field is not required if the event type is `refund`.
            - `currencyCode` string — Required. Currency code. Use three-character ISO-4217 code. This field is not required if the event type is `refund`.
            - `id` string — Optional. The transaction ID with a length limit of 128 bytes.
            - `costs` object — Optional. All the costs associated with the product. These can be manufacturing costs, shipping expenses not borne by the end user, or any other costs. Total product cost such that profit = revenue - (sum(taxes) + sum(costs)) If product_cost is not set, then profit = revenue - tax - shipping - sum(CatalogItem.costs). If CatalogItem.cost is not specified for one of the items, CatalogItem.cost based profit *cannot* be calculated for this Transaction.
            - `taxes` object — Optional. All the taxes associated with the transaction.
        - `eventDetail` GoogleCloudRecommendationengineV1beta1EventDetail — User event details shared by all recommendation types.
          - `referrerUri` string — Optional. The referrer url of the current page. When using the JavaScript pixel, this value is filled in automatically.
          - `eventAttributes` GoogleCloudRecommendationengineV1beta1FeatureMap — FeatureMap represents extra features that customers want to include in the recommendation model for catalogs/user events as categorical/numerical features.
            - `categoricalFeatures` object — Categorical features that can take on one of a limited number of possible values. Some examples would be the brand/maker of a product, or country of a customer. Feature names and values must be UTF-8 encoded strings. For example: `{ "colors": {"value": ["yellow", "green"]}, "sizes": {"value":["S", "M"]}`
            - `numericalFeatures` object — Numerical features. Some examples would be the height/weight of a product, or age of a customer. Feature names must be UTF-8 encoded strings. For example: `{ "lengths_cm": {"value":[2.3, 15.4]}, "heights_cm": {"value":[8.1, 6.4]} }`
          - `uri` string — Optional. Complete url (window.location.href) of the user's current page. When using the JavaScript pixel, this value is filled in automatically. Maximum length 5KB.
          - `pageViewId` string — Optional. A unique id of a web page view. This should be kept the same for all user events triggered from the same pageview. For example, an item detail page view could trigger multiple events as the user is browsing the page. The `pageViewId` property should be kept the same for all these events so that they can be grouped together properly. This `pageViewId` will be automatically generated if using the JavaScript pixel.
          - `recommendationToken` string — Optional. Recommendation token included in the recommendation prediction response. This field enables accurate attribution of recommendation model performance. This token enables us to accurately attribute page view or purchase back to the event and the particular predict response containing this clicked/purchased item. If user clicks on product K in the recommendation results, pass the `PredictResponse.recommendationToken` property as a url parameter to product K's page. When recording events on product K's page, log the PredictResponse.recommendation_token to this field. Optional, but highly encouraged for user events that are the result of a recommendation prediction query.
          - `experimentIds` string[] — Optional. A list of identifiers for the independent experiment groups this user event belongs to. This is used to distinguish between user events associated with different experiment setups (e.g. using Recommendation Engine system, using different recommendation models).
        - `eventType` string — Required. User event type. Allowed values are: * `add-to-cart` Products being added to cart. * `add-to-list` Items being added to a list (shopping list, favorites etc). * `category-page-view` Special pages such as sale or promotion pages viewed. * `checkout-start` User starting a checkout process. * `detail-page-view` Products detail page viewed. * `home-page-view` Homepage viewed. * `page-visit` Generic page visits not included in the event types above. * `purchase-complete` User finishing a purchase. * `refund` Purchased items being refunded or returned. * `remove-from-cart` Products being removed from cart. * `remove-from-list` Items being removed from a list. * `search` Product search. * `shopping-cart-page-view` User viewing a shopping cart. * `impression` List of items displayed. Used by Google Tag Manager.
    - `bigQuerySource` GoogleCloudRecommendationengineV1beta1BigQuerySource — BigQuery source import data from.
      - `projectId` string — Optional. The project id (can be project # or id) that the BigQuery source is in. If not specified, inherits the project id from the parent request.
      - `datasetId` string — Required. The BigQuery data set to copy the data from.
      - `gcsStagingDir` string — Optional. Intermediate Cloud Storage directory used for the import. Can be specified if one wants to have the BigQuery export to a specific Cloud Storage directory.
      - `tableId` string — Required. The BigQuery table to copy the data from.
      - `dataSchema` string — Optional. The schema to use when parsing the data from the source. Supported values for catalog imports: 1: "catalog_recommendations_ai" using https://cloud.google.com/recommendations-ai/docs/upload-catalog#json (Default for catalogItems.import) 2: "catalog_merchant_center" using https://cloud.google.com/recommendations-ai/docs/upload-catalog#mc Supported values for user event imports: 1: "user_events_recommendations_ai" using https://cloud.google.com/recommendations-ai/docs/manage-user-events#import (Default for userEvents.import) 2. "user_events_ga360" using https://support.google.com/analytics/answer/3437719?hl=en
    - `gcsSource` GoogleCloudRecommendationengineV1beta1GcsSource — Google Cloud Storage location for input content. format.
      - `jsonSchema` string — Optional. The schema to use when parsing the data from the source. Supported values for catalog imports: 1: "catalog_recommendations_ai" using https://cloud.google.com/recommendations-ai/docs/upload-catalog#json (Default for catalogItems.import) 2: "catalog_merchant_center" using https://cloud.google.com/recommendations-ai/docs/upload-catalog#mc Supported values for user events imports: 1: "user_events_recommendations_ai" using https://cloud.google.com/recommendations-ai/docs/manage-user-events#import (Default for userEvents.import) 2. "user_events_ga360" using https://support.google.com/analytics/answer/3437719?hl=en
      - `inputUris` 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 catalog information](/recommendations-ai/docs/upload-catalog) for the expected file format and setup instructions.
    - `catalogInlineSource` GoogleCloudRecommendationengineV1beta1CatalogInlineSource — The inline source for the input config for ImportCatalogItems method.
      - `catalogItems` GoogleCloudRecommendationengineV1beta1CatalogItem[] — Optional. A list of catalog items to update/create. Recommended max of 10k items.
        - `description` string — Optional. Catalog item description. UTF-8 encoded string with a length limit of 5 KiB.
        - `title` string — Required. Catalog item title. UTF-8 encoded string with a length limit of 1 KiB.
        - `productMetadata` GoogleCloudRecommendationengineV1beta1ProductCatalogItem — ProductCatalogItem captures item metadata specific to retail products.
          - `exactPrice` GoogleCloudRecommendationengineV1beta1ProductCatalogItemExactPrice — Exact product price.
            - `displayPrice` number, float — Optional. Display price of the product.
            - `originalPrice` number, float — Optional. Price of the product without any discount. If zero, by default set to be the 'displayPrice'.
          - `costs` object — Optional. A map to pass the costs associated with the product. For example: {"manufacturing": 45.5} The profit of selling this item is computed like so: * If 'exactPrice' is provided, profit = displayPrice - sum(costs) * If 'priceRange' is provided, profit = minPrice - sum(costs)
          - `availableQuantity` string, int64 — Optional. The available quantity of the item.
          - `canonicalProductUri` string — Optional. Canonical URL directly linking to the item detail page with a length limit of 5 KiB..
          - `priceRange` GoogleCloudRecommendationengineV1beta1ProductCatalogItemPriceRange — Product price range when there are a range of prices for different variations of the same product.
            - `max` number, float — Required. The maximum product price.
            - `min` number, float — Required. The minimum product price.
          - `stockState` 'STOCK_STATE_UNSPECIFIED' | 'IN_STOCK' | 'OUT_OF_STOCK' | 'PREORDER' | 'BACKORDER' — Optional. Online stock state of the catalog item. Default is `IN_STOCK`.
          - `images` GoogleCloudRecommendationengineV1beta1Image[] — Optional. Product images for the catalog item.
            - `uri` string — Required. URL of the image with a length limit of 5 KiB.
            - `height` integer — Optional. Height of the image in number of pixels.
            - `width` integer — Optional. Width of the image in number of pixels.
          - `currencyCode` string — Optional. Only required if the price is set. Currency code for price/costs. Use three-character ISO-4217 code.
        - `tags` string[] — Optional. Filtering tags associated with the catalog item. Each tag should be a UTF-8 encoded string with a length limit of 1 KiB. This tag can be used for filtering recommendation results by passing the tag as part of the predict request filter.
        - `itemGroupId` string — Optional. Variant group identifier for prediction results. UTF-8 encoded string with a length limit of 128 bytes. This field must be enabled before it can be used. [Learn more](/recommendations-ai/docs/catalog#item-group-id).
        - `itemAttributes` GoogleCloudRecommendationengineV1beta1FeatureMap — FeatureMap represents extra features that customers want to include in the recommendation model for catalogs/user events as categorical/numerical features.
          - `categoricalFeatures` object — Categorical features that can take on one of a limited number of possible values. Some examples would be the brand/maker of a product, or country of a customer. Feature names and values must be UTF-8 encoded strings. For example: `{ "colors": {"value": ["yellow", "green"]}, "sizes": {"value":["S", "M"]}`
          - `numericalFeatures` object — Numerical features. Some examples would be the height/weight of a product, or age of a customer. Feature names must be UTF-8 encoded strings. For example: `{ "lengths_cm": {"value":[2.3, 15.4]}, "heights_cm": {"value":[8.1, 6.4]} }`
        - `id` string — Required. Catalog item identifier. UTF-8 encoded string with a length limit of 128 bytes. This id must be unique among all catalog items within the same catalog. It should also be used when logging user events in order for the user events to be joined with the Catalog.
        - `languageCode` string — Optional. Deprecated. The model automatically detects the text language. Your catalog can include text in different languages, but duplicating catalog items to provide text in multiple languages can result in degraded model performance.
        - `categoryHierarchies` GoogleCloudRecommendationengineV1beta1CatalogItemCategoryHierarchy[] — Required. Catalog item categories. This field is repeated for supporting one catalog item belonging to several parallel category hierarchies. For example, if a shoes product belongs to both ["Shoes & Accessories" -> "Shoes"] and ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be represented as: "categoryHierarchies": [ { "categories": ["Shoes & Accessories", "Shoes"]}, { "categories": ["Sports & Fitness", "Athletic Clothing", "Shoes"] } ]
          - `categories` string[] — Required. Catalog item categories. Each category should be a UTF-8 encoded string with a length limit of 2 KiB. Note that the order in the list denotes the specificity (from least to most specific).
  - `errorsConfig` GoogleCloudRecommendationengineV1beta1ImportErrorsConfig — Configuration of destination for Import related errors.
    - `gcsPrefix` 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.
  - `updateMask` string, google-fieldmask — Optional. Indicates which fields in the provided imported 'items' to update. If not set, will by default update all fields.

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/recommendationengine.md) · [All operations](https://skmtc.net/google/apis/recommendationengine/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/recommendationengine/versions/c67ad3b20e58/schema)
