Skip to main content
POST
← Logistic Hubs API Create one or many logistic hubs: your warehouses, cross-docks and transshipment points, and the third-party ones your shipments go through. A hub is master data: creating it calculates nothing (an owned hub’s emissions are those of its facility), so the request is synchronous: it answers 201 Created with every hub, in the order you sent them. Create your hubs before the logistics requests that reference them.
Beta. Part of the bulk ingest API, currently in beta. The contract may still change before general availability.

How it works

  1. Every record is checked: the name is free, the country and the category exist, and an owned hub’s facility is usable and not already linked to another hub. If any record is invalid the whole request is rejected with 422 and nothing is created; the answer lists every invalid record.
  2. Every hub is created in one transaction and returned, in the order sent. source_row_index is the position of the record in records, and client_row_id echoes yours.
  3. The address is stored as you send it; it is not geocoded here. Logistics requests that reference the hub take it as their origin and geocode it when they are calculated: an address that cannot be located shows up then, as a per-leg error of those requests. Send the full address (street, postal code, city).
  4. The hubs belong to the x-organization-id organization. A record cannot name another one: send each organization’s hubs with its own x-organization-id.
  5. Logistics requests find a hub by its exact name (the hub_id of Create Logistics Requests (v2)): same case, no extra spaces. Use the code your own systems use for it.

Request

Headers

string
required
Your API key (see Authentication).
string
required
The organization the hubs belong to.
string
required
1 to 255 characters, unique per batch. A retry with the same key and body answers the same hubs (with Idempotent-Replayed: true) instead of creating them again; the same key with another body is 422 IDEMPOTENCY_KEY_REUSED, and while the first request is still being processed 409 IDEMPOTENCY_KEY_IN_PROGRESS.

Query Parameters

boolean
default:"false"
Check only: the same 422 for invalid records, nothing created; 200 with {"dry_run": true, "submitted": n, "valid": n} when every record is valid.

Body Parameters

array[object]
required
The hubs to create, 1 to 1,000. A field not listed here is rejected (SCHEMA_INVALID).

Response

201 Created with items: one per record, in the order sent, each with source_row_index, client_row_id and the created hub: id, organization_id, name, type, country, address, category, facility_id, supercharger, status (active) and UTC timestamps ending in Z.

Errors

Problem details. Per-record codes in errors[].error_code: 401 for a missing or invalid API key, 403 LOGGED_USER_NOT_MEMBER when the key’s user is not a member of the organization, 422 REQUEST_VALIDATION_FAILED for a malformed body (no records, more than 1,000, no Idempotency-Key), 422 IDEMPOTENCY_KEY_REUSED, 409 IDEMPOTENCY_KEY_IN_PROGRESS, and 429 beyond the rate limits.

Retries and idempotency

  • Network error or timeout: retry with the same Idempotency-Key and body. If the first request was accepted you get the same hubs back, with Idempotent-Replayed: true, and nothing is duplicated.
  • 422 BULK_RECORDS_REJECTED: nothing was created. Fix the records and send the batch again.

Limits

List Logistic Hubs

The organization’s hubs and their ids

List HOCs

Values for category

List Facilities

Ids for facility_id

Create Logistics Requests (v2)

The shipment legs that reference your hubs