{ "openapi": "3.0.0", "info": { "title": "Pricing Hub", "description": "", "contact": {}, "version": "1.0" }, "servers": [ { "url": "https://prchub.{environment}.com.br", "description": "VTEX server url", "variables": { "environment": { "description": "Environment to use. Used as part of the URL.", "default": "vtexcommercestable" } } } ], "paths": { "/api/pricing-hub/prices?an={accountName}": { "post": { "tags": [ "Pricing Hub Prices" ], "summary": "Get Prices", "description": "This route retrieves and applies prices for the items that are passed in the request. Pricing Hub will select the pricing method that will be used for each item and will fetch their respective price from the selected pricing method.", "parameters": [ { "name": "accountName", "in": "query", "required": true, "description": "Name of the VTEX account. Used as part of the URL", "schema": { "type": "string", "default": "apiexamples" } }, { "name": "Accept", "in": "header", "required": true, "description": "HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand", "style": "simple", "schema": { "type": "string", "default": "application/json" } }, { "name": "Content-Type", "in": "header", "description": "Describes the type of the content being sent", "required": true, "style": "simple", "schema": { "type": "string", "default": "application/json" } }, { "name": "X-VTEX-API-AppKey", "in": "header", "description": "The AppKey configured by the merchant", "required": true, "style": "simple", "schema": { "type": "string", "default": "{{X-VTEX-API-AppKey}}" } }, { "name": "X-VTEX-API-AppToken", "in": "header", "description": "The AppToken configured by the merchant", "required": true, "style": "simple", "schema": { "type": "string", "default": "{{X-VTEX-API-AppToken}}" } } ], "requestBody": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetPricesRequestObject" }, "example": { "items": [ { "Index": 0, "SkuId": "13", "Quantity": 1, "BrandId": "2000000", "SellerId": "1", "PriceTableIds": [], "CategoriesIds": [ "1" ] } ], "UtmSource": "facebook", "UtmMedium": "social", "UtmCampaign": "summer", "UtmInternalCampaign": "sale", "SalesChannel": "1", "Email": "customer@email.com" } } }, "required": true }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/response2" }, "example": { "Items": [ { "index": 0, "skuId": "14", "price": 1875, "costPrice": 750, "listPrice": 2500, "priceTable": "1", "priceValidUnit": "2022-03-24T14:57:19Z" }, { "index": 0, "skuId": "14", "price": 200, "costPrice": 200, "listPrice": 200, "priceTable": "1", "priceValidUnit": "2022-03-04T20:00:18Z" } ] } } } } }, "deprecated": false } } }, "components": { "schemas": { "GetPricesRequestObject": { "required": [ "items", "UtmSource", "UtmMedium", "UtmCampaign", "UtmInternalCampaign", "salesChannel", "email" ], "type": "object", "properties": { "items": { "$ref": "#/components/schemas/items" }, "UtmSource": { "type": "string", "default": "facebook", "description": "Traffic source, indicates where the traffic originated from according to the `utm_source` value in the URL that led to the order. If there is no value, use `null`" }, "UtmMedium": { "type": "string", "default": "social", "description": "Medium that indicates what type of traffic the customer originated from, represented by the `utm_medium` value in the URL that led to the order. If there is no value, use `null`" }, "UtmCampaign": { "type": "string", "default": "summer", "description": "Campaign name, represented by the `utm_campaign` value in the URL that led to the order. If there is no value, use `null`" }, "UtmInternalCampaign": { "type": "string", "default": "sale", "description": "Internal campaign name, represented by the `utmi_cp` value in the URL that led to the order. If there is no value, use `null`" }, "salesChannel": { "type": "string", "default": "1", "description": "Represents Checkout's sales channel" }, "email": { "type": "string", "default": "customer@email.com", "description": "The customer's email address. If there is no value, use an empty string" } }, "example": { "items": [ { "Index": 0, "SkuId": "13", "Quantity": 1, "BrandId": "2000000", "SellerId": "1", "PriceTableIds": [], "CategoriesIds": [ "1" ] } ] } }, "items": { "title": "items", "required": [ "itemsObject" ], "type": "array", "description": "The list of items that are to be priced by Pricing Hub", "items": { "type": "object", "title": "", "description": "Each item to be priced by Pricing Hub", "required": [ "index", "skuId", "quantity", "brandId", "sellerId", "priceTableIds", "categoriesIds" ], "properties": { "index": { "description": "This is the index of the item at Checkout's cart. It has to be unique in the items array", "type": "string", "title": "index", "default": 0 }, "skuId": { "description": "This is the sku id of the item that will be priced", "type": "string", "title": "skuId", "default": "13" }, "quantity": { "description": "This is the amount of items that will be priced. It is possible to have a volume discount for many repeated items. Hence, the price may not be the quantity of the item multiplied by the unitary price", "type": "string", "title": "quantity", "default": 1 }, "brandId": { "description": "This is the brand ID for the item", "type": "string", "title": "brandId", "default": "2000000" }, "sellerId": { "description": "This is the seller ID for the item", "type": "string", "title": "sellerId", "default": "1" }, "priceTableIds": { "description": "IDs of the price tables that will be used to compute the price. More than one price table might be passed to the array. The final price rule might be more complex than the lowest or the highest price", "type": "array", "title": "priceTableIds", "items": { "type": "string", "default": "1", "description": "ID of a price table that will be used to compute the price" }, "default": [] }, "categoriesIds": { "description": "ID of the categories that will be used to compute the price", "type": "array", "items": { "type": "string", "default": "1", "description": "ID of a category that will be used to compute the price" }, "title": "categoriesIds", "default": [ 1 ] } } } }, "response2": { "title": "response2", "required": [ "items" ], "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/Item1" }, "description": "List of items and their respective prices applied by Pricing Hub" } } }, "Item1": { "title": "Item1", "required": [ "index", "skuId", "price", "costPrice", "listPrice", "priceTable", "priceValidUntil" ], "type": "object", "properties": { "index": { "type": "string", "description": "The same index referring to Checkout's cart that was passed to the API" }, "skuId": { "type": "string", "description": "The same skuId that was passed to the API" }, "price": { "type": "number", "description": "The price returned by the pricing API that was used by Pricing Hub. It is measured in cents, so 5000 means 50,00 in local currency" }, "costPrice": { "type": "number", "description": "The cost price returned by the pricing API that was used by Pricing Hub. It is measured in cents, so 5000 means 50,00 in local currency." }, "listPrice": { "type": "number", "description": "The list price returned by the pricing API that was used by Pricing Hub. It is measured in cents, so 5000 means 50,00 in local currency" }, "priceTable": { "type": "string", "description": "The price table that was used to price the item" }, "priceValidUntil": { "type": "string", "description": "The moment up until the price is valid. After that moment, it will be necessary to call the pricing API again. The format of the string is in RFC3339" } } } }, "securitySchemes": { "appKey": { "type": "apiKey", "in": "header", "name": "X-VTEX-API-AppKey" }, "appToken": { "type": "apiKey", "in": "header", "name": "X-VTEX-API-AppToken" } } }, "tags": [ { "name": "Pricing Hub Prices" } ], "security": [ { "appKey": [], "appToken": [] } ] }