Skip to main content
GET
/
v1
/
facilities
/
{facility_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/facilities/{facility_id}/versions', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "items": {},
  "total": 123,
  "page": 123,
  "size": 123
}

Version History

Returns a paginated list of all changes made to a facility over time, including who made the 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

facility_id
string
required
UUID of the facility

Query Parameters

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

Response

items
array[object]
Version entries:
FieldTypeDescription
indexintegerVersion number (0 = creation)
changesetobjectMap of field names to [old_value, new_value] pairs
user_idstring | nullUUID of the user who made the change
created_atstringISO 8601 timestamp
total
integer
Total number of versions
page
integer
Current page number
size
integer
Page size

Example

curl -X GET "https://api.dcycle.io/v1/facilities/${FACILITY_ID}/versions" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}"

Successful Response

{
  "items": [
    {
      "index": 0,
      "changeset": {},
      "user_id": "user-uuid-here",
      "created_at": "2025-01-15T10:30:00Z"
    },
    {
      "index": 1,
      "changeset": {
        "name": ["Main Office", "Madrid HQ"],
        "address": ["Calle Gran Via 1", "Calle Gran Via 1, 28013 Madrid"]
      },
      "user_id": "user-uuid-here",
      "created_at": "2025-02-20T14:15:00Z"
    }
  ],
  "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: The facility does not exist or belongs to another organization
{"detail": "Facility not found"}

Get Facility

View current facility details

Update Facility

Modify a facility record