Skip to main content
POST
Create transport route

Authorizations

X-API-Key
string
header
required

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

Idempotency-Key
string

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.

Required string length: 1 - 255

Body

application/json
source_kind
enum<string>
required

What source_id names: one of your supplier plants, or one of your own plants for a route between two of your plants.

Available options:
plant,
supplier_plant
source_id
string<uuid>
required

UUID of the supplier plant or plant the route starts at.

destination_kind
enum<string>
required

What destination_id names. Only plant (one of your plants) today; other kinds may be added, so branch on this rather than assuming it.

Available options:
plant
destination_id
string<uuid>
required

UUID of the plant the route delivers to.

name
string | null

Optional. Unique among the routes on the lane, ignoring case — a name already held returns 409 (err_transport_route_name_exists). Omitted, the route is named after its source and destination.

Minimum string length: 1
truck_distance_km
number | null

Distance by truck in km.

Example:

80

train_distance_km
number | null

Distance by train in km.

ship_distance_km
number | null

Distance by ship in km.

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.

id
string<uuid>
required
name
string
required

Unique among the routes on its lane, ignoring case.

Example:

"Acme Materials — Munich-Plant Rotterdam-3f9a1c"

source_kind
enum<string>
required

What source_id names: one of your supplier plants, or one of your own plants for a route between two of your plants.

Available options:
plant,
supplier_plant
source_id
string<uuid>
required

UUID of the supplier plant or plant the route starts at.

destination_kind
enum<string>
required

What destination_id names. Only plant (one of your plants) today; other kinds may be added, so branch on this rather than assuming it.

Available options:
plant
destination_id
string<uuid>
required

UUID of the plant the route delivers to.

truck_distance_km
number | null
required

Distance by truck in km.

train_distance_km
number | null
required

Distance by train in km.

ship_distance_km
number | null
required

Distance by ship in km.