Skip to main content
PUT
Required scope: costs:write Use this to correct a line, such as a mistyped gateway rate, or to end-date one. To change a rate from a given date without rewriting older orders, set effectiveTo on the current line here, then add the new rate with Add a cost line.

Finding the line

  • Take lineId from Get cost configuration: entries[].id, or profiles[].id for shipping profiles.
  • costType must be the type the line belongs to. A mismatch returns 404 with Cost line not found or Cost config not found for type.
  • Always send updates. A body without it fails with 500, not 400.

How the merge works

  • Fields in updates overwrite the line’s values. Everything else is kept, along with the line’s id and createdAt. updatedAt is set to the time of the request.
  • A field that isn’t part of the line shape for costType returns 400.
  • null removes a field, but only for the type-dependent amount fields and the effective dates. The schema for updates lists them.
  • When you change an order line’s type or a shipping profile’s rateType, send the amount fields the new type needs in the same request, and null the ones it doesn’t. Switching an order line to a pct_* type needs percentRate; a per_* type needs flatAmount; by_order_weight needs weightUnit and weightIntervals; the quantity types need quantityIntervals. A shipping profile switched to weight_tiered needs weightUnit and weightTiers, and one switched to flat needs flatAmount.

Recalculation

Changes to order, gateway, and shipping lines recalculate the past orders they affect. variable and fixed lines are applied when reports are built, so their changes show up without a recalculation.

Authorizations

x-api-key
string
header
required

Your Upstack API key. Starts with upstack_.

x-pixel-id
string
header
required

The pixel id the request targets.

Path Parameters

lineId
string
required

The line's id (a ULID), from entries[].id or profiles[].id in Get cost configuration.

Body

application/json

Partial update. Every field of the line shape for costType is optional in updates. Fields you send are written and fields you leave out keep their value. Send null to remove an amount field that no longer applies after a type change: flatAmount, percentRate, weightUnit, weightIntervals, or quantityIntervals on order lines, and flatAmount, weightUnit, or weightTiers on shipping profiles. effectiveFrom and effectiveTo also accept null to clear the date. null on any other field is rejected with 400.

costType
enum<string>
required

The cost type the line belongs to. It must match the line, or the request returns 404.

Available options:
order,
gateway,
shipping,
variable,
fixed
updates
object
required

Fields to change, taken from the line shape for costType: OrderCostLine, GatewayCostLine, ShippingProfileCostLine, VariableCostLine, or FixedCostLine. A field that isn't in that shape is rejected with 400.

Response

The updated cost config.

config
Global product override · object
required

One stored cost configuration. Which shape you get follows costType.