curl --request POST \
--url https://api.emidat.com/v2/transport-routes \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"source_kind": "supplier_plant",
"source_id": "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
"destination_kind": "plant",
"destination_id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
}
'import requests
url = "https://api.emidat.com/v2/transport-routes"
payload = {
"source_kind": "supplier_plant",
"source_id": "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
"destination_kind": "plant",
"destination_id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source_kind: 'supplier_plant',
source_id: '1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d',
destination_kind: 'plant',
destination_id: 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
})
};
fetch('https://api.emidat.com/v2/transport-routes', 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.emidat.com/v2/transport-routes",
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([
'source_kind' => 'supplier_plant',
'source_id' => '1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d',
'destination_kind' => 'plant',
'destination_id' => 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <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.emidat.com/v2/transport-routes"
payload := strings.NewReader("{\n \"source_kind\": \"supplier_plant\",\n \"source_id\": \"1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d\",\n \"destination_kind\": \"plant\",\n \"destination_id\": \"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<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.post("https://api.emidat.com/v2/transport-routes")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"source_kind\": \"supplier_plant\",\n \"source_id\": \"1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d\",\n \"destination_kind\": \"plant\",\n \"destination_id\": \"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.emidat.com/v2/transport-routes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source_kind\": \"supplier_plant\",\n \"source_id\": \"1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d\",\n \"destination_kind\": \"plant\",\n \"destination_id\": \"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Acme Materials — Munich-Plant Rotterdam-3f9a1c",
"source_kind": "plant",
"source_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"destination_kind": "plant",
"destination_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"truck_distance_km": 123,
"train_distance_km": 123,
"ship_distance_km": 123
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Acme Materials — Munich-Plant Rotterdam-3f9a1c",
"source_kind": "plant",
"source_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"destination_kind": "plant",
"destination_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"truck_distance_km": 123,
"train_distance_km": 123,
"ship_distance_km": 123
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
},
"product_categories": [
"<string>"
],
"epd_category": 123,
"license_start": "2023-12-25",
"validation_errors": {}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
},
"product_categories": [
"<string>"
],
"epd_category": 123,
"license_start": "2023-12-25",
"validation_errors": {}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
},
"product_categories": [
"<string>"
],
"epd_category": 123,
"license_start": "2023-12-25",
"validation_errors": {}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
},
"product_categories": [
"<string>"
],
"epd_category": 123,
"license_start": "2023-12-25",
"validation_errors": {}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
},
"product_categories": [
"<string>"
],
"epd_category": 123,
"license_start": "2023-12-25",
"validation_errors": {}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
},
"product_categories": [
"<string>"
],
"epd_category": 123,
"license_start": "2023-12-25",
"validation_errors": {}
}Create transport route
Creates a transport route from a source to one of your plants.
Suggested distances — send no distance at all and the route
takes the road distance between the two stored addresses, from the
routing provider. Send any distance and the route takes exactly the
distances you sent; set a modality to null (or leave it out) when
the route does not use it.
A plant at either end must be within the key’s plant access
(403).
Idempotent create — a replay of the same Idempotency-Key returns the
original response (200); otherwise a new route is created (201).
curl --request POST \
--url https://api.emidat.com/v2/transport-routes \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"source_kind": "supplier_plant",
"source_id": "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
"destination_kind": "plant",
"destination_id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
}
'import requests
url = "https://api.emidat.com/v2/transport-routes"
payload = {
"source_kind": "supplier_plant",
"source_id": "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
"destination_kind": "plant",
"destination_id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source_kind: 'supplier_plant',
source_id: '1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d',
destination_kind: 'plant',
destination_id: 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
})
};
fetch('https://api.emidat.com/v2/transport-routes', 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.emidat.com/v2/transport-routes",
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([
'source_kind' => 'supplier_plant',
'source_id' => '1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d',
'destination_kind' => 'plant',
'destination_id' => 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <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.emidat.com/v2/transport-routes"
payload := strings.NewReader("{\n \"source_kind\": \"supplier_plant\",\n \"source_id\": \"1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d\",\n \"destination_kind\": \"plant\",\n \"destination_id\": \"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<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.post("https://api.emidat.com/v2/transport-routes")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"source_kind\": \"supplier_plant\",\n \"source_id\": \"1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d\",\n \"destination_kind\": \"plant\",\n \"destination_id\": \"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.emidat.com/v2/transport-routes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source_kind\": \"supplier_plant\",\n \"source_id\": \"1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d\",\n \"destination_kind\": \"plant\",\n \"destination_id\": \"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Acme Materials — Munich-Plant Rotterdam-3f9a1c",
"source_kind": "plant",
"source_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"destination_kind": "plant",
"destination_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"truck_distance_km": 123,
"train_distance_km": 123,
"ship_distance_km": 123
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Acme Materials — Munich-Plant Rotterdam-3f9a1c",
"source_kind": "plant",
"source_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"destination_kind": "plant",
"destination_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"truck_distance_km": 123,
"train_distance_km": 123,
"ship_distance_km": 123
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
},
"product_categories": [
"<string>"
],
"epd_category": 123,
"license_start": "2023-12-25",
"validation_errors": {}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
},
"product_categories": [
"<string>"
],
"epd_category": 123,
"license_start": "2023-12-25",
"validation_errors": {}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
},
"product_categories": [
"<string>"
],
"epd_category": 123,
"license_start": "2023-12-25",
"validation_errors": {}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
},
"product_categories": [
"<string>"
],
"epd_category": 123,
"license_start": "2023-12-25",
"validation_errors": {}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
},
"product_categories": [
"<string>"
],
"epd_category": 123,
"license_start": "2023-12-25",
"validation_errors": {}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
},
"product_categories": [
"<string>"
],
"epd_category": 123,
"license_start": "2023-12-25",
"validation_errors": {}
}Authorizations
Per-manufacturer API key in the X-API-Key header, format
emidat-{key_id}-{secret} where key_id is a random public handle.
Issued by an owner in the Emidat
dashboard; carries its own permission scopes, optional plant
restrictions, and optional expiry. A revoked, expired, or unknown key
returns 401. See the Authentication guide for details.
Headers
Optional client-generated key of 1–255 characters (e.g. a UUID) that makes
a create idempotent — the only mechanism that does so. A replay carrying the same
key returns the original response unchanged (200); reusing a key with a
different request body (compared byte for byte) or create endpoint is
rejected with 409 err_idempotency_key_reused. Concurrent requests with
the same key receive 409 err_idempotency_in_progress. Keys are scoped
to your manufacturer; successful responses are retained for 6h without
extending that window on replay. Current permissions are required on
every retry; product-instance replays also require the original
production-data scopes. Deduplication is best effort: Redis data loss
can end the window early, and Redis unavailability, timeouts, or unreadable
cache entries can allow creation without replay protection. Successful
creates still return 201 if caching fails. Redis waits share a two-second
budget excluding creation time. Incompatible replay-format upgrades
reset replay protection, so retries across that boundary can create again.
An interrupted create can reserve the key for up to 6h.
See External IDs for recovery guidance.
1 - 255Body
Response
Returned unchanged — an Idempotency-Key replay.
A transport route from a source to one of your plants, with at least one distance per modality in km. Several materials can travel the same route, and one lane (source and destination) can hold several routes.