Skip to main content
POST
/
v1
/
logistics
/
recharges
/
bulk-delete-by-filters
Bulk Delete Recharges 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/recharges/bulk-delete-by-filters', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "deleted": [
    "<string>"
  ],
  "failed": [
    {}
  ]
}

Bulk Delete Recharges by Filters

Delete all logistics fuel recharges matching the given filter criteria. Uses filter_hash for optimistic concurrency.

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 by vehicle license plate
vehicle_type[]
string[]
Filter by vehicle type(s)
fuel_id[]
string[]
Filter by fuel UUID(s)
vehicle_license_plate[]
string[]
Filter by vehicle license plate(s)
file_id[]
string[]
Filter by file UUID(s)
date_from
string
Filter by recharge date on or after (YYYY-MM-DD)
date_until
string
Filter by recharge date on or before (YYYY-MM-DD)
status
string
Filter by recharge status
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

RESPONSE=$(curl -s "https://api.dcycle.io/v1/logistics/recharges?status=error" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}")

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

curl -X POST "https://api.dcycle.io/v1/logistics/recharges/bulk-delete-by-filters?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}\"}"

Successful Response

{
  "deleted": [
    "660e8400-e29b-41d4-a716-446655440000",
    "770e8400-e29b-41d4-a716-446655440000"
  ],
  "failed": []
}
deleted
string[]
UUIDs of deleted recharges.
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." }

Batch Delete Recharges

Delete specific recharges by ID

List Recharges

Browse logistics recharges