Get cost configuration
curl --request GET \
--url https://api.upstackdata.com/accounts/api/costs \
--header 'x-api-key: <api-key>' \
--header 'x-pixel-id: <api-key>'import requests
url = "https://api.upstackdata.com/accounts/api/costs"
headers = {
"x-api-key": "<api-key>",
"x-pixel-id": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>', 'x-pixel-id': '<api-key>'}};
fetch('https://api.upstackdata.com/accounts/api/costs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.upstackdata.com/accounts/api/costs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>",
"x-pixel-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.upstackdata.com/accounts/api/costs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-pixel-id", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.upstackdata.com/accounts/api/costs")
.header("x-api-key", "<api-key>")
.header("x-pixel-id", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.upstackdata.com/accounts/api/costs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
request["x-pixel-id"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"config": {
"pixelId": "5f1e6a4f-2b7c-4d1e-9a3f-8c6b2e0d4a71",
"costType": "gateway",
"entries": [
{
"id": "01K5Q8R2S4T6V8W0X2Y4Z6A8B0",
"name": "Shopify Payments",
"gatewayName": "shopify_payments",
"flatAmount": 0.3,
"percentRate": 2.9,
"currency": "USD",
"createdAt": "2026-05-04T09:20:11.502Z",
"updatedAt": "2026-05-04T09:20:11.502Z"
},
{
"id": "01K5Q8T7V9W1X3Y5Z7A9B1C3D5",
"name": "PayPal",
"gatewayName": "paypal",
"flatAmount": 0.49,
"percentRate": 3.49,
"currency": "USD",
"effectiveFrom": "2026-01-01",
"createdAt": "2026-05-04T09:21:40.019Z",
"updatedAt": "2026-08-14T12:02:55.731Z"
}
],
"createdAt": "2026-05-04T09:20:11.502Z",
"updatedAt": "2026-08-14T12:02:55.731Z"
}
}COSTS
Get cost configuration for COGS, shipping, and fees
Read cost settings for product defaults, order fees, payment processing fees, shipping, variable costs, and recurring expenses, all at once or one type at a time.
GET
/
accounts
/
api
/
costs
Get cost configuration
curl --request GET \
--url https://api.upstackdata.com/accounts/api/costs \
--header 'x-api-key: <api-key>' \
--header 'x-pixel-id: <api-key>'import requests
url = "https://api.upstackdata.com/accounts/api/costs"
headers = {
"x-api-key": "<api-key>",
"x-pixel-id": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>', 'x-pixel-id': '<api-key>'}};
fetch('https://api.upstackdata.com/accounts/api/costs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.upstackdata.com/accounts/api/costs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>",
"x-pixel-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.upstackdata.com/accounts/api/costs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-pixel-id", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.upstackdata.com/accounts/api/costs")
.header("x-api-key", "<api-key>")
.header("x-pixel-id", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.upstackdata.com/accounts/api/costs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
request["x-pixel-id"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"config": {
"pixelId": "5f1e6a4f-2b7c-4d1e-9a3f-8c6b2e0d4a71",
"costType": "gateway",
"entries": [
{
"id": "01K5Q8R2S4T6V8W0X2Y4Z6A8B0",
"name": "Shopify Payments",
"gatewayName": "shopify_payments",
"flatAmount": 0.3,
"percentRate": 2.9,
"currency": "USD",
"createdAt": "2026-05-04T09:20:11.502Z",
"updatedAt": "2026-05-04T09:20:11.502Z"
},
{
"id": "01K5Q8T7V9W1X3Y5Z7A9B1C3D5",
"name": "PayPal",
"gatewayName": "paypal",
"flatAmount": 0.49,
"percentRate": 3.49,
"currency": "USD",
"effectiveFrom": "2026-01-01",
"createdAt": "2026-05-04T09:21:40.019Z",
"updatedAt": "2026-08-14T12:02:55.731Z"
}
],
"createdAt": "2026-05-04T09:20:11.502Z",
"updatedAt": "2026-08-14T12:02:55.731Z"
}
}Required scope: The response shape depends on
Per-variant product costs aren’t part of this response. Read them with
Search products or
Get a product variant.
Each stored record also carries internal storage keys such as
costs:read
Use this to audit what’s configured before a margin review, or to find a cost line’s
id before you change it with Update a cost line
or remove it with Delete a cost line.
Cost settings explains what each setting does.
The response shape depends on type
- Without
type, the response is{ "configs": { ... } }with one key per cost type. A type you’ve never configured isnull. - With
type, the response is{ "config": ... }: that one configuration, ornull. - An unrecognized
typeisn’t rejected. It returns{"config": null}, so check the spelling if you getnullfor a type you know is set up. - If the read itself fails, you get
nullvalues (or{}) with a200rather than an error. Don’t treatnullalone as proof that nothing is configured.
Where each cost type lives
costType | Cost settings section | Line ids |
|---|---|---|
global_product_override | Product defaults | No lines. Change it with Update the global product override. |
order | Order fees | entries[].id |
gateway | Payment processing fees | entries[].id |
shipping | Shipping | profiles[].id. The method is set with Update shipping cost settings. |
variable | Variable costs | entries[].id |
fixed | Recurring expenses | entries[].id |
pk and env. Ignore them.
Related
- Add a cost line to create order, gateway, shipping, variable, or fixed lines.
upstack costsreads and edits costs from the CLI.
Authorizations
Query Parameters
Response
The cost configuration, or the filtered subset.
With ?type=, the response is { "config": … } — that one config, or
null when none is stored for the type. Without it, the response is
{ "configs": … }, every config keyed by cost type.
Was this page helpful?