Method: accounts.generateProductTextSuggestions

accounts.generateProductTextSuggestions generates a set of candidate text completions (e.g., product titles, descriptions) based on provided product information. This endpoint leverages GenAI models to create suggestions for improving existing product text or generating new content.

HTTP request

POST https://merchantapi.googleapis.com/productstudio/v1alpha/{name=accounts/*}:generateProductTextSuggestions

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
name

string

Required. The name of the account to generate text suggestions for. This acts as a container for the request and does not affect the generation itself, as this is a stateless API. Format: accounts/{account}

Request body

The request body contains data with the following structure:

JSON representation
{
  "productInfo": {
    object (ProductInfo)
  },
  "titleExamples": [
    {
      object (TitleExample)
    }
  ],
  "outputSpec": {
    object (OutputSpec)
  }
}
Fields
productInfo

object (ProductInfo)

Required. Available information about the product. Used to inform the genAI models.

titleExamples[]

object (TitleExample)

Optional. Provide some hand-crafted examples of title improvements that are unique to your use case. This is a general tool that handles multiple product categories, but your brand identity may require custom functionality. Feel free to specify that here.

outputSpec

object (OutputSpec)

Optional. Configuration parameters that directly influence what content is generated, and how that content is rendered in the final response.

Response body

Response message for the accounts.generateProductTextSuggestions method.

If successful, the response body contains data with the following structure:

JSON representation
{
  "attributes": {
    string: string,
    ...
  },
  "title": {
    object (ProductTextGenerationSuggestion)
  },
  "description": {
    object (ProductTextGenerationSuggestion)
  },
  "metadata": {
    object (ProductTextGenerationMetadata)
  }
}
Fields
attributes

map (key: string, value: string)

Any other generated attributes.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

title

object (ProductTextGenerationSuggestion)

Generated title suggestion.

description

object (ProductTextGenerationSuggestion)

Generated description suggestion.

metadata

object (ProductTextGenerationMetadata)

Additional info that clients may want to audit surrounding the generation.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/content

For more information, see the OAuth 2.0 Overview.

ProductInfo

Available information about the product. Used to inform the genAI models.

JSON representation
{
  "productAttributes": {
    string: string,
    ...
  },
  "productImage": {
    object (Image)
  }
}
Fields
productAttributes

map (key: string, value: string)

Required. A mapping of all available product attributes. This may include title, description, brand, gender, color, size, etc.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

productImage

object (Image)

Optional. Image associated with the product.

Image

Product image represented as bytes directly or a URI.

JSON representation
{

  // Union field image can be only one of the following:
  "uri": string,
  "data": string
  // End of list of possible types for union field image.
}
Fields
Union field image. Required. The image to use for text generation. image can be only one of the following:
uri

string

Generally web-requestable URI.

data

string (bytes format)

Raw bytes for the image.

A base64-encoded string.

OutputSpec

Configuration parameters that directly influence what content is generated, and how that content is rendered in the final response.

JSON representation
{
  "attributeOrder": [
    string
  ],
  "workflowId": string,
  "tone": string,
  "editorialChanges": string,
  "targetLanguage": string,
  "attributeSeparator": string
}
Fields
attributeOrder[]

string

Optional. The order that generated attributes should be placed in the generated title. Eg., if the attribute order is ["brand", "product", "size"], the generated title will have brand first, followed by the product name, and then size information after that.

workflowId

string

Optional. The workflow to execute for the provided product data. Workflows may populate the response's title, description, or both. Currently supported workflow_ids are: "title", "description", and "tide"

tone

string

Optional. The tone of the output generated text. Supported tones are: "playful", "formal", "persuasive", and "conversational"

editorialChanges

string

Optional. Any editorial changes for the generated product data. For example, replace Small with "S", do not modify color if already present.

targetLanguage

string

Optional. The language for output titles/descriptions. For example. 'German', 'es', 'FR'. Default is 'en'.

attributeSeparator

string

Optional. Character used to separate attributes in the generated title. For example, '|', '-', ','.

TitleExample

A hand-crafted example of a product title improvement. These examples are provided to the AI to improve its quality and guide it towards required outputs.

JSON representation
{
  "productInfo": {
    string: string,
    ...
  },
  "finalProductInfo": {
    string: string,
    ...
  },
  "category": string,
  "titleFormat": string
}
Fields
productInfo

map (key: string, value: string)

Required. A map containing all existing product information. For example: {"title": "dress", "description": "A red dress", "brand": "Dresses4All"} Any information that you might use to populate your product feed.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

finalProductInfo

map (key: string, value: string)

Required. A map in the same format as productInfo but with all improvements included. For example, {"brand": "Dresses4All", "product": "dress", "color": "red", ...}. The order of attributes in this map may be used to guide the order in which they appear in the final generated title. For instance, the above will become: Dresses4All dress | red

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

category

string

Required. The product's category. This helps the AI understand when certain examples are more relevant than others.

titleFormat

string

Required. The attributes or approximate attributes that make up the title. For example, title "Google GShoe M" titleFormat can be "brand | product | size".

ProductTextGenerationSuggestion

Text generated for a product, optionally including its quality score.

JSON representation
{
  "text": string,
  "score": number,
  "changeSummary": string
}
Fields
text

string

The text generated

score

number

The quality score associated with the generation. Heuristic implemented according to the feedgen team's implementation styles.

changeSummary

string

A brief summarization of all the changes that have been made.

ProductTextGenerationMetadata

Wrapper data type for any metadata associated with text generation.

JSON representation
{
  "metadata": {
    object
  }
}
Fields
metadata

object (Struct format)

Metadata is a pretty loose concept. The data is modeled as a map here to indicate that there is no guaranteed structure to the output past a simple K:V association. The first use-case is to track words added/removed/changed in generations.