Skip to main content
Your quoting tool, storefront back end or order system can ask Elastly for a price at the moment it needs one. Elastly prices each line inside your workspace’s guardrails and records a decision for it. When the quote is won or lost, you report the outcome so pricing learns from it. This page covers that flow end to end. For how a price is set, see How pricing works.
The API reference playground sends requests to production with your own API key. A price or outcome request sent from it creates real decisions and outcomes in your workspace. Use a Test key in the playground.

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/price and receives no cost or margin fields. See Authentication.
  • The customer, named in one of two ways: the Elastly ID from the id field 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 with accountNumber.
  • 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.
The 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.
A line can also name a 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.
A 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 in lines, 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 with POST /v1/outcomes. A Read-only key cannot call it.
  • A won line carries the quantity won.
  • A lost line carries a reasonCode and can carry the competitor, the competitorPrice and its currency.
  • Up to 100 lines per request, each lineRef once.
The 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.