# Update a price

To [update](https://docs.commercelayer.io/core/updating-resources) an existing price, send a `PATCH` request to the `/api/prices/:id` endpoint, where `id` is the ID of the resource that you want to update.

Here below the list of all the possible arguments that you can pass with the request body.

## Request

**PATCH** <https://yourdomain.commercelayer.io/api/prices/:id>

### Arguments

| Body Parameter                            | Type       | Required |
| ----------------------------------------- | ---------- | -------- |
| **type**                                  | `string`   | Required |
| **id**                                    | `string`   | Required |
| attributes.**sku\_code**                  | `string`   | Optional |
| attributes.**amount\_cents**              | `integer`  | Optional |
| attributes.**compare\_at\_amount\_cents** | `integer`  | Optional |
| attributes.**processed\_at**              | `datetime` | Optional |
| attributes.**reference**                  | `string`   | Optional |
| attributes.**reference\_origin**          | `string`   | Optional |
| attributes.**rules**                      | `object`   | Optional |
| attributes.**metadata**                   | `object`   | Optional |
| relationships.**price\_list**             | `object`   | Optional |
| relationships.**sku**                     | `object`   | Optional |
| relationships.**price\_tiers**            | `array`    | Optional |

### Example

{% tabs %}
{% tab title="Request" %}
The following request updates the price identified by the ID "XAyRWNUzyN":

```shell
curl -g -X PATCH \
  'https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "prices",
    "id": "xYZkjABcde",
    "attributes": {
      "sku_code": "TSHIRTMM000000FFFFFFXLXX"
    },
    "relationships": {
      "price_list": {
        "data": {
          "type": "price_lists",
          "id": "ABCRtyUpBa"
        }
      }
    }
  }
}'
```

{% endtab %}

{% tab title="Response" %}
On success, the API responds with a `200 OK` status code, returning the updated resource object:

```json
{
  "data": {
    "id": "XAyRWNUzyN",
    "type": "prices",
    "links": {
      "self": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN"
    },
    "attributes": {
      "currency_code": "EUR",
      "sku_code": "TSHIRTMM000000FFFFFFXLXX",
      "amount_cents": 10000,
      "amount_float": 100.0,
      "formatted_amount": "€100,00",
      "original_amount_cents": 10000,
      "formatted_original_amount": "€100,00",
      "compare_at_amount_cents": 13000,
      "compare_at_amount_float": 130.0,
      "formatted_compare_at_amount": "€130,00",
      "rule_outcomes": [

      ],
      "processed_at": "2018-01-01T12:00:00.000Z",
      "created_at": "2018-01-01T12:00:00.000Z",
      "updated_at": "2018-01-01T12:00:00.000Z",
      "reference": "ANY-EXTERNAL-REFEFERNCE",
      "reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
      "rules": {
      },
      "resource_payload": {
      },
      "jwt_custom_claim": {
      },
      "metadata": {
        "foo": "bar"
      }
    },
    "relationships": {
      "price_list": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/relationships/price_list",
          "related": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/price_list"
        }
      },
      "sku": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/relationships/sku",
          "related": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/sku"
        }
      },
      "price_tiers": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/relationships/price_tiers",
          "related": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/price_tiers"
        }
      },
      "price_volume_tiers": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/relationships/price_volume_tiers",
          "related": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/price_volume_tiers"
        }
      },
      "price_frequency_tiers": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/relationships/price_frequency_tiers",
          "related": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/price_frequency_tiers"
        }
      },
      "attachments": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/relationships/attachments",
          "related": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/attachments"
        }
      },
      "versions": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/relationships/versions",
          "related": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/versions"
        }
      },
      "jwt_customer": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/relationships/jwt_customer",
          "related": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/jwt_customer"
        }
      },
      "jwt_markets": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/relationships/jwt_markets",
          "related": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/jwt_markets"
        }
      },
      "jwt_stock_locations": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/relationships/jwt_stock_locations",
          "related": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/jwt_stock_locations"
        }
      },
      "event_stores": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/relationships/event_stores",
          "related": "https://yourdomain.commercelayer.io/api/prices/XAyRWNUzyN/event_stores"
        }
      }
    },
    "meta": {
      "mode": "test",
      "organization_id": "xRRkjDFafe",
      "trace_id": "69abaa3545913c78132e5578bd26208d44aa9043647d78698fd0021f3958cd74"
    }
  }
}
```

{% endtab %}
{% endtabs %}
