---
title: XML API
slug: indexing-apis/XML
docTags: 
createdAt: 2022-04-17T08:40:55.000Z
---

The Klevu Indexing API is organized around [REST](http://en.wikipedia.org/wiki/Representational_State_Transfer). Our API has predictable resource-oriented URLs, accepts XML request bodies, returns [XML-encoded](https://en.wikipedia.org/wiki/XML) responses, and uses standard HTTP response codes, authentication, and verbs.&#x20;

Every record (e.g. a product, category, cms page etc.) sent to Klevu is maintained in a dedicated index for the respective store. The Indexing API is used for adding, updating or deleting records from this index.

The Indexing API requires that you first authenticate yourself to the Klevu servers. As a result of this authentication, you are provided with a **Session ID &#x20;**&#x77;hich you can use for subsequent requests to the Klevu servers.

## API Key & Endpoint

You must have a Klevu Search account to use the Klevu API. Please access the [Shop Info section](https://help.klevu.com/support/solutions/articles/5000876417-how-to-retrieve-js-rest-api-keys-cloud-search-url-from-klevu-dashboard-) of your Klevu Merchant Centre to retrieve the following credentials.

- **REST API Key** *(private key)* for submitting data to be indexed, eg. abcdefoobar==.
- **Product Synchronization URL** for submitting data to be indexed, eg. rest.klevu.com.

## What is a Record?

With Klevu a record can be a **Product**, a **Category page** or a **CMS page** that you want to index and make available in search results.
It can also be a custom record type such as a **Store** or **Recipe** or something like that.

When you submit a record for addition or update, you must submit the record with all of its details provided.
A list of mandatory and optional fields is provided below.
When you submit a record for deletion, however, you only need to submit its unique ID.

:::ExpandableHeading
## Attributes

**id** <font color="#8792a2">string</font> <font color="#8792a2">| </font>required

This is the unique identifier of a record. Klevu will use this ID for indexing, analytics and merchandising.

**itemGroupId** <font color="#8792a2">string</font> <font color="#8792a2">| </font>optional

If your data contains a shirt in 2 different colours and 3 different sizes, you must submit 6 product variants. To indicate which group each variant belongs to, specify a common value in this itemGroupId element.



**name** <font color="#8792a2">string</font> <font color="#8792a2">| </font>required

This is the name or title of your record.&#x20;



**sku** <font color="#8792a2">string</font> <font color="#8792a2">| </font>required

This is the unique SKU of the record, or Stock Keeping Unit.



**url** <font color="#8792a2">string</font> <font color="#8792a2">| </font>required

This is the URL where shoppers will be taken to when the record is clicked in the Klevu Search results. This must be a fully qualified URL, beginning `http://` or `https://`. Note that you may receive a 400: Bad Request if you submit a base URL that has not been configured in your Klevu Merchant Centre.



**currency** <font color="#8792a2">string</font> <font color="#8792a2">| </font>required

The currency code of the prices specified below, e.g. EUR, USD, GBP.



**price** <font color="#8792a2">double</font> <font color="#8792a2">| </font>required

The original price of your product, before any discounts. This can be used as was price when used in conjunction with salePrice. In the case of a non-product record, 0.0 must be provided as the value.



Permitted characters in this field are 0 to 9 (digits) and . (dot) for adding a decimal point. For example, 12999.00 is a valid value, however $12999 or 12,999.00 are not.Please specify the currency information in the separate currency element.

****

**salePrice** <font color="#8792a2">double</font> <font color="#8792a2">| </font>required

This is the final price of your product, after all applicable discounts. This can be used as 'now price' when used in conjunction with price. The format of this field is the same as price.



**startPrice** <font color="#8792a2">double</font> <font color="#8792a2">| </font>optional

If your record has multiple variants, this field can be used to show the lowest price across all variants, for displaying "as low as £100".



**toPrice** <font color="#8792a2">double</font> | optional

&#x20;If your record has multiple variants, this field can be used to show the highest price across all variants, for use in conjunction with startPrice to display "from £100 to £200".

***

**groupPrices** <font color="#8792a2">string</font> | optional

This field is mostly commonly used in Magento integrations for the customer group prices to be rendered on the frontend. The format of this field is: `1:General:100.00`. There are three colon : separated values in each price grouping. The first value represents the ID of the group, the second is the label, and the third is the price for that group.&#x20;



Please see the XML to the right for a full example.



**otherPrices** <font color="#8792a2">string </font>| optional
This is an improvement over `groupPrices`, in that the values specified here can also be used in conjunction with `priceFieldSuffix` to retrieve dynamic prices based on currencies and customer groups.



The format of this field is: `price_USD-group_1:100.00`. There are two colon `:` separated values in each price grouping. The first value represents the ID of the group and the second is the price for that group.The ID is made up of the following format: `price type_currency code-group_id`, with the group ID being optional if you are not using currencies.



Please see the XML to the right for a full example of the possible variations.



**inStock** <font color="#8792a2">string</font> | optional

This attribute indicates if your record is in stock or not. Provide a value of yes if in stock, and no otherwise. In case if you are not submitting stock status, **Klevu will consider product as out of stock.** Please configure [Klevu stock setting](https://help.klevu.com/support/solutions/articles/5000871482-hide-out-of-stock-products) to show out of stock products.



**category** <font color="#8792a2">string</font> | required

This attribute indicates the most specific category of the record being submitted. For example, if your product belongs to the following categories:&#x20;

- Mobiles & Accessories
  - Tablets
- Promotions
  - New In

It is only **Tablets** and **New In** that should be specified here, separated by a semicolon` ;,` for example: `Tablets;New In.`



**listCategory** <font color="#8792a2">string</font> | required
This field contains up to three pieces of data, depending on your use case. Each section of the field must be separated by a double semicolon `;;.`&#x20;

****

- **Record Type: &#x20;**&#x54;he first part is always required, a record type. You MUST provide one of the following values, whichever is most appropriate for your record:&#x20;
  - KLEVU\_PRODUCT  for Product records&#x20;
  - KLEVU\_CATEGORY  for Category records&#x20;
  - KLEVU\_CMS  for CMS Pages or Blog Articles&#x20;
  - YOUR\_TYPE  for your own custom entity, eg: ACME\_RECIPE&#x20;

- **Category Hierarchy:**  The second part is made up of the entire hierarchies of applicable categories the record belongs to, with each category within the hierarchy separated by a single semicolon ;. Using the same example as in category above, the following would be submitted for this section: Mobiles & Accessories;Tablets;;Promotions;New In. Group ID:  The third part is optional, and only needed if you plan to use the visibilityGroupID feature in API requests to control which customer groups can see which records. This is made up of a double semicolon ;; separated list of all applicable customer groups for this record, eg: customer\_group\_1;;wholesale\_group.See the XML to the right for a full example.



**image** <font color="#8792a2">string</font> | optional

This is the URL of an associated image for your record. This must be a fully qualified URL, beginning  `http:// ` or`  https://`



**imageHover** <font color="#8792a2">string</font> | optional

This field can be used to specify an additional image for your record to be used on mouse hover. The format is the same as for  image.



**shortDesc** <font color="#8792a2">string</font> | optional

The short description for your record. This field can be used to display a smaller description of a record in the search results.



**desc** <font color="#8792a2">string</font> | optional

The long description for your record. This can also be configured to be considered in search results, in which case both this value and  shortDesc  will become searchable.



**other** <font color="#8792a2">string</font> | optional

Use this field to specify filterable attributes for your product, to be used as facets. The value is made up of three values separated by colon ` :` , then each attribute is separated by a semicolon  `; : `&#x20;

- Attribute Code
- Caption or Label
- Value(s)&#x20;

For example:  occassion\:Occassion\:Christmas,Evening Wear . The  **attribute code**  here is a unique identifier of your attribute. The&#x20;**&#x20;attribute caption**  is used as the heading of your filter when displaying search results. If the attribute code, caption or values contain a comma, colon or semi-colon, they must be replaced with a space.



**otherAttributeToIndex** <font color="#8792a2">string</font> | optional

The format of this element is the same as the format of the `other element` above. The difference between the two is that  `other`  is used for displaying facets whereas  `otherAttributeToIndex`  is used for indexing and searching only. Populate this field with any attributes you want to be searchable, but not used as a facet.

****

**boostingAttribute** <font color="#8792a2">string</font> | optional

The score provided here is multiplied with the relevancy score to boost records at search time. Any decimal value between the range of 0.1 to 999 can be provided here. Provide a value greater than 1 to boost a record up the rankings. To de-boost or demote a record, provide a number that is greater than 0 and less than 1.



**rating&#x20;**<font color="#8792a2">string</font> | optional

A score between 0 and 5. This can be used for displaying a star rating with each record, and can also be used to apply a sort order of the highest-rated items.



**rating\_count&#x20;**<font color="#8792a2">string</font> | optional

Use this field to specify the number of ratings given by customers for your product.


**tags** <font color="#8792a2">string</font> | optional

Use this field to specify any important keywords applicable for your records.



**swatches** <font color="#8792a2">string</font> | optional

If your record has many variants, you can specify swatch data to be used across them. You must specify the same swatch data for all variants, and the format is made up of four elements, which is repeated with a suffix of 1, 2, 3, etc. for each variant:

- variantId1:  The Klevu ID of the variant, eg. 123-ABC.&#x20;
- variantColor1: The colour of the variant. Base CSS color name or HEX value.&#x20;
- variantSwatchImage1:  (optional) The URL of the image to be displayed as the swatch itself.&#x20;
- variantImage1:  The product image that this swatch represents.  See the XML below full example.



**additionalDataToReturn** <font color="#8792a2">string</font> | optional

If you have some data that you would like to be returned with the search response, populate that data in this field. The structure can be anything you like, but we recommend JSON. If you do not see this in your response data, please contact Klevu Support by submittng a support [ticket](https://help.klevu.com/support/tickets/new)
:::

## Requesting a Session ID

Use this call to authenticate yourself to the Klevu Indexing servers. In the response, you will be provided with a **Session ID** which you should use for all subsequent requests to the Klevu servers.

You will need your **REST API Key** and **Product Synchronization URL**. Please refer to the [Prerequisites](https://docs.klevu.com/apis/data-indexing#MUoVK) section for more information.

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://<productSynchronizationURL>/rest/service/startSession",
  "name": "Session ID",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [
      {
        "kind": "required",
        "name": "Authorization",
        "type": "string",
        "description": "Your Klevu REST API Key, eg. abcdefoobar=="
      }
    ],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "es3bXLF4dy_6T59tiQiUm",
        "code": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<message>\n  <status>SUCCESS</status>\n  <sessionId>Some-Session-ID</sessionId>\n</message>",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "es3bXLF4dy_6T59tiQiUm"
  },
  "examples": {
    "languages": [
      {
        "id": "9xe3U_6kfgSQDG_vz0FVa",
        "code": "curl --location --request POST 'http://rest2.ksearchnet.com/rest/service/startSession' \\\n--header 'Authorization:  abcdefoobar=='",
        "language": "curl",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "9xe3U_6kfgSQDG_vz0FVa"
  },
  "description": "The end point is used for obtaining session id. ",
  "currentNewParameter": {
    "label": "Header Parameter",
    "value": "headerParameters"
  },
  "autoGeneratedAnchorSlug": "session-id",
  "legacyHash": "8SZoXV_MK1UiYY0himHVi"
}
```
:::

## Adding New Records

You must provide each record in full, including all mandatory parameters for every record you submit.

**Prerequisites:**
You will also need a **Session ID**, please see the section above on [Requesting a Session ID](#).

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://<productSynchronizationURL>/rest/service/addRecords",
  "name": "Add New Records",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [
      {
        "kind": "required",
        "name": "Content-Type",
        "type": "String",
        "description": "The content type for the request. Please set this to application/xml. "
      }
    ],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "data-raw",
        "type": "string",
        "description": "The xml string for submitting record data. "
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "gh1drPGG88hpmPjQCpg6D",
        "code": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<message>\n  <status>SUCCESS</status>\n  <msg>3 records are marked for ADDITION</msg>\n</message>",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "gh1drPGG88hpmPjQCpg6D"
  },
  "examples": {
    "languages": [
      {
        "id": "Tqeg_tAzlX1Uewf-czPEm",
        "code": "curl --location --request POST 'https://<productSynchronizationURL>/rest/service/addRecords' \\\n--header 'Content-Type: application/xml' \\\n--data-raw '<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<request>\n    <sessionId>Your-Session-ID</sessionId>\n    <records>\n        <record>\n            <pairs>\n                <!-- IDs -->\n                <pair>\n                    <key>id</key>\n                    <value>123-ABC</value>\n                </pair>\n                <pair>\n                    <key>itemGroupId</key>\n                    <value>123</value>\n                </pair>\n\n                <!-- Product Information -->\n                <pair>\n                    <key>sku</key>\n                    <value>SKU-123-ABC</value>\n                </pair>\n                <pair>\n                    <key>name</key>\n                    <value>My Product Name</value>\n                </pair>\n                <pair>\n                    <key>inStock</key>\n                    <value>yes</value>\n                </pair>\n                <pair>\n                    <key>url</key>\n                    <value>https://your-website.com/products/123.html</value>\n                </pair>\n                <pair>\n                    <key>image</key>\n                    <value>https://your-website.com/images/products/123-abc.jpg</value>\n                </pair>\n                <pair>\n                    <key>imageHover</key>\n                    <value>https://your-website.com/images/products/hover/123-abc.jpg</value>\n                </pair>\n\n                <!-- Product Descriptions -->\n                <pair>\n                    <key>shortDesc</key>\n                    <value>My Short Description</value>\n                </pair>\n                <pair>\n                    <key>desc</key>\n                    <value>My Longer Description</value>\n                </pair>\n\n                <!-- Prices -->\n                <pair>\n                    <key>currency</key>\n                    <value>GBP</value>\n                </pair>\n                <pair>\n                    <key>price</key>\n                    <value>150.00</value>\n                </pair>\n                <pair>\n                    <key>salePrice</key>\n                    <value>100.00</value>\n                </pair>\n                <pair>\n                    <key>startPrice</key>\n                    <value>50.00</value>\n                </pair>\n                <pair>\n                    <key>toPrice</key>\n                    <value>200.00</value>\n                </pair>\n                <pair>\n                    <key>otherPrices</key>\n                    <value>price_GBP:150.00;price_USD:200.00;salePrice_GBP:100.00;salePrice_USD:150.00;startPrice_GBP:50.00;startPrice_USD:100.00;toPrice_GBP:200.00;toPrice_USD:300.00;price_GBP-test_group_1:100.00;price_USD-test_group_1:150.00;salePrice_GBP-test_group_1:80.00;salePrice_USD-test_group_1:100.00;startPrice_GBP-test_group_1:30.00;startPrice_USD-test_group_1:50.00;toPrice_GBP-test_group_1:180.00;toPrice_USD-test_group_1:200.00;price_GBP-test_group_2:90.00;price_USD-test_group_2:140.00;salePrice_GBP-test_group_2:70.00;salePrice_USD-test_group_2:90.00;startPrice_GBP-test_group_2:20.00;startPrice_USD-test_group_2:40.00;toPrice_GBP-test_group_2:170.00;toPrice_USD-test_group_2:190.00</value>\n                </pair>\n                <pair>\n                    <key>groupPrices</key>\n                    <value>test_group_1:Test Group 1:80.00;test_group_2:Test Group 2:70.00</value>\n                </pair>\n\n                <!-- Categorisation -->\n                <pair>\n                    <key>category</key>\n                    <value>Sub Category A-2;Sub Category B-2</value>\n                </pair>\n                <pair>\n                    <key>listCategory</key>\n                    <value>KLEVU_PRODUCT;;Category A;Sub Category A-1;Sub Category A-2;;Category B;Sub Category B-1;Sub Category B-2;;test_group_1;;test_group_2</value>\n                </pair>\n\n                <!-- Attributes -->\n                <pair>\n                    <key>other</key>\n                    <value>color:Colour:red;occasion:Occasion:Christmas,Evening Wear</value>\n                </pair>\n                <pair>\n                    <key>otherAttributeToIndex</key>\n                    <value>brand:Brand Name:Nike,Adidas;gtin:GTIN:123456789</value>\n                </pair>\n                <pair>\n                    <key>rating</key>\n                    <value>3.5</value>\n                </pair>\n                <pair>\n                    <key>rating_count</key>\n                    <value>10</value>\n                </pair>\n                <pair>\n                    <key>tags</key>\n                    <value>keyword 1,keyword 2</value>\n                </pair>\n\n                <!-- Swatches -->\n                <pair>\n                    <key>variantId1</key>\n                    <value>123-ABC</value>\n                </pair>\n                <pair>\n                    <key>variantColor1</key>\n                    <value>Red</value>\n                </pair>\n                <pair>\n                    <key>variantSwatchImage1</key>\n                    <value>https://your-website.com/images/swatches/red.jpg</value>\n                </pair>\n                <pair>\n                    <key>variantImage1</key>\n                    <value>https://your-website.com/images/products/456-abc.jpg</value>\n                </pair>\n\n                <pair>\n                    <key>variantId2</key>\n                    <value>123-BCD</value>\n                </pair>\n                <pair>\n                    <key>variantColor2</key>\n                    <value>White</value>\n                </pair>\n                <pair>\n                    <key>variantSwatchImage2</key>\n                    <value>https://your-website.com/images/swatches/white.jpg</value>\n                </pair>\n                <pair>\n                    <key>variantImage2</key>\n                    <value>https://your-website.com/images/products/123-def.jpg</value>\n                </pair>\n\n                <!-- Miscellaneous -->\n                <pair>\n                    <key>boostingAttribute</key>\n                    <value>5</value>\n                </pair>\n                <pair>\n                    <key>additionalDataToReturn</key>\n                    <value>{\"some_arbitrary\": \"data to return\"}</value>\n                </pair>\n            </pairs>\n        </record>\n    </records>\n</request>'",
        "language": "curl",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "Tqeg_tAzlX1Uewf-czPEm"
  },
  "description": "The end-point is used for adding new records to index. ",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "autoGeneratedAnchorSlug": "add-new-records",
  "legacyHash": "8XnxkImXkNEoraRLXKtpS"
}
```
:::

## Updating Existing Records

You must provide each record in full, including all mandatory parameters for every record you submit.

**Prerequisites:**
You will also need a **Session ID**, please see the section above on [Requesting a Session ID](#).

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://<productSynchronizationURL>/rest/service/updateRecords",
  "name": "Update Existing Records",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [
      {
        "kind": "required",
        "name": "Content-Type",
        "type": "String",
        "description": "The content type for the request. Please set this to application/xml. "
      }
    ],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "data-raw",
        "type": "string",
        "description": "The xml string for submitting record data. "
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "gh1drPGG88hpmPjQCpg6D",
        "code": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<message>\n  <status>SUCCESS</status>\n  <msg>3 records are marked for UPDATING</msg>\n</message>",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "gh1drPGG88hpmPjQCpg6D"
  },
  "examples": {
    "languages": [
      {
        "id": "Tqeg_tAzlX1Uewf-czPEm",
        "code": "curl --location --request POST 'https://<productSynchronizationURL>/rest/service/updateRecords' \\\n--header 'Content-Type: application/xml' \\\n--data-raw '<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<request>\n    <sessionId>Your-Session-ID</sessionId>\n    <records>\n        <record>\n            <pairs>\n                <!-- IDs -->\n                <pair>\n                    <key>id</key>\n                    <value>123-ABC</value>\n                </pair>\n                <pair>\n                    <key>itemGroupId</key>\n                    <value>123</value>\n                </pair>\n\n                <!-- Product Information -->\n                <pair>\n                    <key>sku</key>\n                    <value>SKU-123-ABC</value>\n                </pair>\n                <pair>\n                    <key>name</key>\n                    <value>My Product Name</value>\n                </pair>\n                <pair>\n                    <key>inStock</key>\n                    <value>yes</value>\n                </pair>\n                <pair>\n                    <key>url</key>\n                    <value>https://your-website.com/products/123.html</value>\n                </pair>\n                <pair>\n                    <key>image</key>\n                    <value>https://your-website.com/images/products/123-abc.jpg</value>\n                </pair>\n                <pair>\n                    <key>imageHover</key>\n                    <value>https://your-website.com/images/products/hover/123-abc.jpg</value>\n                </pair>\n\n                <!-- Product Descriptions -->\n                <pair>\n                    <key>shortDesc</key>\n                    <value>My Short Description</value>\n                </pair>\n                <pair>\n                    <key>desc</key>\n                    <value>My Longer Description</value>\n                </pair>\n\n                <!-- Prices -->\n                <pair>\n                    <key>currency</key>\n                    <value>GBP</value>\n                </pair>\n                <pair>\n                    <key>price</key>\n                    <value>150.00</value>\n                </pair>\n                <pair>\n                    <key>salePrice</key>\n                    <value>100.00</value>\n                </pair>\n                <pair>\n                    <key>startPrice</key>\n                    <value>50.00</value>\n                </pair>\n                <pair>\n                    <key>toPrice</key>\n                    <value>200.00</value>\n                </pair>\n                <pair>\n                    <key>otherPrices</key>\n                    <value>price_GBP:150.00;price_USD:200.00;salePrice_GBP:100.00;salePrice_USD:150.00;startPrice_GBP:50.00;startPrice_USD:100.00;toPrice_GBP:200.00;toPrice_USD:300.00;price_GBP-test_group_1:100.00;price_USD-test_group_1:150.00;salePrice_GBP-test_group_1:80.00;salePrice_USD-test_group_1:100.00;startPrice_GBP-test_group_1:30.00;startPrice_USD-test_group_1:50.00;toPrice_GBP-test_group_1:180.00;toPrice_USD-test_group_1:200.00;price_GBP-test_group_2:90.00;price_USD-test_group_2:140.00;salePrice_GBP-test_group_2:70.00;salePrice_USD-test_group_2:90.00;startPrice_GBP-test_group_2:20.00;startPrice_USD-test_group_2:40.00;toPrice_GBP-test_group_2:170.00;toPrice_USD-test_group_2:190.00</value>\n                </pair>\n                <pair>\n                    <key>groupPrices</key>\n                    <value>test_group_1:Test Group 1:80.00;test_group_2:Test Group 2:70.00</value>\n                </pair>\n\n                <!-- Categorisation -->\n                <pair>\n                    <key>category</key>\n                    <value>Sub Category A-2;Sub Category B-2</value>\n                </pair>\n                <pair>\n                    <key>listCategory</key>\n                    <value>KLEVU_PRODUCT;;Category A;Sub Category A-1;Sub Category A-2;;Category B;Sub Category B-1;Sub Category B-2;;test_group_1;;test_group_2</value>\n                </pair>\n\n                <!-- Attributes -->\n                <pair>\n                    <key>other</key>\n                    <value>color:Colour:red;occasion:Occasion:Christmas,Evening Wear</value>\n                </pair>\n                <pair>\n                    <key>otherAttributeToIndex</key>\n                    <value>brand:Brand Name:Nike,Adidas;gtin:GTIN:123456789</value>\n                </pair>\n                <pair>\n                    <key>rating</key>\n                    <value>3.5</value>\n                </pair>\n                <pair>\n                    <key>rating_count</key>\n                    <value>10</value>\n                </pair>\n                <pair>\n                    <key>tags</key>\n                    <value>keyword 1,keyword 2</value>\n                </pair>\n\n                <!-- Swatches -->\n                <pair>\n                    <key>variantId1</key>\n                    <value>123-ABC</value>\n                </pair>\n                <pair>\n                    <key>variantColor1</key>\n                    <value>Blue</value>\n                </pair>\n                <pair>\n                    <key>variantSwatchImage1</key>\n                    <value>https://your-website.com/images/swatches/blue.jpg</value>\n                </pair>\n                <pair>\n                    <key>variantImage1</key>\n                    <value>https://your-website.com/images/products/123-abc.jpg</value>\n                </pair>\n\n                <pair>\n                    <key>variantId2</key>\n                    <value>123-BCD</value>\n                </pair>\n                <pair>\n                    <key>variantColor2</key>\n                    <value>White</value>\n                </pair>\n                <pair>\n                    <key>variantSwatchImage2</key>\n                    <value>https://your-website.com/images/swatches/white.jpg</value>\n                </pair>\n                <pair>\n                    <key>variantImage2</key>\n                    <value>https://your-website.com/images/products/123-def.jpg</value>\n                </pair>\n\n                <!-- Miscellaneous -->\n                <pair>\n                    <key>boostingAttribute</key>\n                    <value>5</value>\n                </pair>\n                <pair>\n                    <key>additionalDataToReturn</key>\n                    <value>{\"some_arbitrary\": \"data to return\"}</value>\n                </pair>\n            </pairs>\n        </record>\n    </records>\n</request>'",
        "language": "curl",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "Tqeg_tAzlX1Uewf-czPEm"
  },
  "description": "The end-point is used for updating existing records to index. ",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "autoGeneratedAnchorSlug": "update-existing-records",
  "legacyHash": "2lleBKf_wDz2xX809FJbL"
}
```
:::

## Deleting Existing Records

You must provide the unique IDs of the records you wish to delete.

**Prerequisites:**
You will also need a **Session ID**, please see the section above on [Requesting a Session ID](#).

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://<productSynchronizationURL>/rest/service/deleteRecords",
  "name": "Delete Existing Records",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [
      {
        "kind": "required",
        "name": "Content-Type",
        "type": "String",
        "description": "The content type for the request. Please set this to application/xml. "
      }
    ],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "data-raw",
        "type": "string",
        "description": "The xml string for submitting record data. "
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "gh1drPGG88hpmPjQCpg6D",
        "code": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<message>\n  <status>SUCCESS</status>\n  <msg>1 record is marked for DELETION</msg>\n</message>",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "gh1drPGG88hpmPjQCpg6D"
  },
  "examples": {
    "languages": [
      {
        "id": "Tqeg_tAzlX1Uewf-czPEm",
        "code": "curl --location --request POST 'https://<productSynchronizationURL>/rest/service/deleteRecords' \\\n--header 'Content-Type: application/xml' \\\n--data-raw '<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<request>\n    <sessionId>Your-Session-ID</sessionId>\n    <records>\n        <record>\n            <pairs>\n                <!-- IDs -->\n                <pair>\n                    <key>id</key>\n                    <value>123-ABC</value>\n                </pair>\n            </pairs>\n        </record>\n    </records>\n</request>'",
        "language": "curl",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "Tqeg_tAzlX1Uewf-czPEm"
  },
  "description": "The end-point is used for adding new records to index. ",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "autoGeneratedAnchorSlug": "delete-existing-records",
  "legacyHash": "q45uqTFCM5lfilfcjx_zC"
}
```
:::

