Product Update

Updated on October 2, 2024

The Product Update API #

The product update API allows you to send bulk catalog updates to Releva. Any catalog updates submitted through this API will be live within 10 seconds of receiving a successful response.

Do I need to call it? #

Yes, you need to call it whenever changes occur in your catalog – for example when a product (or products) becomes out of stock, or in stock, or the price changes. This is the primary method Releva uses to learn about changes in your catalogue.

Request Parameters #

You may perform requests to the API using the following curl equivalent:

curl -H 'Content-Type: application/json' -H 'Authorization: Bearer <secretKey>' -XPOST https://releva.ai/api/v0/products -d'{
  "products": [
    {
      "id": "productId1",
      "name": "Test Product",
      "description": "Some Description",
      "locale": "en",
      "currency": "USD",
      "listPrice": 12.5,
      "discountPrice": 10.99,
      "categories": [
        "men/shoes/hiking"
      ],
      "available": true,
      "url": "https://my-awesome-shop/products/productId1",
      "imageUrl": "https://cdn.my-awesome-shop/products/productId1_img1.png",
      "publishedAt": "2019-06-19T23:45:56",
      "custom": {
        "string": [
          {"key": "color", "values": ["red", "blue"]}
        ],
        "numeric": [
          {"key": "size", "values": [14, 15, 18]}
        ],
        "date": [
           {"key": "in_promo_until", "values": ["2022-11-01T00:00:00.000Z"]}
        ]
      },
      "inventory": [
        {
          "location": [
             {"lat": 39.9352959, "lon": 23.5825895}
          ]
        }
      ]
    }
  ]
}'

What if my products have variants and each variant has a different URL? #

If you sell multi-variant products, you need to send them as individual products to Releva, and the id field which you pass to Releva should be based on the variant id in your catalogue.

In addition, you need to pass product_id (this should be id of the product this variant belongs to) custom field as part of the API call as well as any other attributes (e.g. size, color, etc.) that are specific to a variant. Here is an example:

curl -H 'Content-Type: application/json' -H 'Authorization: Bearer <secretKey>' -XPOST https://releva.ai/api/v0/products -d'{
  "deleteMissingVariants": false,
  "products": [
    {
      "id": "variantId1",
      "name": "Test Product",
      "description": "Some Description",
      "locale": "en",
      "currency": "USD",
      "listPrice": 12.5,
      "discountPrice": 10.99,
      "categories": [
        "men/shoes/hiking"
      ],
      "available": true,
      "url": "https://my-awesome-shop/products/productId1",
      "imageUrl": "https://cdn.my-awesome-shop/products/productId1_img1.png",
      "publishedAt": "2019-06-19T23:45:56",
      "custom": {
        "string": [
          {"key": "product_id", "values": ["productId1"]},
          {"key": "size", "values": ["S"]},
          {"key": "color", "values": ["red"]}
        ]
      }
    },
    {
      "id": "variantId2",
      "name": "Test Product",
      "description": "Some Description",
      "locale": "en",
      "currency": "USD",
      "listPrice": 10.5,
      "discountPrice": 8.99,
      "categories": [
        "men/shoes/hiking"
      ],
      "available": true,
      "url": "https://my-awesome-shop/products/productId1",
      "imageUrl": "https://cdn.my-awesome-shop/products/productId1_img1.png",
      "publishedAt": "2019-06-19T23:45:56",
      "custom": {
        "string": [
          {"key": "product_id", "values": ["productId1"]},
          {"key": "size", "values": ["L"]},
          {"key": "color", "values": ["blue"]}
        ]
      }
    }
  ]
}'

Note: Setting deleteMissingVariants to true activates a special cleanup logic – for each product_id in the current API call, we will delete all variants which are not part of the products list in the request body. Only use this option if you cannot implement the regular Product Delete mechanism.

The products Array #

This object is an array of Objects with the following properties.

FieldTypeDescription
idStringA unique product ID identifying your product. Note that if you have a multi-locale shop ( you sell in multiple languages / currencies), this id will need to be unique across all locales.
nameStringThe product name.
descriptionStringA short description of the product.
localeISO-639-1 String (Optional)If you sell in multiple languages or currencies, set this to the current locale. If you omit this field, the shop default will be used.
currencyISO-4217 String (Optional)The product currency. If you omit this field, the shop default will be used.
dataObject (Optional)Arbitrary non-searchable product data. Use this to pass through product information that you would like to visualize in recommender results.
listPriceFloatThe regular price of the product.
discountPriceFloatIf the product is on sale, set the discount price here. If not do not include this field.
categoriesArray[String]Array of category paths where the product is accessible, e.g. ["men/shoes", "men/shoes/hikings", "sports/hiking/shoes"]
availableBooleanTrue if the product is available for sale, false otherwise.
urlAbsolute URL StringThe product URL.
imageUrlAbsolute URL StringThe URL to the product’s image.
customObject (Optional)The custom fields associated with the currently viewed product, for example the available sizes.
publishedAtISO-8601 StringThe date and time when this product was first available for sale.
inventoryArray[Object] (Optional)Product inventory information
inventory[].locationArray[Object] (Optional)Inventory locations in decimal longitude, latitude notation
inventory[].location[].lonFloatinventory location longitude, e.g. 23.5825895
inventory[].location[].latFloatinventory location latitude, e.g. 39.9352959

Response Format #

A successful response will return HTTP Status 202 with an empty response body ({}).

An error response will return a HTTP 4xx or 5xx status code and have the following structure:

{
  "message": "A description of the error and how to fix it, if it's a client error."
}