@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api Pricing API
@base https://api.vtex.com/apiexamples
@version 1.0
@auth ApiKey X-VTEX-API-AppKey in header | ApiKey X-VTEX-API-AppToken in header | ApiKey VtexIdclientAutCookie in header
@common_fields {Content-Type: str # Type of the content being sent., Accept: str # HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand.}
@endpoints 17
@toc pricing(17)

@endpoint GET /pricing/prices/{itemId}
@desc Get price by SKU ID
@required {itemId: int # SKU ID.}
@returns(200) {itemId: str, listPrice: int(int32), costPrice: int(int32), markup: int(int32), basePrice: int(int32), fixedPrices: [map]} # OK

@endpoint DELETE /pricing/prices/{itemId}
@desc Delete price all base and fixed prices of an SKU
@required {itemId: int # SKU ID.}
@returns(200) OK

@endpoint PUT /pricing/prices/{itemId}
@desc Create or update base price or fixed price
@required {itemId: int # SKU unique identifier number.}
@optional {markup: int # The profit percentage that is to be obtained from the sale of that SKU. If you decide to fill the `markup` item, you must also fill the `costPrice`. The `basePrice` will be automatically generated based on both values., listPrice: num # SKU's suggested selling price., basePrice: num # SKU selling base price. If you decide to fill only the `basePrice` item, the `markup` and `costPrice` will be automatically generated to adapt to the number inserted in `basePrice`., costPrice: num # SKU selling cost price. If you decide to fill the `costPrice` item, you must also fill the `markup` and `basePrice` will be automatically generated based on both values., fixedPrices: [map{tradePolicyId!: str, value!: num, listPrice: num, minQuantity!: int, dateRange: map}] # Information  about the SKU's fixed prices.}
@returns(200) OK
@example_request {"markup":30,"listPrice":50,"costPrice":35,"fixedPrices":[{"tradePolicyId":"1","value":50.5,"listPrice":50.5,"minQuantity":2,"dateRange":{"from":"2021-12-30T22:00:00-03:00","to":"2021-12-30T23:00:00-03:00"}}]}

@endpoint GET /pricing/prices/{itemId}/fixed
@desc Get fixed prices
@required {itemId: int # SKU ID.}
@returns(200) OK

@endpoint PATCH /pricing/prices/{itemId}/fixed
@desc Create or update base price or fixed price
@required {itemId: int # SKU unique identifier number.}
@returns(200) OK
@example_request [{"tradePolicyId":"1","value":50.5,"listPrice":50.5,"minQuantity":2,"dateRange":{"from":"2021-12-30T22:00:00-03:00","to":"2021-12-30T22:00:00-03:00"}}]

@endpoint POST /pricing/prices/{itemId}/fixed/{priceTableId}
@desc Create or update fixed prices on a price table or trade policy
@required {itemId: int # SKU ID., priceTableId: str # SKU **price table** name or **trade policy** ID.}
@returns(200) OK

@endpoint GET /pricing/prices/{itemId}/fixed/{priceTableId}
@desc Get fixed prices on a price table or trade policy
@required {itemId: int # SKU ID., priceTableId: str # Price Table Name}
@returns(200) OK

@endpoint DELETE /pricing/prices/{itemId}/fixed/{priceTableId}
@desc Delete fixed prices on a price table or trade policy
@required {itemId: int # SKU ID., priceTableId: str # Price Table or Trade Policy Name.}
@returns(200) OK

@endpoint GET /pricing/prices/{itemId}/computed
@desc Get computed prices for all price tables
@required {itemId: int # SKU ID.}
@optional {categoryIds: int # Category ID., brandId: int # Brand ID., quantity: int # SKU quantity.}
@returns(200) OK

@endpoint GET /pricing/prices/{itemId}/computed/{priceTableId}
@desc Get computed price by price table or trade policy
@required {itemId: int # SKU ID., priceTableId: str # SKU Price Table Name.}
@optional {categoryIds: int # Category ID., brandId: int # Brand ID., quantity: int # SKU quantity.}
@returns(200) OK

@endpoint GET /pricing/config
@desc Get pricing configuration
@returns(200) OK

@endpoint GET /pricing/migration
@desc Get pricing v2 status
@returns(200) OK

@endpoint GET /pricing/pipeline/catalog/{priceTableId}
@desc Get rules for a price table
@required {priceTableId: str # Price Table Name.}
@returns(200) {tradePolicyId: str, rules: [map], percentualModifier: int} # OK
@errors {401: Unauthorized, 403: Forbidden, 429: Too many requests}

@endpoint PUT /pricing/pipeline/catalog/{priceTableId}
@desc Update rules for a price table
@required {priceTableId: str # Price Table Name., rules: [map{id!: int, context!: map, percentualModifier!: num}] # Array of rules for the price table.}
@returns(201) Created

@endpoint PUT /pricing/tables/{priceTableId}
@desc Create price table
@required {priceTableId: str # Price Table Name.}
@returns(200) OK

@endpoint GET /pricing/pipeline/catalog
@desc Get all price tables and their rules
@returns(200) OK

@endpoint GET /pricing/tables
@desc List price tables
@returns(200) OK

@end
