# Price models

## Retrieving all price models

> Retrieves all price models assigned to the tenant. You can filter the results with query parameters.\
> \
> A price model can be defined as a repeatable way to sell products in a market with the intention of making a profit. Price models define basic structures for prices.

```json
{"openapi":"3.0.0","info":{"title":"Price Service","version":"0.0.1"},"tags":[{"name":"Price models"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["price.pricemodel_read"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"price.price_manage":"Needed to manage prices.","price.price_read":"Needed to retrieve prices.","price.price_own":"Needed to calculate product prices (legacy).","price.prod_price_calculate":"Needed to calculate prices and synchronize sale prices (legacy).","price.price_delete_all":"Needed to delete all prices at once (legacy).","price.price_match_own":"Needed to use the price matching functionality based on information from the session context.","price.pricemodel_manage":"Needed to manage price models.","price.pricemodel_read":"Needed to retrieve price models.","price.price_manage_by_vendor":"Needed to manage prices belonging to the vendor."}}}}},"parameters":{"trait_acceptLanguageV2_header":{"name":"Accept-Language","in":"header","required":false,"schema":{"type":"string"},"description":"List of language codes acceptable for the response. You can specify factors that indicate which language should be retrieved if the one with a higher factor was not found in the localized fields.\n* If the header is set to a particular language or a list of languages, all localized fields are retrieved as strings.\n* If the header is set to `*`, all localized fields are retrieved as maps of translations, where the keys are language codes and values are the fields in their respective languages.\n* If the header is empty, localized fields are retrieved in the default language defined in the Configuration Service.\n"},"trait_paged_pageNumber":{"name":"pageNumber","in":"query","description":"Page number to be retrieved. The number of the first page is 1.\n\n**Note:** If the `pageNumber` parameter is passed, size of the pages must be specified in the `pageSize` parameter.\n","schema":{"default":1,"minimum":1,"type":"integer"}},"trait_paged_pageSize":{"name":"pageSize","in":"query","description":"Number of items to be retrieved per page.\n","schema":{"default":60,"minimum":1,"type":"integer"}},"trait_sort":{"in":"query","name":"sort","required":false,"description":"List of properties used to sort the results, separated by colons. The order of properties indicates their priority in sorting.\n\nPossible values:\n* `{fieldName}`\n* `{fieldName}:asc`\n* `{fieldName}:desc`\n\n**Note:** If you want to sort the results by localized properties, the possible values are:\n  * `{fieldName}.{language}`\n  * `{fieldName}.{language}:asc`\n  * `{fieldName}.{language}:desc`\n\nIf the sorting direction is not specified, the fields are sorted in ascending order.","schema":{"type":"string"}},"trait_XTotalCount_header":{"in":"header","name":"X-Total-Count","required":false,"description":"Flag indicating whether the total count of retrieved items should be returned.","schema":{"default":false,"type":"boolean"}},"trait_priceModel_includesTax":{"name":"includesTax","in":"query","required":false,"schema":{"type":"boolean"},"description":"Flag indicating whether prices assigned to the price model are expressed as net or gross.\n\n| Value | Description |\n| --- | --- |\n| `true` | Prices are expressed as gross values. |\n| `false` | Prices are expressed as net values. |\n"},"trait_priceModel_includesMarkup":{"name":"includesMarkup","in":"query","required":false,"schema":{"type":"boolean"},"description":"Flag indicating whether prices assigned to the price model include markup.\n\n**Note**: This is a **preview** field.\n"},"trait_priceModel_tierType":{"name":"tierType","in":"query","required":false,"schema":{"type":"string"},"description":"Pricing strategy applicable to the price model. Possible values:\n* `BASIC`\n* `VOLUME`\n* `TIERED`\n"},"trait_priceModel_name":{"name":"name","in":"query","required":false,"schema":{"type":"string"},"description":"Price model's name."},"trait_priceModel_description":{"name":"description","in":"query","required":false,"schema":{"type":"string"},"description":"Price model's description."},"trait_priceModel_unitcode":{"name":"unitcode","in":"query","required":false,"schema":{"type":"string"},"description":"Filter price models by unit code"}},"schemas":{"priceModelDefinitionRetrieval":{"title":"priceModelDefinitionRetrieval","type":"object","description":"A price model can be defined as a repeatable way to sell products in a market with the intention of making a profit. Price models define basic structures for prices.","properties":{"id":{"type":"string","description":"Price model's unique identifier, generated when the price model is created."},"includesTax":{"type":"boolean","description":"Flag indicating whether prices assigned to the price model are expressed as net or gross.\n\n| Value | Description |\n| --- | --- |\n| `true` | Prices are expressed as gross values. |\n| `false` | Prices are expressed as net values. |\n"},"includesMarkup":{"type":"boolean","description":"Flag indicating whether prices assigned to the price model include markup.\n\n**Note**: This is a **preview** field.\n"},"default":{"type":"boolean","description":"Indicates whether the price model is default one or not."},"name":{"description":"Price model name.","oneOf":[{"type":"object"},{"type":"string"}]},"description":{"description":"Price model description.","oneOf":[{"type":"object"},{"type":"string"}]},"tierDefinition":{"allOf":[{"$ref":"#/components/schemas/tierDefinitionCreation"},{"type":"object","description":"Definition of pricing tiers."}]},"measurementUnit":{"allOf":[{"$ref":"#/components/schemas/measurementUnitV2"},{"type":"object","description":"Measurement unit and quantity for which the price is defined.\n\nFor example, if a product is sold by the piece, the field should contain `1 pc`. If products for this price model are sold per kilogram, this field should contain `1kg`.\n"}]}}},"tierDefinitionCreation":{"type":"object","properties":{"tierType":{"type":"string","description":"Possible values:\n* `BASIC`\n* `VOLUME`\n* `TIERED`\n\n`BASIC`: Used to offer the same price per unit, regardless of the ordered quantity.\n\n  **Note**: When using basic pricing, you need to define a single tier and set its `minQuantity` field to `0`.\n\n`VOLUME`: Used to offer a lower price per unit depending on the total ordered quantity.\n\n`TIERED`: Used to offer a lower price per unit based on the tiers that the total ordered quantity falls into.\n\n  **Example**: You defined three tiers, starting at 5, 10, and 15 pieces respectively. A customer orders 16 pieces. In this pricing model, the first 5 pieces will be priced according to the first tier, the next 5 according to the second tier, and the 16th piece will be priced according to the third tier."},"tiers":{"type":"array","description":"Tier quantities.\n\nEach tier contains information about the minimum quantity from which it (and its price) is valid.\n\n**Example**: For two tiers with the following `minQuantity` values: 0 pieces and 10 pieces, the effective ranges will be `<0, 9)` and `<10, infinity)`.\n\n**Note**: When defining tiers, be aware of the following restrictions to the `PriceModel` object:\n* For `BASIC` tier type:\n  * Only one tier should be defined. If the tier is not defined, it will be automatically generated.\n  * The tier's `minQuantity.quantity` should be set to `0`.\n* For `VOLUME` and `TIERED` type:\n  * Each `minQuantity.quantity` field must contain a unique value.\n  * The tiers must be defined in an ascending order based on their `quantity` value.\n  * The `quantity` field in the first tier must be set to `0`.\n  * All `unitCode` fields must contain the same value.","items":{"allOf":[{"$ref":"#/components/schemas/tierDetailsDefinitionCreation"}]}}},"required":["tierType"]},"tierDetailsDefinitionCreation":{"type":"object","description":"Quantity that indicates the tier's range:\n* The `minQuantity` of the tier defines the left side of the range (inclusive).\n* The `minQuantity` of the next tier defines the right side of the range (exclusive).\n","properties":{"id":{"type":"string","description":"An identifier of the tier. If the value is not provided then it is automatically generated. The id is used during an update operation for recognizing whether a particular tier has been changed, removed or added. "},"minQuantity":{"allOf":[{"$ref":"#/components/schemas/measurementUnitV2"},{"type":"object","description":"Minimum quantity of the product from which the tier applies."}]}},"required":["minQuantity"]},"measurementUnitV2":{"type":"object","description":"Measurement unit for which the price is defined.","properties":{"quantity":{"minimum":0,"description":"Quantity of the measurement unit.","type":"number"},"unitCode":{"description":"Code of the measurement unit, as defined in the Unit Handling Service.","type":"string"}},"required":["quantity","unitCode"],"title":""},"errorMessage":{"type":"object","title":"error","description":"Schema for API-specific errors.","properties":{"code":{"minimum":100,"maximum":599,"description":"Original HTTP error code, should be consistent with the response HTTP code.","type":"integer"},"status":{"description":"Original HTTP error reason.","type":"string"},"message":{"description":"Descriptive error message for debugging","type":"string"},"details":{"description":"List of problems causing this error.","type":"array","items":{"title":"errorDetail","description":"schema for specific error cause","type":"string"}},"errorCode":{"type":"string","description":"Additional error code."}}}},"responses":{"Forbidden_403":{"description":"Given authorization scopes are not sufficient and do not match the scopes required by the endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}}}},"paths":{"/price/{tenant}/priceModels":{"get":{"summary":"Retrieving all price models","description":"Retrieves all price models assigned to the tenant. You can filter the results with query parameters.\n\nA price model can be defined as a repeatable way to sell products in a market with the intention of making a profit. Price models define basic structures for prices.","parameters":[{"$ref":"#/components/parameters/trait_acceptLanguageV2_header"},{"$ref":"#/components/parameters/trait_paged_pageNumber"},{"$ref":"#/components/parameters/trait_paged_pageSize"},{"$ref":"#/components/parameters/trait_sort"},{"$ref":"#/components/parameters/trait_XTotalCount_header"},{"$ref":"#/components/parameters/trait_priceModel_includesTax"},{"$ref":"#/components/parameters/trait_priceModel_includesMarkup"},{"$ref":"#/components/parameters/trait_priceModel_tierType"},{"$ref":"#/components/parameters/trait_priceModel_name"},{"$ref":"#/components/parameters/trait_priceModel_description"},{"$ref":"#/components/parameters/trait_priceModel_unitcode"}],"responses":{"200":{"description":"The request was successful. A list of price models is returned.","headers":{"X-Total-Count":{"schema":{"type":"integer"},"description":"Total number of retrieved price models."}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/priceModelDefinitionRetrieval"}}},"application/xml":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/priceModelDefinitionRetrieval"}}}}},"403":{"$ref":"#/components/responses/Forbidden_403"}},"tags":["Price models"],"operationId":"GET-price-list-price-models"}}}}
```

## Creating a new price model

> Creates a new price model.\
> \
> A price model can be defined as a repeatable way to sell products in a market with the intention of making a profit. Price models define basic structures for prices, including whether the prices are expressed as gross or net or the measurement units for which prices are defined.\
> \
> Each price model can specify one of three pricing strategies:\
> \* Basic pricing, where the price per unit is constant, regardless of the ordered quantity.\
> \* Volume pricing, where the price per unit depends on the ordered quantity.\
> \* Tiered pricing, where the price per unit depends on the tiers that the ordered quantity falls into.

```json
{"openapi":"3.0.0","info":{"title":"Price Service","version":"0.0.1"},"tags":[{"name":"Price models"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["price.pricemodel_manage"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"price.price_manage":"Needed to manage prices.","price.price_read":"Needed to retrieve prices.","price.price_own":"Needed to calculate product prices (legacy).","price.prod_price_calculate":"Needed to calculate prices and synchronize sale prices (legacy).","price.price_delete_all":"Needed to delete all prices at once (legacy).","price.price_match_own":"Needed to use the price matching functionality based on information from the session context.","price.pricemodel_manage":"Needed to manage price models.","price.pricemodel_read":"Needed to retrieve price models.","price.price_manage_by_vendor":"Needed to manage prices belonging to the vendor."}}}}},"parameters":{"trait_contentLanguageV2_header":{"name":"Content-Language","in":"header","required":false,"schema":{"type":"string"},"description":"List of languages in which localized fields in the request body are provided.\n\n* If the `Content-Language` header is set to `*`, the localized fields should be provided as maps of translations, where the keys are language codes and values are the fields in their respective languages.\n* If the `Content-Language` header is set to a specific language, the localized fields should be provided as strings.\n* If the `Content-Language` header is empty, the endpoint will asume that the localized fields are provided in the default language defined in the Configuration Service.\n\n**Note**: You can provide the localized fields only in languages defined in the Configuration Service. In case the fields are provided in languages that are not defined in the Configuration Service, the request will be rejected.\n"}},"schemas":{"priceModelDefinitionCreationResponse":{"title":"priceModelDefinitionCreationResponse","type":"object","description":"","properties":{"id":{"type":"string","description":"Price model's unique identifier."}}},"errorMessage":{"type":"object","title":"error","description":"Schema for API-specific errors.","properties":{"code":{"minimum":100,"maximum":599,"description":"Original HTTP error code, should be consistent with the response HTTP code.","type":"integer"},"status":{"description":"Original HTTP error reason.","type":"string"},"message":{"description":"Descriptive error message for debugging","type":"string"},"details":{"description":"List of problems causing this error.","type":"array","items":{"title":"errorDetail","description":"schema for specific error cause","type":"string"}},"errorCode":{"type":"string","description":"Additional error code."}}},"priceModelDefinitionCreation":{"title":"priceModelDefinitionCreation","type":"object","description":"A price model can be defined as a repeatable way to sell products in a market with the intention of making a profit. Price models define basic structures for prices.","properties":{"id":{"type":"string","description":"Custom price model identifier. If not provided, it is automatically generated."},"includesTax":{"type":"boolean","description":"Flag indicating whether prices assigned to the price model will be expressed as net or gross.\n\n| Value | Description |\n| --- | --- |\n| `true` | Prices will be expressed as gross values. |\n| `false` | Prices will be expressed as net values. |\n"},"includesMarkup":{"type":"boolean","description":"Flag indicating whether prices assigned to the price model include markup.\n\n**Note**: This is a **preview** field."},"default":{"type":"boolean","description":"Indicates whether the price model is default one or not."},"name":{"description":"Price model name. It should be a brief, human-readable name that describes purposes of the model.\n\n* If the `Content-Language` header is set to `*`, then the name should be provided as a map of translations, where each key is a language code and the value is the name in its respective language.\n* If the `Content-Language` header is set to a specific language, the name should be provided as a string.\n* If the `Content-Language` header is empty, the endpoint will asume that the name is provided in the default language defined in the Configuration Service.\n\n**Note**: You can provide the names only in languages defined in the Configuration Service. In case the name is provided in a language that is not defined in the Configuration Service, the request will be rejected.","oneOf":[{"type":"object"},{"type":"string"}]},"description":{"description":"Price model description. It can contain details about the price model.\n\n* If the `Content-Language` header is set to `*`, then the description should be provided as a map of translations, where each key is a language code and the value is the description in its respective language.\n* If the `Content-Language` header is set to a specific language, the description should be provided as a string.\n* If the `Content-Language` header is empty, the endpoint will asume that the description is provided in the default language defined in the Configuration Service.\n\n**Note**: You can provide the descriptions only in languages defined in the Configuration Service. In case the description is provided in a language that is not defined in the Configuration Service, the request will be rejected.","oneOf":[{"type":"object"},{"type":"string"}]},"tierDefinition":{"allOf":[{"$ref":"#/components/schemas/tierDefinitionCreation"},{"type":"object","description":"Definition of pricing tiers."}]},"measurementUnit":{"allOf":[{"$ref":"#/components/schemas/measurementUnitV2"},{"type":"object","description":"Measurement unit and quantity for which the price is defined.\n\nFor example, if a product is sold by the piece, the field should contain `1 pc`. If products relevant to this price model are sold per kilogram, this field should contain `1 kg`.\n"}]}},"required":["includesTax","name","tierDefinition","measurementUnit"]},"tierDefinitionCreation":{"type":"object","properties":{"tierType":{"type":"string","description":"Possible values:\n* `BASIC`\n* `VOLUME`\n* `TIERED`\n\n`BASIC`: Used to offer the same price per unit, regardless of the ordered quantity.\n\n  **Note**: When using basic pricing, you need to define a single tier and set its `minQuantity` field to `0`.\n\n`VOLUME`: Used to offer a lower price per unit depending on the total ordered quantity.\n\n`TIERED`: Used to offer a lower price per unit based on the tiers that the total ordered quantity falls into.\n\n  **Example**: You defined three tiers, starting at 5, 10, and 15 pieces respectively. A customer orders 16 pieces. In this pricing model, the first 5 pieces will be priced according to the first tier, the next 5 according to the second tier, and the 16th piece will be priced according to the third tier."},"tiers":{"type":"array","description":"Tier quantities.\n\nEach tier contains information about the minimum quantity from which it (and its price) is valid.\n\n**Example**: For two tiers with the following `minQuantity` values: 0 pieces and 10 pieces, the effective ranges will be `<0, 9)` and `<10, infinity)`.\n\n**Note**: When defining tiers, be aware of the following restrictions to the `PriceModel` object:\n* For `BASIC` tier type:\n  * Only one tier should be defined. If the tier is not defined, it will be automatically generated.\n  * The tier's `minQuantity.quantity` should be set to `0`.\n* For `VOLUME` and `TIERED` type:\n  * Each `minQuantity.quantity` field must contain a unique value.\n  * The tiers must be defined in an ascending order based on their `quantity` value.\n  * The `quantity` field in the first tier must be set to `0`.\n  * All `unitCode` fields must contain the same value.","items":{"allOf":[{"$ref":"#/components/schemas/tierDetailsDefinitionCreation"}]}}},"required":["tierType"]},"tierDetailsDefinitionCreation":{"type":"object","description":"Quantity that indicates the tier's range:\n* The `minQuantity` of the tier defines the left side of the range (inclusive).\n* The `minQuantity` of the next tier defines the right side of the range (exclusive).\n","properties":{"id":{"type":"string","description":"An identifier of the tier. If the value is not provided then it is automatically generated. The id is used during an update operation for recognizing whether a particular tier has been changed, removed or added. "},"minQuantity":{"allOf":[{"$ref":"#/components/schemas/measurementUnitV2"},{"type":"object","description":"Minimum quantity of the product from which the tier applies."}]}},"required":["minQuantity"]},"measurementUnitV2":{"type":"object","description":"Measurement unit for which the price is defined.","properties":{"quantity":{"minimum":0,"description":"Quantity of the measurement unit.","type":"number"},"unitCode":{"description":"Code of the measurement unit, as defined in the Unit Handling Service.","type":"string"}},"required":["quantity","unitCode"],"title":""}},"responses":{"BadRequest_400":{"description":"Request was syntactically incorrect. Details are provided in the response payload.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"Forbidden_403":{"description":"Given authorization scopes are not sufficient and do not match the scopes required by the endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}}}},"paths":{"/price/{tenant}/priceModels":{"post":{"summary":"Creating a new price model","description":"Creates a new price model.\n\nA price model can be defined as a repeatable way to sell products in a market with the intention of making a profit. Price models define basic structures for prices, including whether the prices are expressed as gross or net or the measurement units for which prices are defined.\n\nEach price model can specify one of three pricing strategies:\n* Basic pricing, where the price per unit is constant, regardless of the ordered quantity.\n* Volume pricing, where the price per unit depends on the ordered quantity.\n* Tiered pricing, where the price per unit depends on the tiers that the ordered quantity falls into.","parameters":[{"$ref":"#/components/parameters/trait_contentLanguageV2_header"}],"responses":{"201":{"description":"The request was successful. The price model has been created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/priceModelDefinitionCreationResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest_400"},"403":{"$ref":"#/components/responses/Forbidden_403"}},"tags":["Price models"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/priceModelDefinitionCreation"}}}},"operationId":"POST-price-create-price-model"}}}}
```

## Retrieving a price model

> Retrieves a specified price model's details by priceModelId.\
> \
> A price model can be defined as a repeatable way to sell products in a market with the intention of making a profit. Price models define basic structures for prices.

```json
{"openapi":"3.0.0","info":{"title":"Price Service","version":"0.0.1"},"tags":[{"name":"Price models"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["price.pricemodel_read"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"price.price_manage":"Needed to manage prices.","price.price_read":"Needed to retrieve prices.","price.price_own":"Needed to calculate product prices (legacy).","price.prod_price_calculate":"Needed to calculate prices and synchronize sale prices (legacy).","price.price_delete_all":"Needed to delete all prices at once (legacy).","price.price_match_own":"Needed to use the price matching functionality based on information from the session context.","price.pricemodel_manage":"Needed to manage price models.","price.pricemodel_read":"Needed to retrieve price models.","price.price_manage_by_vendor":"Needed to manage prices belonging to the vendor."}}}}},"parameters":{"trait_acceptLanguageV2_header":{"name":"Accept-Language","in":"header","required":false,"schema":{"type":"string"},"description":"List of language codes acceptable for the response. You can specify factors that indicate which language should be retrieved if the one with a higher factor was not found in the localized fields.\n* If the header is set to a particular language or a list of languages, all localized fields are retrieved as strings.\n* If the header is set to `*`, all localized fields are retrieved as maps of translations, where the keys are language codes and values are the fields in their respective languages.\n* If the header is empty, localized fields are retrieved in the default language defined in the Configuration Service.\n"}},"schemas":{"priceModelDefinitionRetrieval":{"title":"priceModelDefinitionRetrieval","type":"object","description":"A price model can be defined as a repeatable way to sell products in a market with the intention of making a profit. Price models define basic structures for prices.","properties":{"id":{"type":"string","description":"Price model's unique identifier, generated when the price model is created."},"includesTax":{"type":"boolean","description":"Flag indicating whether prices assigned to the price model are expressed as net or gross.\n\n| Value | Description |\n| --- | --- |\n| `true` | Prices are expressed as gross values. |\n| `false` | Prices are expressed as net values. |\n"},"includesMarkup":{"type":"boolean","description":"Flag indicating whether prices assigned to the price model include markup.\n\n**Note**: This is a **preview** field.\n"},"default":{"type":"boolean","description":"Indicates whether the price model is default one or not."},"name":{"description":"Price model name.","oneOf":[{"type":"object"},{"type":"string"}]},"description":{"description":"Price model description.","oneOf":[{"type":"object"},{"type":"string"}]},"tierDefinition":{"allOf":[{"$ref":"#/components/schemas/tierDefinitionCreation"},{"type":"object","description":"Definition of pricing tiers."}]},"measurementUnit":{"allOf":[{"$ref":"#/components/schemas/measurementUnitV2"},{"type":"object","description":"Measurement unit and quantity for which the price is defined.\n\nFor example, if a product is sold by the piece, the field should contain `1 pc`. If products for this price model are sold per kilogram, this field should contain `1kg`.\n"}]}}},"tierDefinitionCreation":{"type":"object","properties":{"tierType":{"type":"string","description":"Possible values:\n* `BASIC`\n* `VOLUME`\n* `TIERED`\n\n`BASIC`: Used to offer the same price per unit, regardless of the ordered quantity.\n\n  **Note**: When using basic pricing, you need to define a single tier and set its `minQuantity` field to `0`.\n\n`VOLUME`: Used to offer a lower price per unit depending on the total ordered quantity.\n\n`TIERED`: Used to offer a lower price per unit based on the tiers that the total ordered quantity falls into.\n\n  **Example**: You defined three tiers, starting at 5, 10, and 15 pieces respectively. A customer orders 16 pieces. In this pricing model, the first 5 pieces will be priced according to the first tier, the next 5 according to the second tier, and the 16th piece will be priced according to the third tier."},"tiers":{"type":"array","description":"Tier quantities.\n\nEach tier contains information about the minimum quantity from which it (and its price) is valid.\n\n**Example**: For two tiers with the following `minQuantity` values: 0 pieces and 10 pieces, the effective ranges will be `<0, 9)` and `<10, infinity)`.\n\n**Note**: When defining tiers, be aware of the following restrictions to the `PriceModel` object:\n* For `BASIC` tier type:\n  * Only one tier should be defined. If the tier is not defined, it will be automatically generated.\n  * The tier's `minQuantity.quantity` should be set to `0`.\n* For `VOLUME` and `TIERED` type:\n  * Each `minQuantity.quantity` field must contain a unique value.\n  * The tiers must be defined in an ascending order based on their `quantity` value.\n  * The `quantity` field in the first tier must be set to `0`.\n  * All `unitCode` fields must contain the same value.","items":{"allOf":[{"$ref":"#/components/schemas/tierDetailsDefinitionCreation"}]}}},"required":["tierType"]},"tierDetailsDefinitionCreation":{"type":"object","description":"Quantity that indicates the tier's range:\n* The `minQuantity` of the tier defines the left side of the range (inclusive).\n* The `minQuantity` of the next tier defines the right side of the range (exclusive).\n","properties":{"id":{"type":"string","description":"An identifier of the tier. If the value is not provided then it is automatically generated. The id is used during an update operation for recognizing whether a particular tier has been changed, removed or added. "},"minQuantity":{"allOf":[{"$ref":"#/components/schemas/measurementUnitV2"},{"type":"object","description":"Minimum quantity of the product from which the tier applies."}]}},"required":["minQuantity"]},"measurementUnitV2":{"type":"object","description":"Measurement unit for which the price is defined.","properties":{"quantity":{"minimum":0,"description":"Quantity of the measurement unit.","type":"number"},"unitCode":{"description":"Code of the measurement unit, as defined in the Unit Handling Service.","type":"string"}},"required":["quantity","unitCode"],"title":""},"errorMessage":{"type":"object","title":"error","description":"Schema for API-specific errors.","properties":{"code":{"minimum":100,"maximum":599,"description":"Original HTTP error code, should be consistent with the response HTTP code.","type":"integer"},"status":{"description":"Original HTTP error reason.","type":"string"},"message":{"description":"Descriptive error message for debugging","type":"string"},"details":{"description":"List of problems causing this error.","type":"array","items":{"title":"errorDetail","description":"schema for specific error cause","type":"string"}},"errorCode":{"type":"string","description":"Additional error code."}}}},"responses":{"Forbidden_403":{"description":"Given authorization scopes are not sufficient and do not match the scopes required by the endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"NotFound_404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}}}},"paths":{"/price/{tenant}/priceModels/{priceModelId}":{"get":{"summary":"Retrieving a price model","description":"Retrieves a specified price model's details by priceModelId.\n\nA price model can be defined as a repeatable way to sell products in a market with the intention of making a profit. Price models define basic structures for prices.","parameters":[{"$ref":"#/components/parameters/trait_acceptLanguageV2_header"}],"responses":{"200":{"description":"The request was successful. The price model is returned.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/priceModelDefinitionRetrieval"}}},"application/xml":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/priceModelDefinitionRetrieval"}}}}},"403":{"$ref":"#/components/responses/Forbidden_403"},"404":{"$ref":"#/components/responses/NotFound_404"}},"tags":["Price models"],"operationId":"GET-price-retrieve-price-model"}}}}
```

## Upserting a price model

> Updates a specified price model's details by priceModelId, or creates a new one if a price model with the specified ID doesn't exist yet.<br>

```json
{"openapi":"3.0.0","info":{"title":"Price Service","version":"0.0.1"},"tags":[{"name":"Price models"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["price.pricemodel_manage"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"price.price_manage":"Needed to manage prices.","price.price_read":"Needed to retrieve prices.","price.price_own":"Needed to calculate product prices (legacy).","price.prod_price_calculate":"Needed to calculate prices and synchronize sale prices (legacy).","price.price_delete_all":"Needed to delete all prices at once (legacy).","price.price_match_own":"Needed to use the price matching functionality based on information from the session context.","price.pricemodel_manage":"Needed to manage price models.","price.pricemodel_read":"Needed to retrieve price models.","price.price_manage_by_vendor":"Needed to manage prices belonging to the vendor."}}}}},"responses":{"Created_201":{"description":"The resource has been created.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"Identifier of a newly created item."}}}}}},"BadRequest_400":{"description":"Request was syntactically incorrect. Details are provided in the response payload.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"Forbidden_403":{"description":"Given authorization scopes are not sufficient and do not match the scopes required by the endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"NotFound_404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}}},"schemas":{"errorMessage":{"type":"object","title":"error","description":"Schema for API-specific errors.","properties":{"code":{"minimum":100,"maximum":599,"description":"Original HTTP error code, should be consistent with the response HTTP code.","type":"integer"},"status":{"description":"Original HTTP error reason.","type":"string"},"message":{"description":"Descriptive error message for debugging","type":"string"},"details":{"description":"List of problems causing this error.","type":"array","items":{"title":"errorDetail","description":"schema for specific error cause","type":"string"}},"errorCode":{"type":"string","description":"Additional error code."}}},"priceModelDefinitionCreation":{"title":"priceModelDefinitionCreation","type":"object","description":"A price model can be defined as a repeatable way to sell products in a market with the intention of making a profit. Price models define basic structures for prices.","properties":{"id":{"type":"string","description":"Custom price model identifier. If not provided, it is automatically generated."},"includesTax":{"type":"boolean","description":"Flag indicating whether prices assigned to the price model will be expressed as net or gross.\n\n| Value | Description |\n| --- | --- |\n| `true` | Prices will be expressed as gross values. |\n| `false` | Prices will be expressed as net values. |\n"},"includesMarkup":{"type":"boolean","description":"Flag indicating whether prices assigned to the price model include markup.\n\n**Note**: This is a **preview** field."},"default":{"type":"boolean","description":"Indicates whether the price model is default one or not."},"name":{"description":"Price model name. It should be a brief, human-readable name that describes purposes of the model.\n\n* If the `Content-Language` header is set to `*`, then the name should be provided as a map of translations, where each key is a language code and the value is the name in its respective language.\n* If the `Content-Language` header is set to a specific language, the name should be provided as a string.\n* If the `Content-Language` header is empty, the endpoint will asume that the name is provided in the default language defined in the Configuration Service.\n\n**Note**: You can provide the names only in languages defined in the Configuration Service. In case the name is provided in a language that is not defined in the Configuration Service, the request will be rejected.","oneOf":[{"type":"object"},{"type":"string"}]},"description":{"description":"Price model description. It can contain details about the price model.\n\n* If the `Content-Language` header is set to `*`, then the description should be provided as a map of translations, where each key is a language code and the value is the description in its respective language.\n* If the `Content-Language` header is set to a specific language, the description should be provided as a string.\n* If the `Content-Language` header is empty, the endpoint will asume that the description is provided in the default language defined in the Configuration Service.\n\n**Note**: You can provide the descriptions only in languages defined in the Configuration Service. In case the description is provided in a language that is not defined in the Configuration Service, the request will be rejected.","oneOf":[{"type":"object"},{"type":"string"}]},"tierDefinition":{"allOf":[{"$ref":"#/components/schemas/tierDefinitionCreation"},{"type":"object","description":"Definition of pricing tiers."}]},"measurementUnit":{"allOf":[{"$ref":"#/components/schemas/measurementUnitV2"},{"type":"object","description":"Measurement unit and quantity for which the price is defined.\n\nFor example, if a product is sold by the piece, the field should contain `1 pc`. If products relevant to this price model are sold per kilogram, this field should contain `1 kg`.\n"}]}},"required":["includesTax","name","tierDefinition","measurementUnit"]},"tierDefinitionCreation":{"type":"object","properties":{"tierType":{"type":"string","description":"Possible values:\n* `BASIC`\n* `VOLUME`\n* `TIERED`\n\n`BASIC`: Used to offer the same price per unit, regardless of the ordered quantity.\n\n  **Note**: When using basic pricing, you need to define a single tier and set its `minQuantity` field to `0`.\n\n`VOLUME`: Used to offer a lower price per unit depending on the total ordered quantity.\n\n`TIERED`: Used to offer a lower price per unit based on the tiers that the total ordered quantity falls into.\n\n  **Example**: You defined three tiers, starting at 5, 10, and 15 pieces respectively. A customer orders 16 pieces. In this pricing model, the first 5 pieces will be priced according to the first tier, the next 5 according to the second tier, and the 16th piece will be priced according to the third tier."},"tiers":{"type":"array","description":"Tier quantities.\n\nEach tier contains information about the minimum quantity from which it (and its price) is valid.\n\n**Example**: For two tiers with the following `minQuantity` values: 0 pieces and 10 pieces, the effective ranges will be `<0, 9)` and `<10, infinity)`.\n\n**Note**: When defining tiers, be aware of the following restrictions to the `PriceModel` object:\n* For `BASIC` tier type:\n  * Only one tier should be defined. If the tier is not defined, it will be automatically generated.\n  * The tier's `minQuantity.quantity` should be set to `0`.\n* For `VOLUME` and `TIERED` type:\n  * Each `minQuantity.quantity` field must contain a unique value.\n  * The tiers must be defined in an ascending order based on their `quantity` value.\n  * The `quantity` field in the first tier must be set to `0`.\n  * All `unitCode` fields must contain the same value.","items":{"allOf":[{"$ref":"#/components/schemas/tierDetailsDefinitionCreation"}]}}},"required":["tierType"]},"tierDetailsDefinitionCreation":{"type":"object","description":"Quantity that indicates the tier's range:\n* The `minQuantity` of the tier defines the left side of the range (inclusive).\n* The `minQuantity` of the next tier defines the right side of the range (exclusive).\n","properties":{"id":{"type":"string","description":"An identifier of the tier. If the value is not provided then it is automatically generated. The id is used during an update operation for recognizing whether a particular tier has been changed, removed or added. "},"minQuantity":{"allOf":[{"$ref":"#/components/schemas/measurementUnitV2"},{"type":"object","description":"Minimum quantity of the product from which the tier applies."}]}},"required":["minQuantity"]},"measurementUnitV2":{"type":"object","description":"Measurement unit for which the price is defined.","properties":{"quantity":{"minimum":0,"description":"Quantity of the measurement unit.","type":"number"},"unitCode":{"description":"Code of the measurement unit, as defined in the Unit Handling Service.","type":"string"}},"required":["quantity","unitCode"],"title":""}},"parameters":{"trait_contentLanguageV2_header":{"name":"Content-Language","in":"header","required":false,"schema":{"type":"string"},"description":"List of languages in which localized fields in the request body are provided.\n\n* If the `Content-Language` header is set to `*`, the localized fields should be provided as maps of translations, where the keys are language codes and values are the fields in their respective languages.\n* If the `Content-Language` header is set to a specific language, the localized fields should be provided as strings.\n* If the `Content-Language` header is empty, the endpoint will asume that the localized fields are provided in the default language defined in the Configuration Service.\n\n**Note**: You can provide the localized fields only in languages defined in the Configuration Service. In case the fields are provided in languages that are not defined in the Configuration Service, the request will be rejected.\n"}}},"paths":{"/price/{tenant}/priceModels/{priceModelId}":{"put":{"summary":"Upserting a price model","description":"Updates a specified price model's details by priceModelId, or creates a new one if a price model with the specified ID doesn't exist yet.\n","operationId":"PUT-price-update-price-model","responses":{"201":{"$ref":"#/components/responses/Created_201"},"204":{"description":"The request was successful. The price has been updated.\n"},"400":{"$ref":"#/components/responses/BadRequest_400"},"403":{"$ref":"#/components/responses/Forbidden_403"},"404":{"$ref":"#/components/responses/NotFound_404"}},"tags":["Price models"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/priceModelDefinitionCreation"}}},"description":""},"parameters":[{"$ref":"#/components/parameters/trait_contentLanguageV2_header"}]}}}}
```

## Deleting a price model

> Deletes a specified price model by priceModel Id.\
> \
> \*\*Important\*\*: If you want to delete a price model that has prices assigned to it, you need to set the \`forceDelete\` query parameter to \`true\`. In this case, all prices assigned to the price model are deleted as well, in an asynchronous manner.\
> \
> \*\*Additional scopes info\*\*\
> The \`price.pricemodel\_manage\_admin\` scope is only required if you want to delete a price model that has prices assigned to it.

```json
{"openapi":"3.0.0","info":{"title":"Price Service","version":"0.0.1"},"tags":[{"name":"Price models"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["price.pricemodel_manage","price.pricemodel_manage_admin"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"price.price_manage":"Needed to manage prices.","price.price_read":"Needed to retrieve prices.","price.price_own":"Needed to calculate product prices (legacy).","price.prod_price_calculate":"Needed to calculate prices and synchronize sale prices (legacy).","price.price_delete_all":"Needed to delete all prices at once (legacy).","price.price_match_own":"Needed to use the price matching functionality based on information from the session context.","price.pricemodel_manage":"Needed to manage price models.","price.pricemodel_read":"Needed to retrieve price models.","price.price_manage_by_vendor":"Needed to manage prices belonging to the vendor."}}}}},"responses":{"BadRequest_400":{"description":"Request was syntactically incorrect. Details are provided in the response payload.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"Forbidden_403":{"description":"Given authorization scopes are not sufficient and do not match the scopes required by the endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}}},"schemas":{"errorMessage":{"type":"object","title":"error","description":"Schema for API-specific errors.","properties":{"code":{"minimum":100,"maximum":599,"description":"Original HTTP error code, should be consistent with the response HTTP code.","type":"integer"},"status":{"description":"Original HTTP error reason.","type":"string"},"message":{"description":"Descriptive error message for debugging","type":"string"},"details":{"description":"List of problems causing this error.","type":"array","items":{"title":"errorDetail","description":"schema for specific error cause","type":"string"}},"errorCode":{"type":"string","description":"Additional error code."}}}}},"paths":{"/price/{tenant}/priceModels/{priceModelId}":{"delete":{"summary":"Deleting a price model","operationId":"DELETE-price-remove-price-model","description":"Deletes a specified price model by priceModel Id.\n\n**Important**: If you want to delete a price model that has prices assigned to it, you need to set the `forceDelete` query parameter to `true`. In this case, all prices assigned to the price model are deleted as well, in an asynchronous manner.\n\n**Additional scopes info**\nThe `price.pricemodel_manage_admin` scope is only required if you want to delete a price model that has prices assigned to it.","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":false},"parameters":[{"schema":{"type":"boolean"},"in":"query","name":"forceDelete","description":"* If set to `true` and the price model has prices assigned to it, both the price model and the prices will be deleted.\n\n  **Important**: To set this parameter to `true`, your access token needs to have the `price.pricemodel_manage_admin` scope granted.\n* If set to `false` or not specified and the price model has prices assigned to it, the endpoint will respond with a `400` error."}],"responses":{"204":{"description":"The request was successful. The price model has been deleted."},"400":{"$ref":"#/components/responses/BadRequest_400"},"403":{"$ref":"#/components/responses/Forbidden_403"}},"tags":["Price models"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.emporix.io/api-references/api-guides/prices-and-taxes/price-service/api-reference/price-models.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
