Skip to main content
POST
/
accounts
/
api
/
costs
/
lines
curl --request POST \
  --url https://api.upstackdata.com/accounts/api/costs/lines \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --header 'x-pixel-id: <api-key>' \
  --data '
{
  "costType": "variable",
  "line": {
    "name": "Google Ads — % of spend",
    "type": "pct_ad_spend",
    "percentRate": 2,
    "category": "marketing",
    "channel": "online",
    "currency": "USD"
  }
}
'
{
  "config": {}
}

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.

Body

application/json

line shape is discriminated by costType — the listed schemas for each cost type are validated server-side. Sending an OrderCostLine shape with costType=variable is rejected with 400.

costType
enum<string>
required

The five cost-line surfaces. Each value selects the corresponding line shape in the line (POST) or updates (PUT) field of the request body.

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

One of the per-type line shapes, selected by costType.

Response

The updated cost config (with the new line appended).

config
object
required