Skip to main content

Pricing API

This documentation describes the snabble API endpoints related to the management of product pricing configuration. These endpoints are available on the api subdomain. See General API access for general information about api access.

Operations

Single pricing category operations

Multiple pricing categories operations

Single pricing operations

Multiple pricing operations

Price operations

Data Model

PricingCategory Object

Represents a named collection of shops which share the same pricing configuration (i.e. prices).

Example:

{
"id": "cheap-prices",
"project": "project",
"name": "cheap prices",
"priority": 2,
"shops": [
{"id": "shop-id-1"},
{"id": "shop-id-2"}
],
"links": {
"self": {
"href": "/project/pricing/categories/id/cheap-prices"
}
}
}

PricingCategory attributes:

ParameterTypeDefaultDescription
idstringUnique id of the PricingCategory
projectstringproject id
namestringnullDisplay name
priorityintWhen resolving prices the categories are considered in descending order of priority
shopsarrayarray of Shop which use this category
linksobjectnullThe links

The default category

The category with the id default is used as a fallback. If the app tries to determine the price of a products for a shop and the shop is not associated with a category or the category has no price for the product the price from the default category is used.

Shop Object

Represents a reference on a shop as defined by the Shops API.

Example:

{ "id": "1" }
ParameterTypeDefaultDescription
idstringUnique id of the Shop

PricingCategoryList object

List of PricingCategory.

Example:

{
"links": {
"self": {
"href": "/project/pricing/categories"
}
},
"categories": [
{
"id": "cheap-prices",
"project": "project",
"name": "cheap prices",
"shops": [
{"id": "shop-id-1"},
{"id": "shop-id-2"}
],
"links": {
"self": {
"href": "/project/pricing/categories/id/cheap-prices"
}
}
}
]
}
ParameterTypeDefaultDescription
categoriesarrayarray of PricingCategory

Pricing object

Represents the information used to determine the actual price of a product sold.

Example:

{
"sku": "sku",
"project": "project",
"prices": [ /* array of Price */ ],
"link": {
"self": {
"href": "/project/pricing/products/sku/some-sku"
},
"product": {
"href": "/project/products/sku/some-sku"
}
}
}
ParameterTypeDefaultDescription
skustringsku of the product
projectstringproject id
pricesarrayarray of Price

Price Object

The actual price.

{
"category": "cheap-prices",
"listPrice": 199,
"discountedPrice": 149,
"customerCardPrice": 129,
"basePrice": "14.90 €/kg"
}
ParameterTypeDescription
categorystringid of the PricingCategory
listPriceint64list price of the product in this category
discountedPriceint64discounted price for the product in this category
customerCardPriceint64reduced price for customers owning a loyalty or customer card
basePricestringbase price for the product in this category

PricingBatchUpdate Object

Batch update for pricings.

Example:

{
"op": "put",
"item": {
"sku": "a-product",
"prices": [ … ]
}
}
ParameterTypeDescription
opstringput to create or update a pricing, or delete to delete it
itemPricingA Pricing Object

PricingBatchUpdateResultMessage Object

Result messages are simple status objects which are returned for batch operations.

ParameterTypeDescription
skustringThe product referenced by the result message
statusstringThe processing status: "ok" or "error"
messagestringA human-readable message describing the processing status

PriceBatchUpdate Object

Batch update for prices.

Example:

{
"sku": "a-product",
"category": "cheap-prices",
"listPrice": 199,
"discountedPrice": 149,
"customerCardPrice": 129,
"basePrice": "14.90 €/kg"
}
ParameterTypeDescription
skustringsku of the product
categorystringid of the PricingCategory
listPriceint64list price of the product in this category
discountedPriceint64discounted price for the product in this category
customerCardPriceint64reduced price for customers owning a loyalty or customer card
basePricestringbase price for the product in this category

PriceBatchUpdateResultMessage Object

Result messages are simple status objects which are returned for batch operations.

ParameterTypeDescription
skustringThe product referenced by the result message
categorystringid of the PricingCategory
statusstringThe processing status: "ok" or "error"
messagestringA human-readable message describing the processing status

Operations

Get PricingCategory

GET /{project}/pricing/categories/id/{id}

Returns one pricing category.

Required permissions: pricingCategoriesRead

Success Response 200 OK

Content-Type : application/json

Data: PricingCategory


Create PricingCategory

POST /{project}/pricing/categories

Create a pricing category.

Required permissions: pricingCategoriesWrite

Request

Content-Type : application/json

Data : PricingCategory

Success Response 201 Created

Content-Type : application/json

Data: : PricingCategory


Update PricingCategory

PUT /{project}/pricing/categories/id/{id}

Update a pricing category.

Required permissions: pricingCategoriesWrite

Request

Content-Type : application/json

Data : PricingCategory

Success Response 200 OK

Content-Type : application/json

Data : PricingCategory


Request PricingCategory

GET /{project}/pricing/categories

Returns the list of pricing categories for the project.

Required permissions: pricingCategoriesRead

Success Response 200 OK

Content-Type : application/json

Data: PricingCategoryList


Get Pricing

GET /{project}/pricing/products/sku/{sku}

Returns a pricing.

Required permissions : pricingRead

Success Response 200 OK

Content-Type : application/json

Data : Pricing


Delete Pricing

DELETE /{project}/pricing/products/sku/{sku}

Deletes a pricing.

Required permissions : pricingWrite

Success Response 200 OK


Update Pricing

PUT /{project}/pricing/products/sku/{sku}

Update a pricing.

Required permissions : pricingWrite

Request

Content-Type : application/json

Data : Pricing

Success Response 200 OK

Content-Type : application/json

Data : Pricing


Batch Update Pricing

POST /{project}/pricing/products/_batch

Update a batch of pricings.

Required permissions: pricingWrite

Request

Maximal batch size : 20000 items

Content-Type : application/x-ndjson

Data : JSON stream of PricingBatchUpdate objects

Success Response 200 OK

Content-Type : application/x-ndjson

Data : JSON stream of PricingBatchUpdateResultMessage


Delete all Pricings

DELETE /{project}/pricing/products

Delete all pricings.

Required permissions: pricingWrite

Success Response 200 OK


Delete Price

DELETE /{project}/pricing/products/sku/{sku}/category/{categoryID}

Deletes a single price for a single product in a single pricingCategory.

Required permissions : pricingWrite

Success Response 200 OK


Batch Update Prices

POST /{project}/pricing/_batch

Update a batch of prices.

Required permissions: pricingWrite

Request

Maximal batch size : 20000 items

Content-Type : application/x-ndjson

Data : JSON stream of PriceBatchUpdate objects

Success Response 200 OK

Content-Type : application/x-ndjson

Data : JSON stream of PriceBatchUpdateResultMessage