Delete Business Travel
const options = {
method: 'DELETE',
headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};
fetch('https://api.dcycle.io/v1/business-travels/{business_travel_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/business-travels/{business_travel_id}"
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>"
}
response = requests.delete(url, headers=headers)
print(response.text)curl --request DELETE \
--url https://api.dcycle.io/v1/business-travels/{business_travel_id} \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'Delete Business Travel
Delete a business travel record from your organization
DELETE
/
v1
/
business-travels
/
{business_travel_id}
Delete Business Travel
const options = {
method: 'DELETE',
headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};
fetch('https://api.dcycle.io/v1/business-travels/{business_travel_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/business-travels/{business_travel_id}"
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>"
}
response = requests.delete(url, headers=headers)
print(response.text)curl --request DELETE \
--url https://api.dcycle.io/v1/business-travels/{business_travel_id} \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'Delete Business Travel
Permanently delete a business travel record from your organization. This action cannot be undone.Permanent Action: Deleting a business travel record is permanent and cannot be undone. The associated emissions data will also be removed from your organization’s totals.
Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faPath Parameters
string
required
The unique identifier (UUID) of the business travel record to deleteExample:
550e8400-e29b-41d4-a716-446655440000Response
Returns204 No Content on successful deletion. No response body.
Example
curl -X DELETE "https://api.dcycle.io/v1/business-travels/550e8400-e29b-41d4-a716-446655440000" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}"
import requests
import os
travel_id = "550e8400-e29b-41d4-a716-446655440000"
response = requests.delete(
f"https://api.dcycle.io/v1/business-travels/{travel_id}",
headers={
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
},
)
if response.status_code == 204:
print("Business travel deleted successfully")
else:
print(f"Error: {response.json()}")
const axios = require('axios');
const travelId = '550e8400-e29b-41d4-a716-446655440000';
axios.delete(
`https://api.dcycle.io/v1/business-travels/${travelId}`,
{
headers: {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID,
},
}
)
.then(response => {
if (response.status === 204) {
console.log('Business travel deleted successfully');
}
})
.catch(error => console.error(error));
Successful Response
HTTP/1.1 204 No Content
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"}
404 Not Found
Cause: Business travel not found or doesn’t belong to your organization{"detail": "BusinessTravel with id=550e8400-e29b-41d4-a716-446655440000 not found", "code": "BUSINESS_TRAVEL_NOT_FOUND"}
Use Cases
Delete with Confirmation
Fetch the record first to confirm before deleting:def delete_business_travel(travel_id, confirm=False):
travel = requests.get(
f"https://api.dcycle.io/v1/business-travels/{travel_id}",
headers=headers,
).json()
if not confirm:
print(f"About to delete:")
print(f" Date: {travel['start_date']} to {travel['end_date']}")
print(f" Route: {travel.get('origin', 'N/A')} -> {travel.get('destination', 'N/A')}")
print(f" Emissions: {travel['co2e']} kg CO2e")
return False
response = requests.delete(
f"https://api.dcycle.io/v1/business-travels/{travel_id}",
headers=headers,
)
return response.status_code == 204
For deleting multiple records at once, use the Bulk Delete or Bulk Delete by Filters endpoints instead of looping over individual deletes.
Related Endpoints
Get Business Travel
Get business travel details before deleting
List Business Travels
Retrieve all business travels
Bulk Delete
Delete multiple records by ID
Create Business Travel
Create a new business travel record
Was this page helpful?