Skip to main content
POST
/
v1
/
logistics
/
requests
/
bulk-delete-by-filters
Bulk Delete Requests 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/logistics/requests/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/logistics/requests/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/logistics/requests/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>"
}
'
{
  "deleted": [
    "<string>"
  ],
  "failed": [
    {}
  ]
}

Bulk Delete Requests by Filters

Delete all logistics requests matching the given filter criteria. Uses filter_hash for optimistic concurrency — ensuring you delete exactly what the user saw in the list.

Request

Headers

x-api-key
string
required
Your API key for authenticationExample: sk_live_1234567890abcdef
x-organization-id
string
required
Your organization UUIDExample: a8315ef3-dd50-43f8-b7ce-d839e68d51fa

Query Parameters

At least one filter parameter is required.
Search across movement ID and stretch ID
clients[]
string[]
Filter by client name(s)
trip_date_from
string
Filter by trip date on or after (YYYY-MM-DD)
trip_date_until
string
Filter by trip date on or before (YYYY-MM-DD)
vehicle_type[]
string[]
Filter by vehicle type(s)
trip_status
string
Filter by trip status
uploaded_by[]
string[]
Filter by uploader user UUID(s)
file_id[]
string[]
Filter by file UUID(s)
project_id
string
Filter by project UUID

Body Parameters

filter_hash
string
required
Hash from the list endpoint response. Must match the current filter set.

Example

# Step 1: Get filter_hash from list
RESPONSE=$(curl -s "https://api.dcycle.io/v1/logistics/requests?clients[]=ACME&trip_status=error" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}")

FILTER_HASH=$(echo $RESPONSE | jq -r '.filter_hash')

# Step 2: Bulk delete with the same filters
curl -X POST "https://api.dcycle.io/v1/logistics/requests/bulk-delete-by-filters?clients[]=ACME&trip_status=error" \
  -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 = {"clients[]": "ACME", "trip_status": "error"}

# Step 1: Get filter_hash
list_resp = requests.get("https://api.dcycle.io/v1/logistics/requests", headers=headers, params=filters)
filter_hash = list_resp.json()["filter_hash"]

# Step 2: Bulk delete
delete_resp = requests.post(
    "https://api.dcycle.io/v1/logistics/requests/bulk-delete-by-filters",
    headers={**headers, "Content-Type": "application/json"},
    params=filters,
    json={"filter_hash": filter_hash},
)

print(f"Deleted: {len(delete_resp.json()['deleted'])}")
const axios = require('axios');

const headers = {
  'x-api-key': process.env.DCYCLE_API_KEY,
  'x-organization-id': process.env.DCYCLE_ORG_ID,
};

const filters = { 'clients[]': 'ACME', trip_status: 'error' };

// Step 1: Get filter_hash
const listResp = await axios.get('https://api.dcycle.io/v1/logistics/requests', { headers, params: filters });

// Step 2: Bulk delete
const deleteResp = await axios.post(
  'https://api.dcycle.io/v1/logistics/requests/bulk-delete-by-filters',
  { filter_hash: listResp.data.filter_hash },
  { headers: { ...headers, 'Content-Type': 'application/json' }, params: filters },
);

console.log(`Deleted: ${deleteResp.data.deleted.length}`);

Successful Response

{
  "deleted": [
    "f1e2d3c4-b5a6-7890-1234-567890abcdef",
    "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  ],
  "failed": []
}
deleted
string[]
UUIDs of deleted requests.
failed
object[]
Failed deletions with reason.

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: Filter hash mismatch. The filters have changed since the list was loaded. Please refresh and try again.
{ "detail": "Filter hash mismatch. The filters have changed since the list was loaded. Please refresh and try again." }

422 Unprocessable Entity

Cause: At least one filter parameter is required for bulk delete by filters.
{ "detail": "At least one filter parameter is required for bulk delete by filters." }

Batch Delete Requests

Delete specific requests by ID

List Requests

Browse logistics requests