VTEX

Pricing API

> Check the new [Pricing onboarding guide](https://developers.vtex.com/vtex-rest-api/docs/pricing-overview). We created this guide to improve the onboarding…

Other#openapi

Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.

Overview

> Check the new Pricing onboarding guide. We created this guide to improve the onboarding experience for developers at VTEX. It assembles all documentation on our Developer Portal about Pricing and is organized by focusing on the developer's journey.

Pricing is the VTEX module responsible for the SKU's price list. At this module we have the base price of each SKU, some optional fixed prices by trade policy, and some rules that can be applied to generate dynamically different final prices according to the purchase context and the trade policy. The variables used in this collection are:

  • {{accountName}} = You VTEX account name.
  • {{tradePolicyId}} = Current Trade Policy ID.
  • {{itemId}} = SKU ID.
  • {{X-VTEX-API-AppKey}} and {{X-VTEX-API-AppToken}} = Credentials.

You can get more information about how to use this module and its business logic at VTEX Help.

Rate Limits

Limits per route

  • GET: routes are not rate limited at the moment
  • PUT or POST: 40 requests/second/account in any price insert/update route with 1000 Burst Credits
  • DELETE: 16 requests/second/account in any price deletion route, with 300 Burst Credits.

What are Burst Credits?

In case the account exceeds the limit frequency for a Rate Limiter (for instance, when one account makes 41 requests/second in any price insert/update route), we decrease from the Burst Credit count the exceeding (in this example, 1 Credit).

In the event of the Burst Credits reaching 0 (zero), the request is blocked with a Status 429 response.

The credits fill up over time when the route is not being used, in the same rate as the route's Rate Limiter. In our example, for each second not sending a PUT or POST request, we increase 40 Burst Credits to this Rate Limiter

New Response Headers

In the response headers of any request to Pricing v2 there are some new headers indicating the current status of the Rate Limiting.
This information may be useful to evaluate the ideal frequency to send requests to a route, and when to send a new request in the event of reaching a Rate Limit.

  • Ratelimit-Limit - Total Burst Credits offered to a route
  • Ratelimit-Remaining - How many Burst Credits are still available to use
  • Ratelimit-Reset - How long (in seconds) it will take to the Burst Credits to fill up completely (It will fill up to the Ratelimit-Limit)
  • Retry-After - Indicates how many seconds you will need to wait until the Rate Limiter accepts a new request to this route again. If this header response exists, this means your current request has been rate limited and has not been processed.

How to integrate with Pricing v2 considering our Rate Limits

Integrate considering the limits of requests/route/account specified in the Limits per route section, avoiding to surpass this frequency.

If you happen to be Rate Limited, wait the time in seconds specified in Retry-After before making another request to the service, and reduce the rate of requests per second that your integration is making.

Endpoints 14

Price Tables

  • GETGet all price tables and their ruleshttps://api.vtex.com/DefaultParameterValue/pricing/pricing/pipeline/catalogThis method will retrieve all price tables and their rules. Response body example [ { "tradePolicyId": "2", "rules": [ { "id": 0, "context": { "categories":…
  • GETGet rules for a price tablehttps://api.vtex.com/DefaultParameterValue/pricing/pricing/pipeline/catalog/:priceTableIdThis method will retrieve the rules from a specific Price Table. Response body example { "tradePolicyId": "b2c", "rules": [{ "id": 0, "context": {…
  • PUTUpdate rules for a price table/pricing/pipeline/catalog/:priceTableIdThis method will update the rules from a specific Price Table. It will delete all the rules from the requested Price Table and create new rules based on the…
  • GETList price tableshttps://api.vtex.com/DefaultParameterValue/pricing/pricing/tablesThis method will list all price tables. Response body example [ "1", "2", "3", "b2c", "b2b", "gold" ]

Prices and Fixed Prices

  • GETGet Price/pricing/prices/:itemIdRetrieves price data given a specific SKU ID. Within the fixedPrices object, there might be a list of prices for specific Trade Policies and Minimium…
  • PUTCreate or Update Base Price or Fixed Prices/pricing/prices/:itemIdCreates or updates an SKU Base Price or Fixed Prices. The base price is the basic selling price of a product, it comprises the cost price and the markup…
  • DELETEDelete Price/pricing/prices/:itemIdDeletes the Base Price and all available Fixed Prices for an SKU in all trade policies.
  • GETGet Computed Price by price table or trade policyhttps://api.vtex.com/DefaultParameterValue/pricing/pricing/prices/:itemId/computed/:priceTableId?categoryIds=1&brandId=3&quantity=2Gets the Computed Price, which is the price after all the steps in the Pricing pipeline, for an SKU in a specific price table or trade policy. Response body…
  • GETGet Fixed Prices/pricing/prices/:itemId/fixedThe fixed price is an optional price of the SKU for a specific trade policy with a specific minimum quantity to be activated. This method retrieves an array…
  • GETGet Fixed Prices on a price table or trade policy/pricing/prices/:itemId/fixed/:priceTableIdRetrieves all Fixed Prices on a price table or trade policy. Response body example [ { "tradePolicyId": "6", "value": 20.9, "listPrice": 22.9, "minQuantity":…
  • POSTCreate or Update Fixed Prices on a price table or trade policy/pricing/prices/:itemId/fixed/:priceTableIdCreates or updates the fixed prices of an SKU for a specific price table or trade policy. You can add one or multiple fixed prices per SKU. Request body…
  • DELETEDelete Fixed Prices on a price table or trade policy/pricing/prices/:itemId/fixed/:priceTableIdDeletes all Fixed Prices of an SKU in a specific Price Table or Trade Policy.

Pricing Configuration

  • GETGet Pricing Configurationhttps://api.vtex.com/DefaultParameterValue/pricing/pricing/configRetrieves Pricing Configuration. Response body example { "hasMigrated": true, "migrationStatus": "Completed", "defaultMarkup": 100, "priceVariation": {…
  • GETGet Pricing v2 Statushttps://api.vtex.com/DefaultParameterValue/pricing/pricing/migrationRetrieves Pricing v2 Status. Response body example { "isActive": true, "hasMigrated": true }

API details

Base URL
https://vtex.local
https://api.vtex.com/{accountName}
Authentication
An API key in the X-VTEX-API-AppKey header
An API key in the X-VTEX-API-AppToken header
Operations
14 operations on 9 pathsGET 9PUT 2DELETE 2POST 1
Main resources
Prices and Fixed Prices 8Price Tables 4Pricing Configuration 2
Response formats
application/json; charset=utf-8 application/json
Description format
OpenAPI 3.0.0, API version 1.0
Listed from
APIs.guru OpenAPI Directory (CC0-1.0)
Source updated

How to test the Pricing API in Swastik Codes

  1. Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
  2. Fork it into your workspaceChoose a workspace. You get your own copy of the Pricing API collection, without the publisher's secrets.
  3. Add your credentialsThis API uses an API key in the X-VTEX-API-AppKey header. Add yours in the collection's variables or an environment; the requests already reference it.
  4. Send a requestPick an endpoint, for example “Get all price tables and their rules” (GET https://api.vtex.com/DefaultParameterValue/pricing/pricing/pipeline/catalog), and press Send. Check the response, add tests and run the whole collection with the runner.

Frequently asked questions

What is the Pricing API?

> Check the new [Pricing onboarding guide](https://developers.vtex.com/vtex-rest-api/docs/pricing-overview). We created this guide to improve the onboarding… It is listed under Other and has 14 endpoints.

Who publishes the Pricing API?

It is listed from VTEX's public API description (an OpenAPI document), not published by VTEX on Swastik Codes. Anyone who controls vtex.com can claim the profile by adding a DNS TXT record.

What is the base URL of the Pricing API?

Its description lists 2 base URLs: https://vtex.local, https://api.vtex.com/{accountName}. The first is the usual one; the others are typically sandbox or regional servers.

How do I authenticate with the Pricing API?

It accepts 2 methods: an API key in the X-VTEX-API-AppKey header; an API key in the X-VTEX-API-AppToken header.

How many endpoints does the Pricing API have?

14 operations on 9 paths (9 GET, 2 PUT, 2 DELETE, 1 POST). The largest groups are Prices and Fixed Prices, Price Tables, Pricing Configuration.

Is forking the Pricing API free?

Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.

Suggest an API

Tell us which public API is missing. We check it, then add it here with its endpoints when it has an OpenAPI (Swagger) description.