curl --request POST \
--url https://app.variable.global/api/v1/transport/mode \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Electric truck",
"taxonomy": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Material",
"path": "material"
},
"dataset": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Name",
"source": "ecoinvent 3.8",
"declaredUnit": "kg"
},
"code": "electric-truck"
}
'import requests
url = "https://app.variable.global/api/v1/transport/mode"
payload = {
"name": "Electric truck",
"taxonomy": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Material",
"path": "material"
},
"dataset": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Name",
"source": "ecoinvent 3.8",
"declaredUnit": "kg"
},
"code": "electric-truck"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Electric truck',
taxonomy: {
uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: 'Material',
path: 'material'
},
dataset: {
uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: 'Name',
source: 'ecoinvent 3.8',
declaredUnit: 'kg'
},
code: 'electric-truck'
})
};
fetch('https://app.variable.global/api/v1/transport/mode', 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://app.variable.global/api/v1/transport/mode",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Electric truck',
'taxonomy' => [
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => 'Material',
'path' => 'material'
],
'dataset' => [
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => 'Name',
'source' => 'ecoinvent 3.8',
'declaredUnit' => 'kg'
],
'code' => 'electric-truck'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.variable.global/api/v1/transport/mode"
payload := strings.NewReader("{\n \"name\": \"Electric truck\",\n \"taxonomy\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Material\",\n \"path\": \"material\"\n },\n \"dataset\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Name\",\n \"source\": \"ecoinvent 3.8\",\n \"declaredUnit\": \"kg\"\n },\n \"code\": \"electric-truck\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://app.variable.global/api/v1/transport/mode")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Electric truck\",\n \"taxonomy\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Material\",\n \"path\": \"material\"\n },\n \"dataset\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Name\",\n \"source\": \"ecoinvent 3.8\",\n \"declaredUnit\": \"kg\"\n },\n \"code\": \"electric-truck\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.variable.global/api/v1/transport/mode")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Electric truck\",\n \"taxonomy\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Material\",\n \"path\": \"material\"\n },\n \"dataset\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Name\",\n \"source\": \"ecoinvent 3.8\",\n \"declaredUnit\": \"kg\"\n },\n \"code\": \"electric-truck\"\n}"
response = http.request(request)
puts response.read_body{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "electric-truck",
"name": "Electric truck",
"taxonomy": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Material",
"path": "material"
},
"dataset": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Name",
"source": "ecoinvent 3.8",
"declaredUnit": "kg"
}
}{
"message": "token expired"
}Create Transport Mode
Create a custom transport mode
curl --request POST \
--url https://app.variable.global/api/v1/transport/mode \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Electric truck",
"taxonomy": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Material",
"path": "material"
},
"dataset": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Name",
"source": "ecoinvent 3.8",
"declaredUnit": "kg"
},
"code": "electric-truck"
}
'import requests
url = "https://app.variable.global/api/v1/transport/mode"
payload = {
"name": "Electric truck",
"taxonomy": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Material",
"path": "material"
},
"dataset": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Name",
"source": "ecoinvent 3.8",
"declaredUnit": "kg"
},
"code": "electric-truck"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Electric truck',
taxonomy: {
uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: 'Material',
path: 'material'
},
dataset: {
uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: 'Name',
source: 'ecoinvent 3.8',
declaredUnit: 'kg'
},
code: 'electric-truck'
})
};
fetch('https://app.variable.global/api/v1/transport/mode', 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://app.variable.global/api/v1/transport/mode",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Electric truck',
'taxonomy' => [
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => 'Material',
'path' => 'material'
],
'dataset' => [
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => 'Name',
'source' => 'ecoinvent 3.8',
'declaredUnit' => 'kg'
],
'code' => 'electric-truck'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.variable.global/api/v1/transport/mode"
payload := strings.NewReader("{\n \"name\": \"Electric truck\",\n \"taxonomy\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Material\",\n \"path\": \"material\"\n },\n \"dataset\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Name\",\n \"source\": \"ecoinvent 3.8\",\n \"declaredUnit\": \"kg\"\n },\n \"code\": \"electric-truck\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://app.variable.global/api/v1/transport/mode")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Electric truck\",\n \"taxonomy\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Material\",\n \"path\": \"material\"\n },\n \"dataset\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Name\",\n \"source\": \"ecoinvent 3.8\",\n \"declaredUnit\": \"kg\"\n },\n \"code\": \"electric-truck\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.variable.global/api/v1/transport/mode")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Electric truck\",\n \"taxonomy\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Material\",\n \"path\": \"material\"\n },\n \"dataset\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Name\",\n \"source\": \"ecoinvent 3.8\",\n \"declaredUnit\": \"kg\"\n },\n \"code\": \"electric-truck\"\n}"
response = http.request(request)
puts response.read_body{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "electric-truck",
"name": "Electric truck",
"taxonomy": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Material",
"path": "material"
},
"dataset": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Name",
"source": "ecoinvent 3.8",
"declaredUnit": "kg"
}
}{
"message": "token expired"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
- Option 1
- Option 2
Provide the backing freight dataset via dataset (preferred). The deprecated footprint alias is still accepted; when both are sent, dataset wins.
Required on create.
"Electric truck"
On write, reference a category by { path } or { uuid }; it must sit under transport/freight/modes/*. Required on create. Reads return the full reference.
Show child attributes
Show child attributes
Custom modes only: the freight emission-factor dataset the mode draws from (declared per tonne-kilometre or tonne-mile). On write, reference it by { uuid } — required on create, and it must be a freight-unit dataset (a per-km or per-kg dataset is rejected). Reads return the full reference. Built-ins have none.
Show child attributes
Show child attributes
Stable handle for the mode, equal to the backing product's sku for a custom mode. 1–128 characters of letters, digits, hyphens, dots, or underscores; unique within your company; cannot reuse a built-in code.
"electric-truck"
Deprecated — use dataset. Backwards-compatible alias for the backing emission-factor dataset; dataset takes precedence when both are sent. Reference it by uuid.
Show child attributes
Show child attributes
Response
The created transport mode
How cargo moves on a transport leg. Built-in modes (truck, container-ship, train, air-*, …) are system-curated and work out of the box; create a custom mode only when no built-in fits. A custom mode is backed by a Product[DATASET_CONTAINER], so its code is that product's sku and it also appears under /v1/product — intentional, not a leak.
Present only for custom modes; built-ins have none.
Stable handle for the mode, equal to the backing product's sku for a custom mode. 1–128 characters of letters, digits, hyphens, dots, or underscores; unique within your company; cannot reuse a built-in code.
"electric-truck"
Required on create.
"Electric truck"
On write, reference a category by { path } or { uuid }; it must sit under transport/freight/modes/*. Required on create. Reads return the full reference.
Show child attributes
Show child attributes
Custom modes only: the freight emission-factor dataset the mode draws from (declared per tonne-kilometre or tonne-mile). On write, reference it by { uuid } — required on create, and it must be a freight-unit dataset (a per-km or per-kg dataset is rejected). Reads return the full reference. Built-ins have none.
Show child attributes
Show child attributes