Skip to main content
GET
/
v1
/
transports
/
{transport_route_id}
/
versions
Get Transport Route Version History
const options = {method: 'GET', headers: {'x-organization-id': '<x-organization-id>'}};

fetch('https://api.dcycle.io/v1/transports/{transport_route_id}/versions', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "items": [
    {}
  ],
  "total": 123,
  "page": 123,
  "size": 123,
  "items[].transaction_id": 123,
  "items[].operation_type": "<string>",
  "items[].issued_at": {},
  "items[].user_id": {},
  "items[].user_first_name": {},
  "items[].user_last_name": {},
  "items[].changes": [
    {
      "changes[].field": "<string>",
      "changes[].old_value": {},
      "changes[].new_value": {}
    }
  ]
}

Get Transport Route Version History

Returns a paginated list of every change ever made to a transport route — who made it, when, and which fields were affected. Each entry covers one database transaction and includes a changes array that shows the before/after value for each tracked field. Tracked fields: name, quantity, unit_id, start_date, transport_direction.

Request

Authentication

Supports both authentication methods:
x-api-key
string
Your API key (use this or Authorization)Example: sk_live_1234567890abcdef
Authorization
string
Bearer JWT token (use this or x-api-key)Example: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...

Headers

x-organization-id
string
required
Your organization UUIDExample: a8315ef3-dd50-43f8-b7ce-d839e68d51fa

Path Parameters

transport_route_id
string
required
The unique identifier (UUID) of the transport routeExample: 010ed3b6-b513-40f3-b9fe-0f0a338d9274

Query Parameters

page
integer
default:"1"
Page number (1-based)
size
integer
default:"50"
Number of version entries per page

Response

items
array
List of version entries for the requested page. See Version Entry Fields below.
total
integer
Total number of version entries across all pages
page
integer
Current page number
size
integer
Number of items per page

Version Entry Fields

items[].transaction_id
integer
Internal database transaction ID. Versions are returned newest-first (descending transaction_id).
items[].operation_type
string
Type of change: CREATE, UPDATE, or DELETE
items[].issued_at
datetime | null
ISO 8601 timestamp of when the change was committed. null for very old records pre-dating audit logging.
items[].user_id
string | null
ID of the user who made the change. null for system-triggered changes.
items[].user_first_name
string | null
First name of the user who made the change
items[].user_last_name
string | null
Last name of the user who made the change
items[].changes
array
Field-level diff for this version entry.
For CREATE operations, old_value is always null and new_value contains the initial value of each tracked field. For UPDATE operations, only fields that actually changed are included in changes. For DELETE operations, changes is an empty array.

Example

curl -X GET "https://api.dcycle.io/v1/transports/010ed3b6-b513-40f3-b9fe-0f0a338d9274/versions?page=1&size=50" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}"

Successful Response

{
  "items": [
    {
      "transaction_id": 48291,
      "operation_type": "UPDATE",
      "issued_at": "2024-06-20T11:45:00Z",
      "user_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
      "user_first_name": "Maria",
      "user_last_name": "Garcia",
      "changes": [
        {
          "field": "quantity",
          "old_value": "1000",
          "new_value": "1500"
        },
        {
          "field": "transport_direction",
          "old_value": "upstream",
          "new_value": "downstream"
        }
      ]
    },
    {
      "transaction_id": 47103,
      "operation_type": "CREATE",
      "issued_at": "2024-06-10T09:00:00Z",
      "user_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
      "user_first_name": "Maria",
      "user_last_name": "Garcia",
      "changes": [
        {
          "field": "name",
          "old_value": null,
          "new_value": "Madrid to Syria Shipment"
        },
        {
          "field": "quantity",
          "old_value": null,
          "new_value": "1000"
        },
        {
          "field": "transport_direction",
          "old_value": null,
          "new_value": "upstream"
        }
      ]
    }
  ],
  "total": 2,
  "page": 1,
  "size": 50
}

Common Errors

401 Unauthorized

Cause: Missing or invalid API key / JWT token
{"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: Route ID does not exist or belongs to a different organization
{"detail": "TransportRoute not found", "code": "TRANSPORT_ROUTE_NOT_FOUND"}

Get Transport Route

Retrieve the current state of a transport route

Update Transport Route

Modify a transport route and its sections

List Transport Routes

Retrieve all transport routes with filtering and pagination

Transport Overview

Full data model and distance calculation reference