Skip to main content
GET
/
v1
/
vehicles
/
{vehicle_id}
/
versions
Vehicle Versions
const options = {
  method: 'GET',
  headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};

fetch('https://api.dcycle.io/v1/vehicles/{vehicle_id}/versions', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "items": {},
  "items[].transaction_id": 123,
  "items[].end_transaction_id": {},
  "items[].operation_type": 123,
  "items[].issued_at": "<string>",
  "items[].user_name": {},
  "items[].changeset": {},
  "total": 123,
  "page": 123
}

Vehicle Versions

Retrieve a paginated audit trail of all changes made to a vehicle over time, including who made each change, when, and which fields were modified.

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

vehicle_id
string
required
UUID of the vehicle

Query Parameters

page
integer
default:"1"
Page number
size
integer
default:"50"
Items per page (max 100)

Response

items
array[object]
List of version records
items[].transaction_id
integer
Unique transaction identifier
items[].end_transaction_id
integer | null
End transaction ID (null for current version)
items[].operation_type
integer
Operation: 0 = create, 1 = update, 2 = delete
items[].issued_at
string
ISO 8601 timestamp of the change
items[].user_name
string | null
Name of the user who made the change
items[].changeset
object
Map of changed fields with [old_value, new_value] pairs
total
integer
Total number of versions
page
integer
Current page number

Example

curl "https://api.dcycle.io/v1/vehicles/${VEHICLE_ID}/versions?page=1&size=10" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}"

Successful Response

{
  "items": [
    {
      "transaction_id": 98765,
      "end_transaction_id": null,
      "operation_type": 1,
      "issued_at": "2025-03-10T14:30:00Z",
      "user_name": "Ana Garcia",
      "changeset": {
        "name": ["Fleet Van #12", "Company Van #12"],
        "status": ["error", "active"]
      }
    },
    {
      "transaction_id": 87654,
      "end_transaction_id": 98765,
      "operation_type": 0,
      "issued_at": "2024-06-15T10:30:00Z",
      "user_name": "Carlos Lopez",
      "changeset": {}
    }
  ],
  "total": 2,
  "page": 1,
  "size": 10
}

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: The vehicle does not exist or belongs to another organization
{"detail": "Not Found"}

Get Vehicle

View current vehicle details

Update Vehicle

Modify vehicle details