curl --request PATCH \
--url https://app.variable.global/api/v1/model/{modelId}/input/{inputId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123",
"quantity": 150,
"unit": "kg",
"order": 1,
"material": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Material name"
},
"block": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Block name"
},
"lifecycleStage": {
"code": "A1",
"name": "Materials"
},
"materialGroup": [
"packaging"
],
"transport": {
"lane": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123"
},
"for": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123"
},
"weight": {
"quantity": 250,
"unit": "kg"
}
}
}
'import requests
url = "https://app.variable.global/api/v1/model/{modelId}/input/{inputId}"
payload = {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123",
"quantity": 150,
"unit": "kg",
"order": 1,
"material": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Material name"
},
"block": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Block name"
},
"lifecycleStage": {
"code": "A1",
"name": "Materials"
},
"materialGroup": ["packaging"],
"transport": {
"lane": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123"
},
"for": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123"
},
"weight": {
"quantity": 250,
"unit": "kg"
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
syncId: 'sync123',
quantity: 150,
unit: 'kg',
order: 1,
material: {uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a', name: 'Material name'},
block: {uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a', name: 'Block name'},
lifecycleStage: {code: 'A1', name: 'Materials'},
materialGroup: ['packaging'],
transport: {
lane: {uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a', syncId: 'sync123'},
for: {uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a', syncId: 'sync123'},
weight: {quantity: 250, unit: 'kg'}
}
})
};
fetch('https://app.variable.global/api/v1/model/{modelId}/input/{inputId}', 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/model/{modelId}/input/{inputId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'syncId' => 'sync123',
'quantity' => 150,
'unit' => 'kg',
'order' => 1,
'material' => [
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => 'Material name'
],
'block' => [
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => 'Block name'
],
'lifecycleStage' => [
'code' => 'A1',
'name' => 'Materials'
],
'materialGroup' => [
'packaging'
],
'transport' => [
'lane' => [
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'syncId' => 'sync123'
],
'for' => [
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'syncId' => 'sync123'
],
'weight' => [
'quantity' => 250,
'unit' => 'kg'
]
]
]),
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/model/{modelId}/input/{inputId}"
payload := strings.NewReader("{\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"syncId\": \"sync123\",\n \"quantity\": 150,\n \"unit\": \"kg\",\n \"order\": 1,\n \"material\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Material name\"\n },\n \"block\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Block name\"\n },\n \"lifecycleStage\": {\n \"code\": \"A1\",\n \"name\": \"Materials\"\n },\n \"materialGroup\": [\n \"packaging\"\n ],\n \"transport\": {\n \"lane\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"syncId\": \"sync123\"\n },\n \"for\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"syncId\": \"sync123\"\n },\n \"weight\": {\n \"quantity\": 250,\n \"unit\": \"kg\"\n }\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://app.variable.global/api/v1/model/{modelId}/input/{inputId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"syncId\": \"sync123\",\n \"quantity\": 150,\n \"unit\": \"kg\",\n \"order\": 1,\n \"material\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Material name\"\n },\n \"block\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Block name\"\n },\n \"lifecycleStage\": {\n \"code\": \"A1\",\n \"name\": \"Materials\"\n },\n \"materialGroup\": [\n \"packaging\"\n ],\n \"transport\": {\n \"lane\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"syncId\": \"sync123\"\n },\n \"for\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"syncId\": \"sync123\"\n },\n \"weight\": {\n \"quantity\": 250,\n \"unit\": \"kg\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.variable.global/api/v1/model/{modelId}/input/{inputId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"syncId\": \"sync123\",\n \"quantity\": 150,\n \"unit\": \"kg\",\n \"order\": 1,\n \"material\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Material name\"\n },\n \"block\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Block name\"\n },\n \"lifecycleStage\": {\n \"code\": \"A1\",\n \"name\": \"Materials\"\n },\n \"materialGroup\": [\n \"packaging\"\n ],\n \"transport\": {\n \"lane\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"syncId\": \"sync123\"\n },\n \"for\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"syncId\": \"sync123\"\n },\n \"weight\": {\n \"quantity\": 250,\n \"unit\": \"kg\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123",
"quantity": 150,
"unit": "kg",
"order": 1,
"material": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Material name"
},
"block": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Block name"
},
"lifecycleStage": {
"code": "A1",
"name": "Materials"
},
"materialGroup": [
"packaging"
],
"transport": {
"lane": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123",
"name": "Newark, NJ to Rotterdam, NL"
},
"for": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123",
"name": "Newark, NJ to Rotterdam, NL"
},
"weight": {
"quantity": 250,
"unit": "kg"
},
"tkm": 1510.6
},
"created": "2021-01-01T00:00:00.000Z",
"updated": "2021-01-31T23:59:59.000Z",
"CO2e": "1234.5678",
"declaredAmount": {
"quantity": 0.002,
"unit": "kg"
},
"recycledPercent": 30
}{
"message": "token expired"
}Edit Input
Edit model input
curl --request PATCH \
--url https://app.variable.global/api/v1/model/{modelId}/input/{inputId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123",
"quantity": 150,
"unit": "kg",
"order": 1,
"material": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Material name"
},
"block": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Block name"
},
"lifecycleStage": {
"code": "A1",
"name": "Materials"
},
"materialGroup": [
"packaging"
],
"transport": {
"lane": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123"
},
"for": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123"
},
"weight": {
"quantity": 250,
"unit": "kg"
}
}
}
'import requests
url = "https://app.variable.global/api/v1/model/{modelId}/input/{inputId}"
payload = {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123",
"quantity": 150,
"unit": "kg",
"order": 1,
"material": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Material name"
},
"block": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Block name"
},
"lifecycleStage": {
"code": "A1",
"name": "Materials"
},
"materialGroup": ["packaging"],
"transport": {
"lane": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123"
},
"for": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123"
},
"weight": {
"quantity": 250,
"unit": "kg"
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
syncId: 'sync123',
quantity: 150,
unit: 'kg',
order: 1,
material: {uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a', name: 'Material name'},
block: {uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a', name: 'Block name'},
lifecycleStage: {code: 'A1', name: 'Materials'},
materialGroup: ['packaging'],
transport: {
lane: {uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a', syncId: 'sync123'},
for: {uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a', syncId: 'sync123'},
weight: {quantity: 250, unit: 'kg'}
}
})
};
fetch('https://app.variable.global/api/v1/model/{modelId}/input/{inputId}', 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/model/{modelId}/input/{inputId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'syncId' => 'sync123',
'quantity' => 150,
'unit' => 'kg',
'order' => 1,
'material' => [
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => 'Material name'
],
'block' => [
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => 'Block name'
],
'lifecycleStage' => [
'code' => 'A1',
'name' => 'Materials'
],
'materialGroup' => [
'packaging'
],
'transport' => [
'lane' => [
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'syncId' => 'sync123'
],
'for' => [
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'syncId' => 'sync123'
],
'weight' => [
'quantity' => 250,
'unit' => 'kg'
]
]
]),
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/model/{modelId}/input/{inputId}"
payload := strings.NewReader("{\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"syncId\": \"sync123\",\n \"quantity\": 150,\n \"unit\": \"kg\",\n \"order\": 1,\n \"material\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Material name\"\n },\n \"block\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Block name\"\n },\n \"lifecycleStage\": {\n \"code\": \"A1\",\n \"name\": \"Materials\"\n },\n \"materialGroup\": [\n \"packaging\"\n ],\n \"transport\": {\n \"lane\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"syncId\": \"sync123\"\n },\n \"for\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"syncId\": \"sync123\"\n },\n \"weight\": {\n \"quantity\": 250,\n \"unit\": \"kg\"\n }\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://app.variable.global/api/v1/model/{modelId}/input/{inputId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"syncId\": \"sync123\",\n \"quantity\": 150,\n \"unit\": \"kg\",\n \"order\": 1,\n \"material\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Material name\"\n },\n \"block\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Block name\"\n },\n \"lifecycleStage\": {\n \"code\": \"A1\",\n \"name\": \"Materials\"\n },\n \"materialGroup\": [\n \"packaging\"\n ],\n \"transport\": {\n \"lane\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"syncId\": \"sync123\"\n },\n \"for\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"syncId\": \"sync123\"\n },\n \"weight\": {\n \"quantity\": 250,\n \"unit\": \"kg\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.variable.global/api/v1/model/{modelId}/input/{inputId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"syncId\": \"sync123\",\n \"quantity\": 150,\n \"unit\": \"kg\",\n \"order\": 1,\n \"material\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Material name\"\n },\n \"block\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Block name\"\n },\n \"lifecycleStage\": {\n \"code\": \"A1\",\n \"name\": \"Materials\"\n },\n \"materialGroup\": [\n \"packaging\"\n ],\n \"transport\": {\n \"lane\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"syncId\": \"sync123\"\n },\n \"for\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"syncId\": \"sync123\"\n },\n \"weight\": {\n \"quantity\": 250,\n \"unit\": \"kg\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123",
"quantity": 150,
"unit": "kg",
"order": 1,
"material": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Material name"
},
"block": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Block name"
},
"lifecycleStage": {
"code": "A1",
"name": "Materials"
},
"materialGroup": [
"packaging"
],
"transport": {
"lane": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123",
"name": "Newark, NJ to Rotterdam, NL"
},
"for": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123",
"name": "Newark, NJ to Rotterdam, NL"
},
"weight": {
"quantity": 250,
"unit": "kg"
},
"tkm": 1510.6
},
"created": "2021-01-01T00:00:00.000Z",
"updated": "2021-01-31T23:59:59.000Z",
"CO2e": "1234.5678",
"declaredAmount": {
"quantity": 0.002,
"unit": "kg"
},
"recycledPercent": 30
}{
"message": "token expired"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
150
The unit code (e.g. kg, lbs, etc.). All unit codes can be found in the List Units endpoint.
"kg"
1
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
How this input is categorized within its life-cycle stage. Common values
are product, packaging, and ancillary; custom values (e.g. from a PCR
document) are allowed. isPackaging is kept consistent automatically.
["packaging"]
Freight transport attached to this input as a single transport leg. Set to attach or update the binding; send null on PATCH to detach (omitting transport leaves an existing binding untouched). An input cannot be both a material line and a transport leg — sending material and transport together returns 400.
Show child attributes
Show child attributes
Response
An input
150
The unit code (e.g. kg, lbs, etc.). All unit codes can be found in the List Units endpoint.
"kg"
1
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
How this input is categorized within its life-cycle stage. Common values
are product, packaging, and ancillary; custom values (e.g. from a PCR
document) are allowed. isPackaging is kept consistent automatically.
["packaging"]
Freight transport attached to this input as a single transport leg. Set to attach or update the binding; send null on PATCH to detach (omitting transport leaves an existing binding untouched). An input cannot be both a material line and a transport leg — sending material and transport together returns 400.
Show child attributes
Show child attributes
ISO 8601 date
"2021-01-01T00:00:00.000Z"
ISO 8601 date
"2021-01-31T23:59:59.000Z"
"1234.5678"
Read-only canonical amount in the source product's declared unit, used by
impact calculation. Present only when quantity + unit you sent are in
a different dimension than the source product's declared unit (e.g. you
sent kg for an m3-declared source product that has a weight conversion
factor). Ignored on POST/PATCH.
Show child attributes
Show child attributes
Read-only. Recycled content of this input as a percentage (0–100), inherited from its source product — the source's modeled recycled content when available, otherwise its declared value. 0 when the input has no source product or the source has neither. Ignored on POST/PATCH.
30