Products
These endpoints are currently available via early-access only. To apply for access, please fill out this form.
Twitter merchants are able to send a synchronous batch request to view, create, edit, and delete products, instead of having to upload a feed file.
There are two types of products; individual products vs product groups. A product group is a group of multiple variants and is created when the user provides an item_group_id and has multiple variants for the product. When you call a fetch endpoint for products that includes grouped products, only the product that you subbmited first will be returned.
GET product_catalogs/:product_catalog_id/products¶
Retrieve details for some or all products associated with the specified Product Catalog.
Resource URL¶
https://ads-api.x.com/12/product_catalogs/:product_catalog_id/products
Request Parameters¶
Name | Description |
---|---|
item_group_key optional |
This is a Twitter-generated item group identifier. Type: string Example: |
count optional |
Specifies the number of records to try and retrieve per distinct request. Type: int Default:
100 Min, Max: 1 ,
100 |
cursor optional |
Specifies a cursor to get the next page of results. See Pagination for more information. Type: string Example:
|
Please refer to the product specifications guide for details about responses.
Example Request¶
GET https://ads-api.x.com/12/product_catalogs/1547080201384865792/products?count=1
Example Response¶
{
"request": {
"params": {
"product_catalog_id": "1547080201384865792",
"count": 1
}
},
"next_cursor": "1547080787865939970",
"data": [
{
"inventory": 5,
"custom_label_2": null,
"item_group_key": null,
"additional_image_link": null,
"size": null,
"mobile_link": null,
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
"price": "20.00 USD",
"gtin": null,
"age_group": "teen",
"availability": "in stock",
"product_type": "",
"color": null,
"custom_label_3": null,
"item_group_id": null,
"brand": "Twitter",
"product_key": "1547080787865939969",
"mpn": null,
"id": "123abc",
"custom_label_4": null,
"condition": "new",
"custom_label_0": null,
"sale_price": null,
"custom_label_1": null,
"link": "https://www.twitter.com/twtr_blue",
"sale_price_effective_date": null,
"image_link": "https://t.co/jeans_1.jpg",
"title": "My shoes",
"google_product_category": "Apparel & Accessories > Shoes",
"gender": "female"
}
]
}
PUT /product_catalogs/:product_catalog_id/products¶
Add new products or update existing ones via a batch request. In a single request, up to 25 products can be supported.
A PUT request needs all of the required fields from the attribute list below. If we do not recognize the “id”, we create a new product. If we recognize the “id” in your catalog, we update the corresponding existing product.
Request Attributes¶
Name | Description |
---|---|
id required |
Unique ID for the item. Use the SKU if possible. If there are multiple instances of the same ID, all instances will be ignored. Type: string Example: |
product_key required |
Unique product object identifier generated by Twitter. Type: string Example:
|
title required Max character limit: 150 (open-text) |
The name of the product. Should be the same name as the product from the landing product page given through link or mobile_link attributes. Type: string Example:
|
description required Max character limit: 5000 (open-text) |
The description of the product. This field does not support HTML and must be in plain text. Type: string Example:
|
availability required |
Current availability of your item. Select one of the possible values from the list below. Type: enum Possible Values:
|
condition required |
Condition of the item being sold. Select one of the possible values from the list below. Type: enum Possible Values:
|
price required |
Price of the item. Format the price as a number, followed by the 3-digit ISO currency code (ISO 4217 standards), with a space between cost and currency. Use a period (".") as the decimal point. Type: ISO 4217 Example:
|
link required |
URL of the product page specific to the product where people can buy the item. If a user is on a mobile device, and a mobile_link is included, the viewing user will be sent to the url provided via the mobile_link attribute. We’ll validate the URL according to RFCs. Specifically it must include “https”. Type: string Example:
|
image_link required |
URL for the primary image of your item. If you change the image later, the new image must use a different URL or the image will not update. Image specifications: - All images must be in JPG, GIF, WEBP, or PNG format.- We highly recommend product images are in square (1:1) format. - The minimum image size is 500 x 500 px. Image file size limit: 5 MB. Type: string Example:
|
brand Sometimes required Max character limit: 100 |
The brand name of the item. Required if a Global Trade Item Number (gtin) and Manufacturer Part Number (mpn) is not available, but encouraged to always include. Type: string Example:
|
gtin Sometimes required Max character limit: 100 |
The Global Trade Item Number (unique universal product identifier) of the item. This should be included when available, but is optional if mpn and/or brand is included. Enter the item's UPC, EAN, JAN, or ISBN. Type: string Example:
|
mpn Sometimes required |
The Manufacturer Part Number of the item. Required if a Global Trade Item Number (gtin) and Manufacturer Part Number (mpn) is not available, but encouraged to always include if available. Type: string Example: |
mobile_link optional |
URL of a mobile optimized version of the product page specific to the product where people can buy the item. If a user is on a mobile device, the viewing user will be sent to the url provided via the mobile_link attribute. We’ll validate the URL according to RFCs. Specifically it must include “https”. Type: string Example:
|
additional_image_link optional |
To add more images of your item, use additional_image_link. URLs should be comma separated. Follow the same specifications as mentioned in the image_link attribute. Include up to 10 additional images. Type: string Example:
|
google_product_category optional |
The category of the item, according to Google's product taxonomy. Use the category's taxonomy path or its category ID number. Note that in some cases, this category will be shown to Twitter users. Type: string Example:
|
product_type optional |
The category the item belongs to, according to your business's custom product taxonomy, if you have one. You can also enter a Google product category (google_product_category). Subcategories must be sent separated by “ > “. The > must be wrapped by spaces. Note that in some cases, this category will be shown to Twitter users. Type: string Example:
|
inventory optional |
The quantity of this item that you have available to sell on Twitter. If included, an item’s inventory value must be 1 or higher when its availability field is set to in stock for the item to be shown to users. Otherwise, this value could be greater than or equal to 0 when its availability field is set to available for order, or preorder for the item to be shown to users. Type: int Example:
|
sale_price optional |
The discounted price of the item. Format the price as a number, followed by the 3-digit ISO currency code (ISO 4217 standards), with a space between cost and currency. Use a period (".") as the decimal point. The sale_price must be lower than the price. Type: ISO 4217 Example: |
sale_price_effective_date optional |
Time range for the item’s sale period, including the date, time, and time zone when your sale starts and ends. If sale dates aren’t entered, any items with a sale_price will remain on sale until you remove their sale price. It is possible to provide just a start date without an end date, in which case the sale price will remain on sale from the start date until the sale price is removed.Start date must be before end date. Detailed instructions: 1) Type the start
date as YYYY-MM-DD. Type: ISO-8601 timestamps Example:
|
item_group_id Sometimes required |
Use the item_group_id attribute to group product variants together. Variants are a group of similar items that only differ from one another by product details like size, color, age_group, and gender. This field is required if your product has variants. Type: string Example: |
item_group_key optional |
This is a Twitter-generated item group id. Type: string Example: |
gender optional |
Determines gender for item sizing. Select one of the possible values from the list below. Type: enum Possible
Values: |
color optional |
The primary color of the product. Use one or more words to describe the color. Don’t use a hex code. Type: string Example: |
size optional |
Size of the item written as a word, abbreviation or number. Type: string Example: |
age_group optional |
The associated age group of the item. Select one of the possible values from the list below. Type: enum Possible
Values: |
custom_label_0 optional |
Extra custom label Type: string Example:
|
custom_label_1 optional |
Extra custom label Type: string Example:
|
custom_label_2 optional |
Extra custom label Type: string Example:
|
custom_label_3 optional |
Extra custom label Type: string Example:
|
custom_label_4 optional |
Extra custom label Type: string Example:
|
Response Parameters¶
Name | Description |
---|---|
warnings |
Warnings about your request Type: array Example:
|
errors |
Error messages about your request Type: array Example:
|
product_key |
Unique product object identifier generated by Twitter. Type: string Example:
|
id |
Unique ID for the item. Use the SKU if possible. If there are multiple instances of the same ID, all instances will be ignored. Type: string Example: |
status |
Status of your request Type: enum Example: CREATE_SUCCESS UPDATE_SUCCESS ERROR NO_CHANGE |
Example Request¶
PUT https://ads-api.x.com/12/product_catalogs/1547080201384865792/products
JSON BODY
{
"products": [
{
"id": "test-12345",
"title": "Test Product 1",
"description": "The product which was added from the upsert endpoint",
"availability": "in stock",
"condition": "new",
"link": "https://www.twitter.com/twtr_blue",
"image_link": "https://www.kurzweilai.net/images/Naam-Limits-of-Earth-Part1-001-earth-600x600.jpg",
"brand": "twitter",
"gtin": "1432563728",
"mpn": "3268793T",
"mobile_link": "https://www.twitter.com/twtr_blue",
"google_product_category": "Apparel & Accessories > Clothing > Dresses",
"product_type": "Apparel & Accessories > Clothing > Dresses",
"inventory": 2,
"price": "60.00 USD",
"gender": "female",
"color": "blue",
"size": "medium",
"sale_price": "50.00 USD",
"sale_price_effective_date": "2022-10-04T17:20:31.000Z/2022-10-10T04:00:00.000Z",
"age_group": "adult",
"custom_label_0": "custom value"
}
]
}
Example Response¶
{
"request": {
"params": {
"product_catalog_id": "1547080201384865792"
}
},
"data": {
"products_response": [
{
"warnings": [],
"errors": [],
"product_key": "1576769414321651714",
"id": "test-123456",
"status": "CREATE_SUCCESS"
}
]
}
}
Delete product_catalogs/:catalog_id/products¶
Deleting existing products. Please note that this is a permanent deletion.
Request Parameters¶
Name | Description |
---|---|
product_keys required |
Unique product object identifier generated by Twitter. Type: string Example:
|
Example Request¶
DELETE https://ads-api.x.com/12/product_catalogs/1569782857975087104/products
JSON BODY
{
"product_keys": [
"1576769414321651714",
"1577536549830344705"
]
}
Example Response¶
{
"request": {
"params": {
"product_keys": [
"1576769414321651714",
"1577536549830344705"
]
}
},
"data": {
"delete_products": [
{
"product_key": "1576769414321651714",
"failed_product_key": null,
"message": null
},
{
"product_key": "1577536549830344705",
"failed_product_key": null,
"message": null
}
]
}
}