# Applying live changes

You can apply [live changes](https://app.gitbook.com/s/oUderMtztdH7OKDXmYbI/commerce-api-reference-guide/admin-apis-reference/live-changes) to key attributes associated with a deployed product or product variation. The following list summarizes the actions that prompt a live change to the product in your store:&#x20;

* Adding, editing, or removing a [category](https://app.gitbook.com/s/oUderMtztdH7OKDXmYbI/commerce-api-reference-guide/glossary#categories) assignment for a product.
* Adding, editing, or removing [pricing](https://app.gitbook.com/s/oUderMtztdH7OKDXmYbI/commerce-api-reference-guide/glossary#prices).&#x20;

If there are any [errors or warnings](https://docs.digitalriver.com/commerce-api/admin-apis/product-management/manage-products-asynchronous-api/applying-live-changes) when you apply a live change, they will appear in the response.

## Applying a live change to a base or individual product

The following [`POST /v1/products/{productId or ERID}/live-changes`](https://app.gitbook.com/s/drE2RCYBuoRpd2TC2sx2/product-management/manage-products-asynchronous-api#v1-products-productid-live-changes) request applies a change to a [base product](https://app.gitbook.com/s/oUderMtztdH7OKDXmYbI/commerce-api-reference-guide/admin-apis-reference/products#base-product) or [individual product](https://app.gitbook.com/s/oUderMtztdH7OKDXmYbI/commerce-api-reference-guide/admin-apis-reference/products#individual-product). To apply a live change to a specific base or individual product, you must provide either a [`productId` ](https://app.gitbook.com/s/oUderMtztdH7OKDXmYbI/commerce-api-reference-guide/api-structure/product-identifier)or [`ERID`](https://app.gitbook.com/s/oUderMtztdH7OKDXmYbI/commerce-api-reference-guide/api-structure/product-external-reference-identifier-erid).&#x20;

{% tabs %}
{% tab title="cURL" %}
The following example applies live changes to a product with a `productId`. See the [live-changes](https://app.gitbook.com/s/oUderMtztdH7OKDXmYbI/commerce-api-reference-guide/admin-apis-reference/live-changes) for more information.

<pre class="language-http"><code class="lang-http">curl --location --request POST 'https://api.digitalriver.com/v1/products/{productId}/live-changes' \
--header 'Authorization: Basic &#x3C;API_key>' \
--data-raw '{
<strong>{
</strong>  "externalReferenceId": "sku-1234-5678-xyz",
  "catalogs": [
    {
      "catalogId": "123456000",
      "categories": [
        {
          "categoryId": "19000000"
        }
      ],
      "prices": [
        {
          "type": "listPrice",
          "prices": [
            {
              "currency": "USD",
              "locale": "en_US",
              "configuredPrice": 15.99
            }
          ]
        }
      ]
    }
  ]
}
}
</code></pre>

An ERID request requires the `x-erid-as-pid=true` header.

```http
curl --location --request POST 'https://api.digitalriver.com/v1/products/{ERID}/live-changes' \
--header 'Authorization: Basic <API_key>' \
--header 'header x-erid-as-pid=true' \
--data-raw '{
{
  "externalReferenceId": "sku-1234-5678-xyz",
  "catalogs": [
    {
      "catalogId": "123456000",
      "categories": [
        {
          "categoryId": "19000000"
        }
      ],
      "prices": [
        {
          "type": "listPrice",
          "prices": [
            {
              "currency": "USD",
              "locale": "en_US",
              "configuredPrice": 15.99
            }
          ]
        }
      ]
    }
  ]
}
}
```

{% endtab %}

{% tab title="202 Accepted response" %}
The request returns a task identifier (`taskId`) in the [asynchronous ](https://docs.digitalriver.com/commerce-api/admin-apis/getting-started#asynchronous-and-synchronous-calls)response.

```json
{
  "taskId": "d8a81162-aaaa-bbbb-cccc-ea513d1afa82",
  "receivedTime": "2022-05-01T23:00:21.123Z",
  "taskStatus": "PUBLISHED",
  "requestType": "CREATE_PRODUCT"
}
```

Use the `taskId` in the response to [verify the successful completion of the request](https://docs.digitalriver.com/commerce-api/admin-apis/product-management/get-the-task-status-for-a-product-synchronous-api/getting-the-latest-information-on-a-product-task). You can also verify the successful completion of the task by [checking the product history](#product-history-attributes) in [Global Commerce](https://gc.digitalriver.com/gc/ent/login.do). Note that there may be a delay before these changes appear in Global Commerce.&#x20;
{% endtab %}
{% endtabs %}

## Applying a live change to a product variation

The following [`POST /v1/products/product/variations/{variationProductId or variationERID}/live-changes`](https://app.gitbook.com/s/drE2RCYBuoRpd2TC2sx2/product-management/manage-products-asynchronous-api#v1-products-productid-live-changes) request applies a change to a [product variation](https://app.gitbook.com/s/oUderMtztdH7OKDXmYbI/commerce-api-reference-guide/admin-apis-reference/products#product-variations). To apply a live change to a specific product variation, you must provide either a [`productId` ](https://app.gitbook.com/s/oUderMtztdH7OKDXmYbI/commerce-api-reference-guide/api-structure/product-identifier)or [`ERID`](https://app.gitbook.com/s/oUderMtztdH7OKDXmYbI/commerce-api-reference-guide/api-structure/product-external-reference-identifier-erid).

{% tabs %}
{% tab title="cURL" %}
The following example applies live changes to a product variation with a `productId`.

```http
curl --location --request POST 'https://api.digitalriver.com/v1/products/product/variations/{variationProductId}/live-changes' \
--header 'Authorization: Basic <API_key>' \
...
--data-raw '{
    "externalReferenceId": "{newVariationProductERID}"
}
```

An ERID request requires the `x-erid-as-pid=true` header.

```http
curl --location --request POST 'https://api.digitalriver.com/v1/products/product/variations/{variationERID}/live-changes' \
--header 'Authorization: Basic Basic <API_key>' \
--header 'header x-erid-as-pid=true' \
...
--data-raw '{
    "externalReferenceId": "{newVariationProductERID}"
}
```

{% endtab %}

{% tab title="202 Accepted Response" %}
The request returns a task identifier (`taskId`) in the [asynchronous ](https://docs.digitalriver.com/commerce-api/admin-apis/getting-started#asynchronous-and-synchronous-calls)response.

```json
{
    "taskId": "ea310126-cba4-46be-9cff-82dded915dbf",
    "requestType": "UPDATE_VARIATION_LIVE_CHANGE,"
    "taskStatus": "PUBLISHED",
    "receivedTime": "2022-08-24T17:10:09.864Z"
}
```

Use the `taskId` in the response to [verify the successful completion of the request](https://docs.digitalriver.com/commerce-api/admin-apis/product-management/get-the-task-status-for-a-product-synchronous-api/getting-the-latest-information-on-a-product-task). You can also verify the successful completion of the task by [checking the product history](#product-history-attributes) in [Global Commerce](https://gc.digitalriver.com/gc/ent/login.do). Note that there may be a delay before these changes appear in Global Commerce.&#x20;
{% endtab %}
{% endtabs %}
