Version History
const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};
fetch('https://api.dcycle.io/v1/business-travels/{business_travel_id}/versions', 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}/versions"
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>"
}
response = requests.get(url, headers=headers)
print(response.text)curl --request GET \
--url https://api.dcycle.io/v1/business-travels/{business_travel_id}/versions \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'{
"items": {
"items[].transaction_id": 123,
"items[].operation_type": "<string>",
"items[].issued_at": {},
"items[].user_id": {},
"items[].user_first_name": {},
"items[].user_last_name": {},
"items[].changes": {
"field": "<string>",
"old_value": "<any>",
"new_value": "<any>"
}
},
"total": 123,
"page": 123,
"size": 123
}Version History
Get the change history of a business travel record
GET
/
v1
/
business-travels
/
{business_travel_id}
/
versions
Version History
const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};
fetch('https://api.dcycle.io/v1/business-travels/{business_travel_id}/versions', 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}/versions"
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>"
}
response = requests.get(url, headers=headers)
print(response.text)curl --request GET \
--url https://api.dcycle.io/v1/business-travels/{business_travel_id}/versions \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'{
"items": {
"items[].transaction_id": 123,
"items[].operation_type": "<string>",
"items[].issued_at": {},
"items[].user_id": {},
"items[].user_first_name": {},
"items[].user_last_name": {},
"items[].changes": {
"field": "<string>",
"old_value": "<any>",
"new_value": "<any>"
}
},
"total": 123,
"page": 123,
"size": 123
}← Business Travels API
Returns a paginated list of all changes made to a business travel record, including what changed, when, and by whom. Useful for auditing data modifications.
Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faPath Parameters
string
required
UUID of the business travelExample:
550e8400-e29b-41d4-a716-446655440000Query Parameters
integer
default:"1"
Page number (1-based)
integer
default:"50"
Page size (max 100)
Response
array[object]
Version entries with change details
Show version object fields
Show version object fields
integer
Internal transaction identifier
string
The type of operation:
CREATE, UPDATE, or DELETEdatetime | null
When the change was made (ISO 8601)
string | null
UUID of the user who made the change
string | null
First name of the user who made the change
string | null
Last name of the user who made the change
integer
Total number of versions
integer
Current page number
integer
Page size
Example
curl -X GET "https://api.dcycle.io/v1/business-travels/${BUSINESS_TRAVEL_ID}/versions" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}"
import requests
import os
headers = {
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
}
bt_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
response = requests.get(
f"https://api.dcycle.io/v1/business-travels/{bt_id}/versions",
headers=headers,
)
data = response.json()
print(f"{data['total']} versions (page {data['page']}/{data['pages']})")
for v in data["items"]:
user = f"{v['user_first_name']} {v['user_last_name']}" if v.get("user_first_name") else "System"
print(f" [{v['operation_type']}] at {v['issued_at']} by {user}")
for c in v["changes"]:
print(f" {c['field']}: {c['old_value']} → {c['new_value']}")
const axios = require('axios');
const headers = {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID,
};
const btId = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890';
axios.get(`https://api.dcycle.io/v1/business-travels/${btId}/versions`, { headers })
.then(({ data }) => {
console.log(`${data.total} versions (page ${data.page}/${data.pages})`);
data.items.forEach(v => {
const user = v.user_first_name ? `${v.user_first_name} ${v.user_last_name}` : 'System';
console.log(` [${v.operation_type}] at ${v.issued_at} by ${user}`);
v.changes.forEach(c => console.log(` ${c.field}: ${c.old_value} → ${c.new_value}`));
});
});
Successful Response
{
"items": [
{
"transaction_id": 12345,
"operation_type": "UPDATE",
"issued_at": "2024-06-15T10:30:00Z",
"user_id": "d4e5f6a7-b8c9-0123-defg-456789012345",
"user_first_name": "María",
"user_last_name": "García",
"changes": [
{
"field": "distance",
"old_value": 500.0,
"new_value": 620.0
},
{
"field": "transport_type",
"old_value": "car",
"new_value": "train"
}
]
},
{
"transaction_id": 12300,
"operation_type": "CREATE",
"issued_at": "2024-06-01T09:00:00Z",
"user_id": "d4e5f6a7-b8c9-0123-defg-456789012345",
"user_first_name": "María",
"user_last_name": "García",
"changes": []
}
],
"total": 2,
"page": 1,
"size": 50
}
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=UUID('...') not found", "code": "BUSINESS_TRAVEL_NOT_FOUND"}
Related Endpoints
Get Business Travel
View current business travel details
Update
Modify a business travel
Was this page helpful?