Bulk Delete by Filters
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': '<content-type>'
},
body: JSON.stringify({filter_hash: '<string>'})
};
fetch('https://api.dcycle.io/v1/business-travels/bulk-delete-by-filters', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/business-travels/bulk-delete-by-filters"
payload = { "filter_hash": "<string>" }
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.dcycle.io/v1/business-travels/bulk-delete-by-filters \
--header 'Content-Type: <content-type>' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"filter_hash": "<string>"
}
'{
"success_count": 123,
"success_ids": {},
"failed_count": 123,
"failed_ids": {},
"message": "<string>"
}Bulk Delete by Filters
Delete all business travels matching the given filters
POST
/
v1
/
business-travels
/
bulk-delete-by-filters
Bulk Delete by Filters
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': '<content-type>'
},
body: JSON.stringify({filter_hash: '<string>'})
};
fetch('https://api.dcycle.io/v1/business-travels/bulk-delete-by-filters', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/business-travels/bulk-delete-by-filters"
payload = { "filter_hash": "<string>" }
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.dcycle.io/v1/business-travels/bulk-delete-by-filters \
--header 'Content-Type: <content-type>' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"filter_hash": "<string>"
}
'{
"success_count": 123,
"success_ids": {},
"failed_count": 123,
"failed_ids": {},
"message": "<string>"
}← Business Travels API
Deletes all business travels matching the provided filter parameters. No filter is required: without one it deletes every business travel the unfiltered list shows (the header organization, or under group view the accepted family narrowed by
organization_id[]). A filter_hash from the list endpoint must be provided to confirm the filters haven’t changed since the user reviewed them.
Permanent Action: Deleted records and their associated emissions cannot be recovered.
Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51fastring
required
Must be
application/jsonQuery Parameters
Same filter parameters as the list endpoint:array[string]
Filter by transport typeAvailable values:
car, metro, train, trolleybus, bus, motorbike, aircraft, ferryarray[string]
Filter by statusAvailable values:
active, pending, loading, completed, errordate
Filter by minimum travel date (inclusive)Format:
YYYY-MM-DDdate
Filter by maximum travel date (inclusive)Format:
YYYY-MM-DDstring
Search by name (case-insensitive substring match)
array[string]
Filter by exact name values (multi-select, OR logic)
array[uuid]
Filter by source file UUID
datetime
Filter records created on or after this timestampFormat:
YYYY-MM-DDTHH:MM:SSZdatetime
Filter records created on or before this timestampFormat:
YYYY-MM-DDTHH:MM:SSZstring
Filter by CO2e calculation statusAvailable values:
calculated, not_calculatedBody Parameters
string
required
Hash returned by the list endpoint for the current filter combination. Prevents deleting records from a stale filter state.
Response
integer
Number of items successfully deleted
array[string]
UUIDs of business travels that were successfully deleted
integer
Number of items that failed to delete
array[string]
UUIDs that could not be deleted (not found or deletion error)
string
Human-readable summary message
Example
# Step 1: List with filters to get the filter_hash
FILTER_HASH=$(curl -s -X GET "https://api.dcycle.io/v1/business-travels?transport_type[]=aircraft&start_date=2024-01-01&end_date=2024-12-31" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" | jq -r '.filter_hash')
# Step 2: Delete all matching records
curl -X POST "https://api.dcycle.io/v1/business-travels/bulk-delete-by-filters?transport_type[]=aircraft&start_date=2024-01-01&end_date=2024-12-31" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d "{\"filter_hash\": \"${FILTER_HASH}\"}"
import requests
import os
headers = {
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
}
filters = {
"transport_type[]": ["aircraft"],
"start_date": "2024-01-01",
"end_date": "2024-12-31",
}
# Step 1: Get the filter_hash
list_response = requests.get(
"https://api.dcycle.io/v1/business-travels",
headers=headers,
params=filters,
)
filter_hash = list_response.json()["filter_hash"]
# Step 2: Delete all matching records
response = requests.post(
"https://api.dcycle.io/v1/business-travels/bulk-delete-by-filters",
headers=headers,
params=filters,
json={"filter_hash": filter_hash},
)
result = response.json()
print(f"Deleted: {result['success_count']}, Failed: {result['failed_count']}")
print(result["message"])
const axios = require('axios');
const headers = {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID,
};
const filters = {
'transport_type[]': ['aircraft'],
start_date: '2024-01-01',
end_date: '2024-12-31',
};
// Step 1: Get filter_hash
const { data: listData } = await axios.get(
'https://api.dcycle.io/v1/business-travels',
{ headers, params: filters }
);
// Step 2: Delete matching records
const { data: result } = await axios.post(
'https://api.dcycle.io/v1/business-travels/bulk-delete-by-filters',
{ filter_hash: listData.filter_hash },
{ headers: { ...headers, 'Content-Type': 'application/json' }, params: filters }
);
console.log(`Deleted: ${result.success_count}, Failed: ${result.failed_count}`);
console.log(result.message);
Successful Response
{
"success_count": 42,
"success_ids": [
"550e8400-e29b-41d4-a716-446655440000",
"550e8400-e29b-41d4-a716-446655440001"
],
"failed_count": 0,
"failed_ids": [],
"message": "Bulk delete completed: 42 deleted, 0 failed"
}
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"}
409 Conflict
Cause: Filters changed since the list was loaded{
"detail": "Filter hash mismatch. The filters have changed since the list was loaded. Please refresh and try again."
}
Related Endpoints
Bulk Delete
Delete specific records by ID
List
Browse and filter business travels
Delete
Delete a single business travel
Was this page helpful?