Skip to main content
POST
/
accounts
/
api
/
products
/
{productId}
/
{variantId}
/
cogs
Add a COG line to a variant
curl --request POST \
  --url https://api.upstackdata.com/accounts/api/products/{productId}/{variantId}/cogs \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --header 'x-pixel-id: <api-key>' \
  --data '
{
  "cost": 5,
  "effectiveStartDate": "2026-01-01",
  "description": "Q1 batch"
}
'
{
  "variant": {
    "id": "<string>",
    "productId": "<string>",
    "sku": "<string>",
    "title": "<string>",
    "handlingFee": 123,
    "manualCostHistory": [
      {
        "id": "<string>",
        "cost": 123,
        "effectiveStartDate": "<string>",
        "effectiveEndDate": "<string>",
        "description": "<string>"
      }
    ]
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.upstackdata.com/llms.txt

Use this file to discover all available pages before exploring further.

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
variantId
string
required

Body

application/json
cost
number
required

Per-unit cost in the account's reporting currency.

effectiveStartDate
string
required

ISO-8601 date the new line begins applying.

effectiveEndDate
string | null

ISO-8601 date the line stops applying — omit / null for open-ended.

description
string

Response

The updated variant (with the new line added to history).

variant
object
required

A single SKU under a product. manualCostHistory is the chronological list of COG lines.