Skip to main content
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));
{
  "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

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

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

Path Parameters

business_travel_id
string
required
UUID of the business travelExample: 550e8400-e29b-41d4-a716-446655440000

Query Parameters

page
integer
default:"1"
Page number (1-based)
size
integer
default:"50"
Page size (max 100)

Response

items
array[object]
Version entries with change details
total
integer
Total number of versions
page
integer
Current page number
size
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}"

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"}

Get Business Travel

View current business travel details

Update

Modify a business travel