Bulk Delete Hotel Stays 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/hotel-stays/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/hotel-stays/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/hotel-stays/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 Hotel Stays by Filters
Delete every hotel stay matching the current list filters, instead of an explicit id list
POST
/
v1
/
hotel-stays
/
bulk-delete-by-filters
Bulk Delete Hotel Stays 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/hotel-stays/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/hotel-stays/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/hotel-stays/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>"
}← Hotel Stays API
Deletes every hotel stay matching the given filters — the same filters
GET /v1/hotel-stays accepts — and their associated total_impacts rows, in a single request. Powers “select all matching” in the UI: the client never has to page through the whole result set to collect ids first.
The request must echo the filter_hash from the list response that showed those filters, to confirm the delete targets exactly what the caller saw. No filters at all is a valid request: it deletes every hotel stay in scope.
Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faQuery Parameters
Same filters asGET /v1/hotel-stays: status[], start_date, end_date, name, file_id[], created_at_from, created_at_to. Pass the exact same query string you listed with.
Body
string
required
The
filter_hash from the matching list response. A mismatch (filters changed since the list was
loaded) returns 409 Conflict and deletes nothing.Example: d4f9a2b81c3e0f77Response
integer
Number of hotel stays successfully deleted
array[string]
UUIDs of hotel stays that were successfully deleted
integer
Number of hotel stays that could not be deleted
array[string]
UUIDs that could not be deleted (outside the authorized organization scope)
string
Human-readable summary, e.g.
"Successfully deleted 12 hotel stay(s)"Example
curl -X POST "https://api.dcycle.io/v1/hotel-stays/bulk-delete-by-filters?status[]=active" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d '{"filter_hash": "d4f9a2b81c3e0f77"}'
import requests
import os
headers = {
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
}
# 1. List with the filters you want to delete, and keep the filter_hash
listed = requests.get(
"https://api.dcycle.io/v1/hotel-stays",
headers=headers,
params={"status[]": ["active"]},
).json()
# 2. Echo the same filters + filter_hash to delete everything that matched
response = requests.post(
"https://api.dcycle.io/v1/hotel-stays/bulk-delete-by-filters",
headers=headers,
params={"status[]": ["active"]},
json={"filter_hash": listed["filter_hash"]},
)
result = response.json()
print(f"Deleted {result['success_count']}, failed {result['failed_count']}")
const axios = require('axios');
const headers = {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID
};
const params = { 'status[]': ['active'] };
const { data: listed } = await axios.get('https://api.dcycle.io/v1/hotel-stays', { headers, params });
const { data: result } = await axios.post(
'https://api.dcycle.io/v1/hotel-stays/bulk-delete-by-filters',
{ filter_hash: listed.filter_hash },
{ headers, params }
);
console.log(`Deleted ${result.success_count}, failed ${result.failed_count}`);
Successful Response
{
"success_count": 12,
"success_ids": ["550e8400-e29b-41d4-a716-446655440000"],
"failed_count": 0,
"failed_ids": [],
"message": "Successfully deleted 12 hotel stay(s)"
}
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 doesn’t match the current filters — they changed since the list was loaded
{"detail": "Filter hash mismatch. The filters have changed since the list was loaded. Please refresh and try again."}
422 Unprocessable Entity
Cause: Missingfilter_hash in the body
{
"detail": [
{
"loc": ["body", "filter_hash"],
"msg": "field required",
"type": "value_error.missing"
}
]
}
Related Endpoints
List Hotel Stays
Browse all hotel stays and get a filter_hash
Bulk Delete by IDs
Delete an explicit list of hotel stay ids
Was this page helpful?