Create Logistics Recharges (Bulk)
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({records: [{}], options: {}})
};
fetch('https://api.dcycle.io/v1/logistics/recharges/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/logistics/recharges/bulk"
payload = {
"records": [{}],
"options": {}
}
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/logistics/recharges/bulk \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"records": [
{}
],
"options": {}
}
'{
"created": 123,
"updated": 123,
"errors": [
{
"index": 123,
"message": "<string>"
}
]
}Create Logistics Recharges (Bulk)
Create multiple logistics recharges (fuel consumption records) in a single request
POST
/
v1
/
logistics
/
recharges
/
bulk
Create Logistics Recharges (Bulk)
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({records: [{}], options: {}})
};
fetch('https://api.dcycle.io/v1/logistics/recharges/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/logistics/recharges/bulk"
payload = {
"records": [{}],
"options": {}
}
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/logistics/recharges/bulk \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"records": [
{}
],
"options": {}
}
'{
"created": 123,
"updated": 123,
"errors": [
{
"index": 123,
"message": "<string>"
}
]
}← Logistics API
Create multiple fuel consumption records in a single API call. Optimized for batch processing of up to 5,000 records per request.
Requests over the cap get HTTP
Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faBody Parameters
array
required
Array of recharge records to create (1 to 5,000). Each record uses the same format as the single POST /recharges endpoint.Each record contains:
fuel_id(string, required): UUID of the fuel typecountry(string, required): ISO 3166-1 alpha-2 country codedate(string, required): Date in YYYY-MM-DD formatquantity(number): Amount of fuel consumedvehicle_license_plate(string): Vehicle license platetoc_id(string): UUID of the vehicle typeproject_id(string): UUID of a project to associate with
object
Processing options for the bulk operation.
continue_on_error(boolean, default:true): Iftrue, continues processing remaining records even if some fail. Iffalse, stops at the first error.
Response
Returns a summary of the bulk operation with HTTP 201.integer
Number of successfully created recharges
integer
Number of recharges that matched an existing record and were updated (upsert)
array
Example
curl -X POST "https://api.dcycle.io/v1/logistics/recharges/bulk" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d '{
"records": [
{
"fuel_id": "550e8400-e29b-41d4-a716-446655440000",
"country": "ES",
"date": "2025-06-15",
"quantity": 50.0,
"vehicle_license_plate": "1234-ABC"
},
{
"fuel_id": "550e8400-e29b-41d4-a716-446655440000",
"country": "ES",
"date": "2025-06-16",
"quantity": 60.0,
"vehicle_license_plate": "5678-XYZ"
}
],
"options": { "continue_on_error": true }
}'
import requests
import os
api_key = os.getenv("DCYCLE_API_KEY")
org_id = os.getenv("DCYCLE_ORG_ID")
headers = {
"x-api-key": api_key,
"x-organization-id": org_id,
"Content-Type": "application/json"
}
response = requests.post(
"https://api.dcycle.io/v1/logistics/recharges/bulk",
headers=headers,
json={
"records": [
{
"fuel_id": "550e8400-e29b-41d4-a716-446655440000",
"country": "ES",
"date": "2025-06-15",
"quantity": 50.0,
"vehicle_license_plate": "1234-ABC"
},
{
"fuel_id": "550e8400-e29b-41d4-a716-446655440000",
"country": "ES",
"date": "2025-06-16",
"quantity": 60.0,
"vehicle_license_plate": "5678-XYZ"
}
],
"options": {"continue_on_error": True}
}
)
result = response.json()
print(f"Success: {result['success']}, Failed: {result['failed']}")
for item in result['results']:
print(f" Record {item['index']}: {item['id']}")
for error in result['errors']:
print(f" Error at {error['index']}: {error['error']}")
const axios = require('axios');
const apiKey = process.env.DCYCLE_API_KEY;
const orgId = process.env.DCYCLE_ORG_ID;
const headers = {
'x-api-key': apiKey,
'x-organization-id': orgId,
'Content-Type': 'application/json'
};
axios.post(
'https://api.dcycle.io/v1/logistics/recharges/bulk',
{
records: [
{
fuel_id: '550e8400-e29b-41d4-a716-446655440000',
country: 'ES',
date: '2025-06-15',
quantity: 50.0,
vehicle_license_plate: '1234-ABC'
},
{
fuel_id: '550e8400-e29b-41d4-a716-446655440000',
country: 'ES',
date: '2025-06-16',
quantity: 60.0,
vehicle_license_plate: '5678-XYZ'
}
],
options: { continue_on_error: true }
},
{ headers }
)
.then(response => {
const { success, failed } = response.data;
console.log(`Success: ${success}, Failed: ${failed}`);
})
.catch(error => console.error(error));
Successful Response
{
"total_received": 3,
"total_processed": 3,
"success": 2,
"failed": 1,
"results": [
{ "index": 0, "id": "660e8400-e29b-41d4-a716-446655440000" },
{ "index": 2, "id": "770e8400-e29b-41d4-a716-446655440000" }
],
"errors": [
{ "index": 1, "error": "Fuel with id '...' not found or inactive" }
]
}
| Field | Type | Description |
|---|---|---|
total_received | integer | Number of records in the request |
total_processed | integer | Records processed (success + failed) |
success | integer | Records created/updated successfully |
failed | integer | Records that failed validation |
results | array | Successfully processed records with their IDs |
errors | array | Error details for failed records |
Upsert Behavior
Records with the same combination ofcountry, date, quantity, and vehicle_license_plate within the organization are updated instead of duplicated. This matches the deduplication behavior of CSV file uploads.
Daily Batch Upload from CSV
import pandas as pd
import requests
df = pd.read_csv("daily_recharges.csv")
records = [
{
"fuel_id": row["fuel_id"],
"country": row["country"],
"date": row["date"],
"quantity": row["quantity"],
"vehicle_license_plate": row["plate"]
}
for _, row in df.iterrows()
]
response = requests.post(
"https://api.dcycle.io/v1/logistics/recharges/bulk",
headers=headers,
json={"records": records, "options": {"continue_on_error": True}}
)
result = response.json()
print(f"Processed: {result['success']}/{result['total_received']}")
Common Errors
401 Unauthorized
Cause: Missing or invalid API key{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}
403 Forbidden
Cause: The authenticated user is not a member of the organization{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}
422 Validation Error
Cause: Empty records array or exceeding 5,000 records.{
"detail": [
{
"loc": ["body", "records"],
"msg": "ensure this value has at most 5000 items"
}
]
}
Partial Failures
Whencontinue_on_error is true (default), individual record failures are reported in the errors array while successfully processed records are included in results. Common per-record errors:
- Invalid
fuel_id: Fuel not found or inactive - Invalid
country: Not Valid Country Code, must be ISO 3166-1 alpha-2
Limits
| Limit | Value |
|---|---|
| Maximum concurrent requests | 10 per API key, per endpoint |
| Recommended concurrency | 8 (leaving headroom under the limit) |
429 with a Retry-After header. The cap is on requests in
flight at once, not on requests per second — see Rate Limits.
Related Endpoints
Create Recharge
Create a single recharge
List Recharges
Retrieve fuel consumption records
Batch Delete Recharges
Delete multiple recharges at once
Create Requests (Bulk)
Bulk create shipment requests
Was this page helpful?