Skip to main content
PUT
Required scope: costs:write Use this to fix a mistyped cost or to end-date a line when the price changes. Send only the fields you want to change. To end-date a line, send just effectiveEndDate. To fix a cost, send just cost. How each field in the body is applied:
  • Left out: the line keeps its stored value.
  • Set to a value: the line takes the new value.
  • Set to null: clears cost or description, and makes effectiveEndDate open-ended. effectiveStartDate can’t be cleared; every line needs one.
  • The line keeps its id and createdAt. updatedAt is set to the time of the request.
  • Only lines in manualCostHistory can be updated. Lines synced from Shopify are read-only, and their ids return 404 (COG line not found).
  • An unknown variant returns 404 (Variant not found).
  • Upstack recalculates the past orders the line covers after the change.

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

productId
string
required

Shopify product id.

variantId
string
required

Shopify variant id.

cogId
string
required

The line's id from the variant's manualCostHistory.

Body

application/json

The fields to change. A field you leave out keeps its stored value.

cost
number | null

Per-unit cost in your store's currency. Send null to clear it.

Required range: x >= 0
effectiveStartDate
string

ISO 8601 date or timestamp the line starts applying. Can't be cleared.

effectiveEndDate
string | null

ISO 8601 date or timestamp the line stops applying. Send null to make the line open-ended.

description
string | null

Optional note. Send null to clear it.

Response

The updated variant.

variant
object
required

A stored product variant, synced from Shopify. Each variant record also carries its parent product's details, so one call gives you both.

The fields below are the ones worth relying on; the record also includes internal index keys (lowercased titles, composite ids) that you should ignore.