Skip to main content

Your First Prices

This guide loads three products into a new tenant, prices them on a pricelist, and queries them. Then it adds a wholesale pricelist with a discount rule and a customer pricelist with one negotiated price, and shows how the customer's prices come out. It takes about ten minutes with curl.

You need an API key from Account & Tenant Setup. Replace YOUR_TENANT with your tenant's name in every URL.


1. Get a Token​

Exchange the API key for an access token:

curl -s -X POST "https://login.quantaprice.com/oauth2/token" \
-d "grant_type=client_credentials" \
-d "client_id=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET"
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 900
}

The token is valid for 15 minutes. Keep it in a variable for the steps below:

export QP_TOKEN="eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
export QP="https://YOUR_TENANT.quantaprice.com/api"

In an integration, cache the token and fetch a new one shortly before it expires; see Authentication.


2. Create Articles​

An article is a product in your catalogue, identified by its SKU. Its metadata is yours to define; price rules can select articles by it.

curl -s -X POST "$QP/article/batch" \
-H "Authorization: Bearer $QP_TOKEN" -H "Content-Type: application/json" \
-d '[
{"sku": "SKU-CHAIR-001", "name": "Office chair", "metadata": {"category": ["chairs"]}},
{"sku": "SKU-DESK-002", "name": "Standing desk", "metadata": {"category": ["desks"]}},
{"sku": "SKU-LAMP-010", "name": "Desk lamp", "metadata": {"category": ["lighting"]}}
]'
{"accepted": 3, "failed": []}

3. Create a Pricelist​

A pricelist holds prices in one currency. NET means its prices exclude VAT.

curl -s -X POST "$QP/pricelist" \
-H "Authorization: Bearer $QP_TOKEN" -H "Content-Type: application/json" \
-d '{"code": "base-sek", "name": "Base SEK", "currency_code": "SEK", "vat_mode": "NET"}'

The answer is 202 Accepted with an empty body.


4. Load Prices​

A price is a SKU on a pricelist. Without price rules on the pricelist, its fixed field is the sales price.

curl -s -X POST "$QP/price/batch" \
-H "Authorization: Bearer $QP_TOKEN" -H "Content-Type: application/json" \
-d '[
{"sku": "SKU-CHAIR-001", "pricelist": "base-sek", "price": {"fields": {"fixed": 2390}}},
{"sku": "SKU-DESK-002", "pricelist": "base-sek", "price": {"fields": {"fixed": 4490}}},
{"sku": "SKU-LAMP-010", "pricelist": "base-sek", "price": {"fields": {"fixed": 950}}}
]'
{"accepted": 3, "failed": []}

The prices take effect now. Send a start_date to schedule one for later; see Scheduled Updates.


5. Query a Price​

Ask for the chair on base-sek, in SEK, with Swedish VAT:

curl -s -X POST "$QP/price/query" \
-H "Authorization: Bearer $QP_TOKEN" -H "Content-Type: application/json" \
-d '{
"skus": ["SKU-CHAIR-001"],
"pricelist_filter": {"pricelists": ["base-sek"]},
"currency_code": "SEK",
"tax_area": "SE"
}'
{
"count": 1,
"results": [
{
"sku": "SKU-CHAIR-001",
"is_bundle": false,
"sales_price_ex_vat": 2390.0,
"sales_price_inc_vat": 2987.5,
"vat_amount": 597.5,
"vat_rate": 25.0,
"price": {
"pricelist": "base-sek",
"currency_code": "SEK",
"sales": 2390.0,
"fields": {"fixed": 2390.0},
"quantity_breaks": [],
"meta": {
"inherited": false,
"start_at": "2026-10-13T09:50:21.461Z",
"updated_at": "2026-10-13T09:50:21.461Z",
"updated_by": "a1b2c3d4e5f6a1b2c3d4e5f6"
}
}
}
]
}
FieldMeaning
sales_price_ex_vat, sales_price_inc_vatThe price to show, without and with VAT, in the currency you asked for
vat_amount, vat_rateThe VAT, and the rate in percent. The chair has no VAT class in SE, so it is standard-rated: 25 %
price.pricelistThe pricelist the price came from
price.salesThe sales price on that pricelist, in its currency, before VAT
price.fieldsThe price fields you stored
price.quantity_breaksLower unit prices from a quantity on; see Price Structures
price.meta.inheritedtrue when the pricelist inherited the price from its parent
price.meta.start_atWhen this version of the price took effect

6. Add a Segment and a Customer​

Wholesale customers get 15 % off the base prices. Create wholesale-sek under base-sek, with a rule that computes its price from its parent's:

curl -s -X POST "$QP/pricelist" \
-H "Authorization: Bearer $QP_TOKEN" -H "Content-Type: application/json" \
-d '{
"code": "wholesale-sek", "name": "Wholesale SEK", "currency_code": "SEK", "vat_mode": "NET",
"parent_code": "base-sek",
"price_rules": [{"code": "wholesale", "filter": "", "expression": "sales * 0.85", "description": "15 % off base"}]
}'

ACME AB is a wholesale customer with a negotiated price on the desk. Give it a pricelist under wholesale-sek, and write that one price on it:

curl -s -X POST "$QP/pricelist" \
-H "Authorization: Bearer $QP_TOKEN" -H "Content-Type: application/json" \
-d '{"code": "customer-acme", "name": "ACME AB", "currency_code": "SEK", "vat_mode": "NET", "parent_code": "wholesale-sek"}'

curl -s -X POST "$QP/price" \
-H "Authorization: Bearer $QP_TOKEN" -H "Content-Type: application/json" \
-d '{"sku": "SKU-DESK-002", "pricelist": "customer-acme", "price": {"fields": {"fixed": 3600}}}'

Query both SKUs for ACME:

curl -s -X POST "$QP/price/query" \
-H "Authorization: Bearer $QP_TOKEN" -H "Content-Type: application/json" \
-d '{
"skus": ["SKU-CHAIR-001", "SKU-DESK-002"],
"pricelist_filter": {"pricelists": ["customer-acme"]},
"currency_code": "SEK",
"tax_area": "SE"
}'
SKUsales_price_ex_vatsales_price_inc_vatinheritedWhy
SKU-CHAIR-0012031.502539.38true2390 on base-sek, 15 % off on wholesale-sek, inherited unchanged by customer-acme
SKU-DESK-0023600.004500.00falseACME's own price

Change the chair's base price and ACME's price follows. Change the wholesale rule and every wholesale customer's inherited prices follow. ACME's own desk price stays until you change it. See Inheritance.

Inherited prices on a new or changed pricelist are filled in within a short time; query again if one is missing right after the change.


Next Steps​

  • Loading Data: bulk loads, updates, deletes and what is validated.
  • Querying Prices: pricelist filters, best price across pricelists, other currencies, as_of.
  • Price Rules: markups on cost, discounts by brand or category.
  • Platform Overview: every building block and how a price is calculated.