Bulk Delete Transport Routes by Filters
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({filter_hash: '<string>'})
};
fetch('https://api.dcycle.io/v1/transports/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/transports/bulk-delete-by-filters"
payload = { "filter_hash": "<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/transports/bulk-delete-by-filters \
--header 'Content-Type: application/json' \
--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 Transport Routes by Filters
Delete all transport routes matching the same filters used in the list endpoint
POST
/
v1
/
transports
/
bulk-delete-by-filters
Bulk Delete Transport Routes by Filters
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({filter_hash: '<string>'})
};
fetch('https://api.dcycle.io/v1/transports/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/transports/bulk-delete-by-filters"
payload = { "filter_hash": "<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/transports/bulk-delete-by-filters \
--header 'Content-Type: application/json' \
--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>"
}Delete every transport route that matches a given set of filters — the same filters accepted by the
Solution: Re-fetch
GET /v1/transports list endpoint. This avoids having to collect IDs manually when you want to clear a whole date range, file upload, or status group.
A filter_hash safety token (returned by the list endpoint) must be included in the request body. This confirms you are deleting exactly the set of records you previewed, and rejects the request if the filters changed in the meantime.
This operation is irreversible. All matching transport routes, their sections, and their
total_impacts records are permanently deleted. Always call GET /v1/transports with the same filters first and review the results before proceeding.Typical Flow
- Call
GET /v1/transportswith your desired filters. - Save the
filter_hashfield from the response. - Call
POST /v1/transports/bulk-delete-by-filterswith the same query parameters and thefilter_hashin the request body.
409 Conflict.
Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faQuery Parameters
At least one non-empty query parameter is required to prevent accidental mass deletion.string
Free-text search against route name and supplier
date
Include only routes with a transport date on or after this date (YYYY-MM-DD)
date
Include only routes with a transport date on or before this date (YYYY-MM-DD)
array of string
Filter by route status. Allowed values:
pending, active, error. Repeat the parameter to include multiple statuses.string
downstream (outbound) or upstream (inbound)array of UUID
Filter to routes created by a specific file upload. Repeat the parameter for multiple files.
datetime
Include only routes created on or after this ISO 8601 datetime
datetime
Include only routes created on or before this ISO 8601 datetime
string
calculated (routes with at least one impact) or not_calculated (routes with no impacts yet)array of string
Filter by supplier name (exact match). Pass multiple values to include routes from several suppliers.
Body
string
required
The
filter_hash value returned by GET /v1/transports with the same set of filters. Acts as a safety token: if the hash does not match the current filter combination a 409 Conflict is returned.Example: "a3f1c9e2d7b84056af19c3e0b1d72a84"Response
integer
Number of transport routes successfully deleted
array
UUIDs of the transport routes that were successfully deleted
integer
Number of transport routes that could not be deleted
array
UUIDs of the transport routes that failed
string
Human-readable summary of the operation outcome
Example
# Step 1 — list and capture the filter_hash
curl -G "https://api.dcycle.io/v1/transports" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
--data-urlencode "from_date=2024-01-01" \
--data-urlencode "to_date=2024-03-31" \
--data-urlencode "status=error"
# Step 2 — delete using the same filters + the filter_hash from step 1
curl -X POST "https://api.dcycle.io/v1/transports/bulk-delete-by-filters?from_date=2024-01-01&to_date=2024-03-31&status=error" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d '{"filter_hash": "a3f1c9e2d7b84056af19c3e0b1d72a84"}'
curl -X POST "https://api.dcycle.io/v1/transports/bulk-delete-by-filters?from_date=2024-01-01&to_date=2024-03-31&status=error" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d '{"filter_hash": "a3f1c9e2d7b84056af19c3e0b1d72a84"}'
import requests
import os
base_url = "https://api.dcycle.io/v1/transports"
headers = {
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
}
filters = {
"from_date": "2024-01-01",
"to_date": "2024-03-31",
"status": "error",
}
# Step 1 — list to get the filter_hash
list_response = requests.get(base_url, headers=headers, params=filters)
filter_hash = list_response.json()["filter_hash"]
print(f"Deleting {list_response.json()['total']} routes matching filters...")
# Step 2 — delete with same filters + filter_hash
delete_response = requests.post(
f"{base_url}/bulk-delete-by-filters",
headers=headers,
params=filters,
json={"filter_hash": filter_hash},
)
result = delete_response.json()
print(result["message"])
const axios = require('axios');
const baseUrl = 'https://api.dcycle.io/v1/transports';
const headers = {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID,
};
const filters = {
from_date: '2024-01-01',
to_date: '2024-03-31',
status: 'error',
};
// Step 1 — list to get the filter_hash
axios.get(baseUrl, { headers, params: filters })
.then(({ data: listData }) => {
const filterHash = listData.filter_hash;
console.log(`Deleting ${listData.total} routes matching filters...`);
// Step 2 — delete with same filters + filter_hash
return axios.post(
`${baseUrl}/bulk-delete-by-filters`,
{ filter_hash: filterHash },
{ headers, params: filters },
);
})
.then(({ data }) => console.log(data.message))
.catch(error => console.error(error));
Successful Response
{
"success_count": 47,
"success_ids": [
"010ed3b6-b513-40f3-b9fe-0f0a338d9274",
"550e8400-e29b-41d4-a716-446655440000"
],
"failed_count": 0,
"failed_ids": [],
"message": "Successfully deleted 47 transport route(s)"
}
No matching records
{
"success_count": 0,
"success_ids": [],
"failed_count": 0,
"failed_ids": [],
"message": "No records match the given filters"
}
Common Errors
401 Unauthorized
Cause: Missing or invalid API key / JWT token{"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: Thefilter_hash does not match the current set of query parameters. This happens when the filters passed to this endpoint differ from the ones used when the list was fetched.
{
"detail": "Filter hash mismatch. The filters have changed since the list was loaded. Please refresh and try again."
}
GET /v1/transports with your intended filters, copy the new filter_hash, and retry with exactly the same query parameters.
422 Unprocessable Entity
Cause: No query parameters were provided (all filters are empty){
"detail": "At least one filter parameter is required for bulk delete by filters."
}
Related Endpoints
List Transport Routes
Retrieve all transport routes — the source of the filter_hash
Bulk Delete by IDs
Delete specific transport routes by their IDs
Delete Transport Route
Delete a single transport route by ID
Transport Overview
Full data model and distance calculation reference
Was this page helpful?