Create Logistic Hub
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
type: '<string>',
category: '<string>',
address: '<string>',
supercharger: true,
facility_id: '<string>'
})
};
fetch('https://api.dcycle.io/v1/logistic-hubs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/logistic-hubs"
payload = {
"name": "<string>",
"type": "<string>",
"category": "<string>",
"address": "<string>",
"supercharger": True,
"facility_id": "<string>"
}
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.dcycle.io/v1/logistic-hubs \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"name": "<string>",
"type": "<string>",
"category": "<string>",
"address": "<string>",
"supercharger": true,
"facility_id": "<string>"
}
'{
"id": "<string>",
"name": "<string>",
"type": "<string>",
"category": {},
"address": {},
"country": {},
"status": "<string>",
"supercharger": true,
"facility_id": {},
"co2e": {},
"created_at": {},
"updated_at": {}
}Create Logistic Hub
Add a new logistic hub to your organization
POST
/
v1
/
logistic-hubs
Create Logistic Hub
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
type: '<string>',
category: '<string>',
address: '<string>',
supercharger: true,
facility_id: '<string>'
})
};
fetch('https://api.dcycle.io/v1/logistic-hubs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/logistic-hubs"
payload = {
"name": "<string>",
"type": "<string>",
"category": "<string>",
"address": "<string>",
"supercharger": True,
"facility_id": "<string>"
}
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.dcycle.io/v1/logistic-hubs \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"name": "<string>",
"type": "<string>",
"category": "<string>",
"address": "<string>",
"supercharger": true,
"facility_id": "<string>"
}
'{
"id": "<string>",
"name": "<string>",
"type": "<string>",
"category": {},
"address": {},
"country": {},
"status": "<string>",
"supercharger": true,
"facility_id": {},
"co2e": {},
"created_at": {},
"updated_at": {}
}Create Logistic Hub
Create a new logistic hub in your organization. Hubs can be either owned (linked to a facility for emissions tracking) or subcontracted (external logistics provider).Owned vs Subcontracted: When
type is owned, you must provide a facility_id. When type is subcontracted, facility_id is ignored and set to null.Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faBody Parameters
string
required
Name of the logistic hub (must be unique within the organization)Example:
"Madrid Warehouse"string
required
Hub type:
owned or subcontractedExample: "owned"string
Hub category classificationExample:
"warehouse_ambient"string
Physical address of the hub. If provided, country is automatically geocoded.Example:
"Calle Industrial 5, Madrid, Spain"boolean
default:"false"
Whether the hub is a supercharger
uuid
Linked facility ID. Required when
type is owned.Example: "660e8400-e29b-41d4-a716-446655440000"Response
Returns the created logistic hub object with HTTP 201.string
Logistic hub UUID
string
Hub name
string
Hub type:
owned or subcontractedstring | null
Hub category classification (e.g.
warehouse_ambient, warehouse_mixed)string | null
Physical address
string | null
ISO country code (geocoded from address if provided)
string
Hub status:
active or archivedboolean
Whether the hub is a supercharger
string | null
UUID of the linked facility (only for
owned hubs)number | null
CO2e emissions from the linked facility (tCO2e)
datetime
Creation timestamp (ISO 8601)
string | null
Last update timestamp (ISO 8601)
Example
curl -X POST "https://api.dcycle.io/v1/logistic-hubs" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d '{
"name": "Madrid Warehouse",
"type": "subcontracted",
"category": "warehouse_ambient",
"supercharger": false
}'
import requests
import os
headers = {
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
"Content-Type": "application/json"
}
payload = {
"name": "Madrid Warehouse",
"type": "subcontracted",
"category": "warehouse_ambient",
"supercharger": False
}
response = requests.post(
"https://api.dcycle.io/v1/logistic-hubs",
headers=headers,
json=payload
)
hub = response.json()
print(f"Hub created: {hub['id']}")
const axios = require('axios');
const headers = {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID,
'Content-Type': 'application/json'
};
axios.post('https://api.dcycle.io/v1/logistic-hubs', {
name: "Madrid Warehouse",
type: "subcontracted",
category: "warehouse_ambient",
supercharger: false
}, { headers })
.then(response => console.log(`Created: ${response.data.id}`));
Successful Response
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Madrid Warehouse",
"type": "subcontracted",
"category": "warehouse_ambient",
"address": null,
"country": null,
"status": "active",
"supercharger": false,
"facility_id": null,
"co2e": null,
"created_at": "2024-11-24T10:30:00Z",
"updated_at": "2024-11-24T10:30:00Z"
}
Common Errors
409 Conflict
Cause: A hub with the same name already exists in the organization{
"detail": "This logistic hub name already exists"
}
422 Validation Error
Cause:facility_id not provided for owned hub
{
"detail": "facility_id is required for owned logistic hubs"
}
Related Endpoints
List Logistic Hubs
Retrieve all logistic hubs
Update Logistic Hub
Modify logistic hub details
Was this page helpful?