Skip to main content
POST
/
v1
/
model
/
{uuid}
/
input
Create a model input
curl --request POST \
  --url https://app.variable.global/api/v1/model/{uuid}/input \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "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/{uuid}/input"

payload = {
"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.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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/{uuid}/input', 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/{uuid}/input",
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([
'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/{uuid}/input"

payload := strings.NewReader("{\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("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/model/{uuid}/input")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\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/{uuid}/input")

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 \"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"
}
Requires permission:

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

uuid
string<uuid>
required

Body

application/json
syncId
string

An identifier to use when syncing data with other systems. Read more

Example:

"sync123"

quantity
number
Example:

150

unit
string

The unit code (e.g. kg, lbs, etc.). All unit codes can be found in the List Units endpoint.

Example:

"kg"

order
number
Example:

1

material
object
block
object
lifecycleStage
object
materialGroup
string[]

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.

Example:
["packaging"]
transport
object | null

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.

Response

An input

uuid
string<uuid>
syncId
string

An identifier to use when syncing data with other systems. Read more

Example:

"sync123"

quantity
number
Example:

150

unit
string

The unit code (e.g. kg, lbs, etc.). All unit codes can be found in the List Units endpoint.

Example:

"kg"

order
number
Example:

1

material
object
block
object
lifecycleStage
object
materialGroup
string[]

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.

Example:
["packaging"]
transport
object | null

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.

created
string

ISO 8601 date

Example:

"2021-01-01T00:00:00.000Z"

updated
string

ISO 8601 date

Example:

"2021-01-31T23:59:59.000Z"

CO2e
string
Example:

"1234.5678"

declaredAmount
object

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.

recycledPercent
number
read-only

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.

Example:

30