Skip to main content

Add a Product Price to a Price Book

POST 

https://euwest.api.elasticpath.com/pcm/pricebooks/:pricebookID/prices

Price books contain prices for the products in your catalog. Use the Prices API to adds the prices for a product to a specified price book. If the prices for the product already exist in the price book, the operation fails and the existing product prices are not updated.

Request

Path Parameters

    pricebookID stringrequired

    The unique identifier of a price book.

Bodyrequired

A product price with the following attributes.
    data objectrequired
    type stringrequired

    Possible values: [product-price]

    Default value: product-price
    Example: product-price
    attributes objectrequired
    currencies objectrequired

    A collection of one or more currencies objects that consists of the three-letter ISO code of the currencies associated with this price and the amount. This is the product's price.

    property name* amount

    The three-letter ISO code for the currency associated with this price.

    amount int64nullable

    The price in the lowest denomination for the specified currency. This is a product's list price.

    Example: 100
    includes_tax boolean

    Whether this price includes tax.

    Default value: false
    Example: false
    tiers object

    The price tier that an item is eligible for based on the quantity purchased. You cannot have conflicting tiers within the same currencies block.

    property name* tier-price

    The name of the tier, for example, Pencils.

    minimum_quantity int64nullable

    The minimum quantity of 1 or more defined for the specified price. If a minimum quantity is not specified, an error is returned.

    Example: 10
    amount int64nullable

    The price for each quantity.

    Example: 50
    sku stringrequired

    The product SKU that the prices belongs to.

    Possible values: non-empty

    Example: product-sku-a
    sales object

    The sales price that an item is eligible for based on the price book.

    property name* sale

    The name of the sale, such as Summer Sale.

    bundle_ids uuid[]

    A list of product IDs in a bundle that you want to specify a sale price for.

    schedule objectnullable

    The schedule of the sale. Contains an optional valid_from and valid_to parameter for the start and end date of a sale.

    For sale prices in the same price book:

    • the schedules must not be exactly the same.
    • schedules can partially overlap. If the schedule does contain overlapping sales prices, the sale price of the smallest sale period is chosen.
    • if you have just one sale price, without a schedule, this is effectively a permanent price. If you want to add more sale prices to the price book, you must configure a schedule for the sale price.

    Sale prices in different price books can have overlapping schedules.

    valid_from date-timenullable

    The start date of the sale.

    Example: 2023-09-22T09:00:00Z
    valid_to date-timenullable

    The end date of the sale.

    Example: 2023-09-24T09:00:00Z
    currencies object

    A collection of one or more currencies objects that consists of the three-letter ISO code of the currencies associated with this price and the amount. This is the product's price.

    property name* amount

    The three-letter ISO code for the currency associated with this price.

    amount int64nullable

    The price in the lowest denomination for the specified currency. This is a product's list price.

    Example: 100
    includes_tax boolean

    Whether this price includes tax.

    Default value: false
    Example: false
    tiers object

    The price tier that an item is eligible for based on the quantity purchased. You cannot have conflicting tiers within the same currencies block.

    property name* tier-price

    The name of the tier, for example, Pencils.

    minimum_quantity int64nullable

    The minimum quantity of 1 or more defined for the specified price. If a minimum quantity is not specified, an error is returned.

    Example: 10
    amount int64nullable

    The price for each quantity.

    Example: 50
    external_ref stringnullable

    A unique attribute that you could use to contain information from another company system, for example. The maximum length is 2048 characters.

    Example: a-external-ref
    admin_attributes object

    You can add custom attributes to a product price. For example, you may want to add custom attributes that can automate price updates based on predefined rules, saving time and reducing human error or you might want to integrate price attributes with your other company systems, (ERP, CRM) ensuring consistency and accuracy across platforms.

    admin_attributes are not displayed in catalogs. This means admin_attributes can only be viewed by administrators. If you want a custom attribute to be displayed in a catalog, you must add a shopper_attribute.

    admin_attributes are structured as key-value pairs. Both the keys and values are strings. You can have up to 100 keys.

    property name* stringnullable
    shopper_attributes object

    You can add custom attributes to a product price. For example, you can set prices based on customer segments. For instance, you can offer different prices for wholesale and retail customers or provide discounts to loyal customers. Following on from this, you might want to offer personalized offers and prices, enhancing the shopping experience.

    shopper_attributes are displayed in catalogs. This means shopper_attributes can be viewed by both shoppers and administrators. If you do not want a custom attribute to be displayed in a catalog, you must add an admin_attribute.

    shopper_attributes are structured as key-value pairs. Both the keys and values are strings. You can have up to 100 keys.

    property name* stringnullable

Responses

A product price with the following attributes.
Schema
    data objectrequired
    type stringrequired

    Possible values: [product-price]

    Default value: product-price
    Example: product-price
    pricebook_external_ref stringnullable

    The unique attribute associated with the price book. This can be an external reference from a separate company system, for example. The maximum length is 2048 characters.

    Example: a-pricebook-external-ref
    attributes objectrequired
    currencies object

    A collection of one or more currencies objects that consists of the three-letter ISO code of the currencies associated with this price and the amount. This is the product's price.

    property name* amount

    The three-letter ISO code for the currency associated with this price.

    amount int64nullable

    The price in the lowest denomination for the specified currency. This is a product's list price.

    Example: 100
    includes_tax boolean

    Whether this price includes tax.

    Default value: false
    Example: false
    tiers object

    The price tier that an item is eligible for based on the quantity purchased. You cannot have conflicting tiers within the same currencies block.

    property name* tier-price

    The name of the tier, for example, Pencils.

    minimum_quantity int64nullable

    The minimum quantity of 1 or more defined for the specified price. If a minimum quantity is not specified, an error is returned.

    Example: 10
    amount int64nullable

    The price for each quantity.

    Example: 50
    sku stringrequired

    The product SKU that the price belongs to.

    Possible values: non-empty

    Example: product-sku-a
    sales object

    The sales price that an item is eligible for based on the price book.

    property name* sale

    The name of the sale, such as Summer Sale.

    bundle_ids uuid[]

    A list of product IDs in a bundle that you want to specify a sale price for.

    schedule objectnullable

    The schedule of the sale. Contains an optional valid_from and valid_to parameter for the start and end date of a sale.

    For sale prices in the same price book:

    • the schedules must not be exactly the same.
    • schedules can partially overlap. If the schedule does contain overlapping sales prices, the sale price of the smallest sale period is chosen.
    • if you have just one sale price, without a schedule, this is effectively a permanent price. If you want to add more sale prices to the price book, you must configure a schedule for the sale price.

    Sale prices in different price books can have overlapping schedules.

    valid_from date-timenullable

    The start date of the sale.

    Example: 2023-09-22T09:00:00Z
    valid_to date-timenullable

    The end date of the sale.

    Example: 2023-09-24T09:00:00Z
    currencies object

    A collection of one or more currencies objects that consists of the three-letter ISO code of the currencies associated with this price and the amount. This is the product's price.

    property name* amount

    The three-letter ISO code for the currency associated with this price.

    amount int64nullable

    The price in the lowest denomination for the specified currency. This is a product's list price.

    Example: 100
    includes_tax boolean

    Whether this price includes tax.

    Default value: false
    Example: false
    tiers object

    The price tier that an item is eligible for based on the quantity purchased. You cannot have conflicting tiers within the same currencies block.

    property name* tier-price

    The name of the tier, for example, Pencils.

    minimum_quantity int64nullable

    The minimum quantity of 1 or more defined for the specified price. If a minimum quantity is not specified, an error is returned.

    Example: 10
    amount int64nullable

    The price for each quantity.

    Example: 50
    external_ref stringnullable

    A unique attribute that you could use to contain information from another company system, for example. The maximum length is 2048 characters.

    Example: external-ref
    created_at date-time

    The date and time when the price was created.

    Example: 2020-09-22T09:00:00Z
    updated_at date-time

    The date and time when the price was last updated.

    Example: 2020-09-22T09:00:00Z
    admin_attributes object

    You can add custom attributes to a product price. For example, you may want to add custom attributes that can automate price updates based on predefined rules, saving time and reducing human error or you might want to integrate price attributes with your other company systems, (ERP, CRM) ensuring consistency and accuracy across platforms.

    admin_attributes are not displayed in catalogs. This means admin_attributes can only be viewed by administrators. If you want a custom attribute to be displayed in a catalog, you must add a shopper_attribute.

    admin_attributes are structured as key-value pairs. Both the keys and values are strings. You can have up to 100 keys.

    property name* stringnullable
    shopper_attributes object

    You can add custom attributes to a product price. For example, you can set prices based on customer segments. For instance, you can offer different prices for wholesale and retail customers or provide discounts to loyal customers. Following on from this, you might want to offer personalized offers and prices, enhancing the shopping experience.

    shopper_attributes are displayed in catalogs. This means shopper_attributes can be viewed by both shoppers and administrators. If you do not want a custom attribute to be displayed in a catalog, you must add an admin_attribute.

    shopper_attributes are structured as key-value pairs. Both the keys and values are strings. You can have up to 100 keys.

    property name* stringnullable
    id stringrequired

    The unique identifier for the product price.

    Example: a915553d-935d-4d56-870b-817b47a44a99
    meta object

    Information that provides context to other data sets.

    owner stringnullable

    The resource owner, either organization or store.

    Example: store
    pricebook_id string

    The unique identifier of the price book.

    Example: 4c45e4ec-26e0-4043-86e4-c15b9cf985a7
    links object

    Links are used to allow you to move between requests.

    self urinullable

    Single entities use a self parameter with a link to that specific resource.

    Example: /pcm/pricebooks/4c45e4ec-26e0-4043-86e4-c15b9cf985a7/prices/ad042b07-e86d-476a-82d5-43dda1f80d03

Authorization: Authorization

name: Authorizationtype: httpin: headerscheme: bearer
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://euwest.api.elasticpath.com/pcm/pricebooks/:pricebookID/prices");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <TOKEN>");
var content = new StringContent("{\n \"data\": {\n \"type\": \"product-price\",\n \"attributes\": {\n \"currencies\": {\n \"USD\": {\n \"amount\": 100,\n \"includes_tax\": false,\n \"tiers\": {\n \"min_5\": {\n \"minimum_quantity\": 5,\n \"amount\": 50\n }\n }\n },\n \"CAD\": {\n \"amount\": 127,\n \"includes_tax\": false,\n \"tiers\": {\n \"min_10\": {\n \"minimum_quantity\": 10,\n \"amount\": 100\n }\n }\n },\n \"GBP\": {\n \"amount\": 73,\n \"includes_tax\": true,\n \"tiers\": {\n \"min_20\": {\n \"minimum_quantity\": 20,\n \"amount\": 60\n }\n }\n }\n },\n \"sku\": \"product-sku-a\",\n \"sales\": {\n \"summer\": {\n \"schedule\": {\n \"valid_form\": \"2023-12-24T09:00:00\",\n \"valid_to\": \"2023-12-25T09:00:00\"\n },\n \"currencies\": {\n \"USD\": {\n \"amount\": 90,\n \"includes_tax\": false,\n \"tiers\": {\n \"min_5\": {\n \"minimum_quantity\": 5,\n \"amount\": 40\n }\n }\n },\n \"CAD\": {\n \"amount\": 117,\n \"includes_tax\": false,\n \"tiers\": {\n \"min_10\": {\n \"minimum_quantity\": 10,\n \"amount\": 80\n }\n }\n },\n \"GBP\": {\n \"amount\": 65,\n \"includes_tax\": true,\n \"tiers\": {\n \"min_20\": {\n \"minimum_quantity\": 20,\n \"amount\": 50\n }\n }\n }\n }\n }\n },\n \"external_ref\": \"a-external-ref\",\n \"admin_attributes\": {\n \"cost_of_goods\": \"42.0\",\n \"charge_type\": \"credit card\"\n },\n \"shopper_attributes\": {\n \"cost_of_goods\": \"42.0\",\n \"charge_type\": \"credit card\"\n }\n }\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Request Collapse all
Base URL
https://euwest.api.elasticpath.com
Auth
Parameters
— pathrequired
Body required
{
  "data": {
    "type": "product-price",
    "attributes": {
      "currencies": {
        "USD": {
          "amount": 100,
          "includes_tax": false,
          "tiers": {
            "min_5": {
              "minimum_quantity": 5,
              "amount": 50
            }
          }
        },
        "CAD": {
          "amount": 127,
          "includes_tax": false,
          "tiers": {
            "min_10": {
              "minimum_quantity": 10,
              "amount": 100
            }
          }
        },
        "GBP": {
          "amount": 73,
          "includes_tax": true,
          "tiers": {
            "min_20": {
              "minimum_quantity": 20,
              "amount": 60
            }
          }
        }
      },
      "sku": "product-sku-a",
      "sales": {
        "summer": {
          "schedule": {
            "valid_form": "2023-12-24T09:00:00",
            "valid_to": "2023-12-25T09:00:00"
          },
          "currencies": {
            "USD": {
              "amount": 90,
              "includes_tax": false,
              "tiers": {
                "min_5": {
                  "minimum_quantity": 5,
                  "amount": 40
                }
              }
            },
            "CAD": {
              "amount": 117,
              "includes_tax": false,
              "tiers": {
                "min_10": {
                  "minimum_quantity": 10,
                  "amount": 80
                }
              }
            },
            "GBP": {
              "amount": 65,
              "includes_tax": true,
              "tiers": {
                "min_20": {
                  "minimum_quantity": 20,
                  "amount": 50
                }
              }
            }
          }
        }
      },
      "external_ref": "a-external-ref",
      "admin_attributes": {
        "cost_of_goods": "42.0",
        "charge_type": "credit card"
      },
      "shopper_attributes": {
        "cost_of_goods": "42.0",
        "charge_type": "credit card"
      }
    }
  }
}
ResponseClear

Click the Send API Request button above and see the response here!