Skip to main content

Apply Quote Shipping Estimate

POST 

/api/quotes/:quote/shipping-estimates/:shippingEstimate/apply

Applies one rate from a recorded estimate to the quote: creates or replaces its "Shipping" revenue line (a product-less quote line with the Shipping line type, described as "<Carrier> <Service> (est.)", taxed at the quote's tax rate) and recalculates the quote totals. With record_only it records the cost only.

Required scope: orders:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Request body:

  • option_key (string, required, max 120): the key of one of the estimate's options, e.g. UPS|Ground.
  • markup_type (string, nullable): percent or flat. Defaults to the account's default markup.
  • markup_value (number, nullable, 0–100000): percent of the rate, or a flat amount added to it.
  • charge_amount (number, nullable, 0–1000000): charge exactly this amount; wins over any markup.
  • replace_quote_line_id (integer, nullable): the existing Shipping line to replace. When omitted, a quote with no Shipping line gets a new one, one with a single Shipping line has it replaced, and one with several is refused with 422 until you name one or send add_new.
  • add_new (boolean): add a new Shipping line even when one exists.
  • set_shipping_method (boolean): also set the shipping method to the account's method that matches this carrier and service, when one clearly does.
  • record_only (boolean): record the rate as the shipping cost only, without adding a charge.

Response (data): quote_line (the line written, with its financial_line_type; null for record_only) and estimate (the updated estimate row).

Errors: 404 when the estimate does not belong to this quote; 422 when the quote is not editable, the option_key is unknown, the named line is not one of the quote's Shipping lines, or several Shipping lines exist and none was chosen.

Authentication: Requires Bearer token.

Requires permission: quotes.update

Request​

Responses​

OK

Response Headers
    Content-Type