Update the global product override
curl --request PUT \
--url https://api.upstackdata.com/accounts/api/costs/global-product-override \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-pixel-id: <api-key>' \
--data '
{
"defaultCogs": 35,
"globalHandlingFee": 1.5,
"currency": "USD"
}
'import requests
url = "https://api.upstackdata.com/accounts/api/costs/global-product-override"
payload = {
"defaultCogs": 35,
"globalHandlingFee": 1.5,
"currency": "USD"
}
headers = {
"x-api-key": "<api-key>",
"x-pixel-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'x-api-key': '<api-key>',
'x-pixel-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({defaultCogs: 35, globalHandlingFee: 1.5, currency: 'USD'})
};
fetch('https://api.upstackdata.com/accounts/api/costs/global-product-override', 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/global-product-override",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'defaultCogs' => 35,
'globalHandlingFee' => 1.5,
'currency' => 'USD'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.upstackdata.com/accounts/api/costs/global-product-override"
payload := strings.NewReader("{\n \"defaultCogs\": 35,\n \"globalHandlingFee\": 1.5,\n \"currency\": \"USD\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-pixel-id", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.upstackdata.com/accounts/api/costs/global-product-override")
.header("x-api-key", "<api-key>")
.header("x-pixel-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"defaultCogs\": 35,\n \"globalHandlingFee\": 1.5,\n \"currency\": \"USD\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.upstackdata.com/accounts/api/costs/global-product-override")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["x-pixel-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"defaultCogs\": 35,\n \"globalHandlingFee\": 1.5,\n \"currency\": \"USD\"\n}"
response = http.request(request)
puts response.read_body{
"config": {
"pixelId": "<string>",
"costType": "global_product_override",
"createdAt": "<string>",
"updatedAt": "<string>",
"defaultCogs": 123,
"globalHandlingFee": 123,
"currency": "<string>"
}
}{
"message": "<string>",
"errors": [
{
"message": "<string>",
"key": "<string>",
"path": [
"<string>"
]
}
]
}{
"message": "<string>",
"errors": [
{
"message": "<string>",
"key": "<string>",
"path": [
"<string>"
]
}
]
}{
"message": "<string>",
"errors": [
{
"message": "<string>",
"key": "<string>",
"path": [
"<string>"
]
}
]
}COSTS
Update the global product override
Update the default COGS / handling fee applied to product variants
that have no per-variant COG line. At least one of defaultCogs,
globalHandlingFee, or currency must be supplied.
Triggers a per-order COGS recalculation downstream (same SQS message the web UI emits for this change).
Required scope: costs:write.
PUT
/
accounts
/
api
/
costs
/
global-product-override
Update the global product override
curl --request PUT \
--url https://api.upstackdata.com/accounts/api/costs/global-product-override \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-pixel-id: <api-key>' \
--data '
{
"defaultCogs": 35,
"globalHandlingFee": 1.5,
"currency": "USD"
}
'import requests
url = "https://api.upstackdata.com/accounts/api/costs/global-product-override"
payload = {
"defaultCogs": 35,
"globalHandlingFee": 1.5,
"currency": "USD"
}
headers = {
"x-api-key": "<api-key>",
"x-pixel-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'x-api-key': '<api-key>',
'x-pixel-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({defaultCogs: 35, globalHandlingFee: 1.5, currency: 'USD'})
};
fetch('https://api.upstackdata.com/accounts/api/costs/global-product-override', 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/global-product-override",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'defaultCogs' => 35,
'globalHandlingFee' => 1.5,
'currency' => 'USD'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.upstackdata.com/accounts/api/costs/global-product-override"
payload := strings.NewReader("{\n \"defaultCogs\": 35,\n \"globalHandlingFee\": 1.5,\n \"currency\": \"USD\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-pixel-id", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.upstackdata.com/accounts/api/costs/global-product-override")
.header("x-api-key", "<api-key>")
.header("x-pixel-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"defaultCogs\": 35,\n \"globalHandlingFee\": 1.5,\n \"currency\": \"USD\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.upstackdata.com/accounts/api/costs/global-product-override")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["x-pixel-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"defaultCogs\": 35,\n \"globalHandlingFee\": 1.5,\n \"currency\": \"USD\"\n}"
response = http.request(request)
puts response.read_body{
"config": {
"pixelId": "<string>",
"costType": "global_product_override",
"createdAt": "<string>",
"updatedAt": "<string>",
"defaultCogs": 123,
"globalHandlingFee": 123,
"currency": "<string>"
}
}{
"message": "<string>",
"errors": [
{
"message": "<string>",
"key": "<string>",
"path": [
"<string>"
]
}
]
}{
"message": "<string>",
"errors": [
{
"message": "<string>",
"key": "<string>",
"path": [
"<string>"
]
}
]
}{
"message": "<string>",
"errors": [
{
"message": "<string>",
"key": "<string>",
"path": [
"<string>"
]
}
]
}Authorizations
Body
application/json
At least one field is required. The product defaults apply to any variant with no cost of its own (no manual COG line and no Shopify cost for the order's date).
Was this page helpful?