# Create a price

To [create](https://docs.commercelayer.io/core/creating-resources) a new price, send a `POST` request to the `/api/prices` endpoint, passing the resource arguments in the request body.

## Request

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

### Arguments

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

### Example

{% tabs %}
{% tab title="Request" %}
The following request creates a new price:

```shell
curl -g -X POST \
  'https://yourdomain.commercelayer.io/api/prices' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "prices",
    "attributes": {
      "amount_cents": 10000
    },
    "relationships": {
      "price_list": {
        "data": {
          "type": "price_lists",
          "id": "ABCRtyUpBa"
        }
      },
      "sku": {
        "data": {
          "type": "skus",
          "id": "BCDRtyUpBa"
        }
      }
    }
  }
}'
```

{% endtab %}

{% tab title="Response" %}
On success, the API responds with a `201 Created` status code, returning the created 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 %}
