Bulk Delete 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/v2/employees/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/v2/employees/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/v2/employees/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>"
}
'{
"total": 123,
"success": 123,
"failed": 123,
"errors": {}
}Bulk Delete by Filters
Delete all employees matching filter criteria
POST
/
v2
/
employees
/
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': 'application/json'
},
body: JSON.stringify({filter_hash: '<string>'})
};
fetch('https://api.dcycle.io/v2/employees/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/v2/employees/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/v2/employees/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>"
}
'{
"total": 123,
"success": 123,
"failed": 123,
"errors": {}
}← Employees API
Delete all employees that match the given filter criteria. Uses the same filters as the list endpoint. Requires a
filter_hash for optimistic concurrency — the hash must match what the server computes for the same filters, ensuring the user deletes exactly what they saw.
Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faBody Parameters
string
required
Hash from the list endpoint response (
filter_hash field). Prevents stale deletes.Query Parameters (Filters)
string
Free-text search across employee fields
string[]
Filter by transport type (car, bus, metro, train, bicycle, etc.)
string[]
Filter by employee situation
string[]
Filter by calculation status:
pending, active, errorstring[]
Filter by survey response medium
string[]
Filter by bulk-upload file UUIDs
string
Filter records created on or after this datetime (ISO 8601)
string
Filter records created on or before this datetime (ISO 8601)
string
Filter by CO2e calculation status
Response
integer
Total number of employees processed
integer
Number of employees successfully deleted
integer
Number of employees that failed to delete
array[object]
Details of failed deletions
Example
curl -X POST "https://api.dcycle.io/v2/employees/bulk-delete-by-filters?file_id[]=file-uuid-1" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d '{"filter_hash": "abc123def456"}'
import requests
import os
response = requests.post(
"https://api.dcycle.io/v2/employees/bulk-delete-by-filters",
headers={
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
"Content-Type": "application/json",
},
params={"file_id[]": "file-uuid-1"},
json={"filter_hash": "abc123def456"},
)
result = response.json()
print(f"Deleted {result['success']}/{result['total']} employees from file")
const axios = require('axios');
const { data } = await axios.post(
'https://api.dcycle.io/v2/employees/bulk-delete-by-filters',
{ filter_hash: 'abc123def456' },
{
headers: {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID,
'Content-Type': 'application/json',
},
params: { 'file_id[]': 'file-uuid-1' },
}
);
console.log(`Deleted ${data.success}/${data.total} employees from file`);
Successful Response
{
"total": 85,
"success": 85,
"failed": 0,
"errors": []
}
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: Thefilter_hash doesn’t match the current filter state — data 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 employees by specific IDs
List Employees
Retrieve all employees with filtering and pagination
Was this page helpful?