Before you start
- A Live or Test API key. A Read-only key can request prices and read decisions but cannot report outcomes. A Storefront key can only request prices on
POST /v1/priceand receives no cost or margin fields. See Authentication. - The customer, named in one of two ways: the Elastly ID from the
idfield of the customers list,GET /v1/customers, or the customer’s record key in your connected system. Filter the customers list by your own account number withaccountNumber. - The SKUs to price, as they appear in your Elastly catalog.
Price one line or a few lines
POST /v1/price prices up to 100 lines for one customer in one currency.
buyer.kind must be customer. Name the customer with customerId, the Elastly ID, or with customerRef, the customer’s record key in the connected source system. Send exactly one of the two; a request with both or neither is refused with 400.
unit, a warehouseId and a deliveryCountry; the request can set warehouseId and deliveryCountry for every line at once.
Price a quote
POST /v1/quotes/price takes the same body plus a quoteRef, your own reference for the quote, and a lineRef on each line. Use it when you will report the quote’s outcome later: the outcome refers back to these references.
quoteRef belongs to one customer. Pricing the same quoteRef for a different customer is refused with 422 and quote_ref_customer_mismatch.
Read the response
The response holds one entry per line inlines, the totals per currency, and complete, which is true when every line was priced.
Each priced line has state set to ok, the line price and unitPrice as money objects, the guard that limited the price (none when no guardrail applied), any warnings, a trace of the steps that set the price, and a decisionId. Keep the decisionId to read the decision later. Money objects are described in the overview.
Each priced line also says how long it may be shown:
A storefront can show a price until its
validUntil and must ask again after it. Price responses carry Cache-Control: private, no-cache, so a shared cache does not store them.
A line that could not be priced has a state, a reason and a nextAction instead of a price. The state is one of missing_cost, stale_cost, missing_data, blocked_floor, blocked_map, blocked_exposure and unavailable. The reason names the cause, such as cost_age_exceeded or unmapped_customer. The reference page lists every value.
A
customerId or customerRef that does not name an active customer of the workspace returns its lines with the reason unmapped_customer.
A request is refused as a whole only for request, access and rate errors. An unpriced line never fails the other lines. See Errors.
Report an outcome
When the quote is decided, report each line as won or lost withPOST /v1/outcomes. A Read-only key cannot call it.
- A won line carries the
quantitywon. - A lost line carries a
reasonCodeand can carry thecompetitor, thecompetitorPriceand itscurrency. - Up to 100 lines per request, each
lineRefonce.
quoteRef must have been priced through POST /v1/quotes/price with a key of the same environment; otherwise the request is refused with 404 and quote_not_found. The response gives each line a state: recorded when the outcome was stored, or one of stale, line_not_found, unknown_reason, competitor_not_allowed and occurred_in_future when it was not.
Read a past decision
GET /v1/decisions/{id} returns a decision with the inputs it was made from: the customer, SKU, quantity, price, floor, target, ceiling, cost, the pricing version and the outcome when one is recorded. The id in the path is a decisionId or a priceId. A key reads only decisions made in its own environment.