> ## Documentation Index
> Fetch the complete documentation index at: https://code.dcycle.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Waste Version History

> Get the change history of a waste record

[← Wastes API](/api-reference/wastes/overview)

Returns a paginated list of all changes made to a waste, newest first: who made each change, when, and which fields it modified.

Tracked fields: `waste_ler_code_id`, `waste_rd_code_id`, `waste_efs_id`, `description`, `base_quantity`, `quantity`, `unit_id`, `start_date`, `end_date`, `identification_name`, `destination`, `total_km_to_waste_center`, `provider_name`, `transporter_name`, `file_url`, `file_name`, `percentage`, `facility_id`, `custom_emission_factor_id`. Fields a recalculation rewrites (`status`, `co2e`) are not tracked, so a recalculation never reads as a user edit.

A parent organization can read the history of a waste in one of its subsidiaries' facilities.

## Request

### Headers

**x-api-key** `string` *required*

Your API key for authentication

**Example:** `sk_live_1234567890abcdef`

**x-organization-id** `string` *required*

Your organization UUID

**Example:** `a8315ef3-dd50-43f8-b7ce-d839e68d51fa`

### Path Parameters

**waste\_id** `string` *required*

UUID of the waste

**Example:** `550e8400-e29b-41d4-a716-446655440000`

### Query Parameters

**page** `integer` (default: 1)

Page number (1-based)

**size** `integer` (default: 50)

Number of version entries per page

**transaction\_id** `integer`

Return only the change made by this transaction, with its diff, instead of the newest ones

**Example:** `48291`

## Response

**items** `array[object]`

Version entries with change details

**version object fields**

**items\[].transaction\_id** `integer`

Internal transaction identifier. Versions are returned newest-first (descending `transaction_id`).

**items\[].operation\_type** `string`

The type of operation: `CREATE`, `UPDATE`, or `DELETE`

**items\[].issued\_at** `datetime | null`

When the change was made (ISO 8601)

**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[object]`

Field-level changes in this version

**change object fields**

**changes\[].field** `string`

Name of the field that changed

**changes\[].old\_value** `any | null`

Value before the change. `null` for `CREATE` operations.

**changes\[].new\_value** `any | null`

Value after the change. `null` for `DELETE` operations.

**total** `integer`

Total number of version entries

**page** `integer`

Current page number

**size** `integer`

Items per page

> [!NOTE]
>
> For `CREATE` operations, `old_value` is always `null` and `new_value` holds the initial value of each tracked field. For `UPDATE` operations, only the fields that changed are included in `changes`.

## Example

```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X GET "https://api.dcycle.io/v1/wastes/550e8400-e29b-41d4-a716-446655440000/versions?page=1&size=50" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}"
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import os

import requests

waste_id = "550e8400-e29b-41d4-a716-446655440000"

response = requests.get(
    f"https://api.dcycle.io/v1/wastes/{waste_id}/versions",
    headers={
        "x-api-key": os.getenv("DCYCLE_API_KEY"),
        "x-organization-id": os.getenv("DCYCLE_ORG_ID"),
    },
    params={"page": 1, "size": 50},
)

for version in response.json()["items"]:
    print(f"[{version['operation_type']}] {version['issued_at']}")
    for change in version["changes"]:
        print(f"  {change['field']}: {change['old_value']} → {change['new_value']}")
```

```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
const axios = require('axios');

const wasteId = '550e8400-e29b-41d4-a716-446655440000';

axios.get(`https://api.dcycle.io/v1/wastes/${wasteId}/versions`, {
  headers: {
    'x-api-key': process.env.DCYCLE_API_KEY,
    'x-organization-id': process.env.DCYCLE_ORG_ID,
  },
  params: { page: 1, size: 50 },
})
.then(({ data }) => {
  data.items.forEach(version => {
    console.log(`[${version.operation_type}] ${version.issued_at}`);
    version.changes.forEach(c => console.log(`  ${c.field}: ${c.old_value} → ${c.new_value}`));
  });
})
.catch(error => console.error(error));
```

### Successful Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "items": [
    {
      "transaction_id": 48291,
      "operation_type": "UPDATE",
      "issued_at": "2026-10-20T11:45:00Z",
      "user_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
      "user_first_name": "Maria",
      "user_last_name": "Garcia",
      "changes": [
        {
          "field": "base_quantity",
          "old_value": 10.0,
          "new_value": 25.0
        },
        {
          "field": "quantity",
          "old_value": 10.0,
          "new_value": 25.0
        }
      ]
    },
    {
      "transaction_id": 47103,
      "operation_type": "CREATE",
      "issued_at": "2026-10-10T09:00:00Z",
      "user_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
      "user_first_name": "Maria",
      "user_last_name": "Garcia",
      "changes": [
        {
          "field": "description",
          "old_value": null,
          "new_value": "Cardboard"
        },
        {
          "field": "quantity",
          "old_value": null,
          "new_value": 10.0
        }
      ]
    }
  ],
  "total": 2,
  "page": 1,
  "size": 50
}
```

## Common Errors

### 401 Unauthorized

**Cause:** Missing or invalid API key / JWT token

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}
```

### 403 Forbidden

**Cause:** The authenticated user is not a member of the organization

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}
```

### 404 Not Found

**Cause:** The waste does not exist or belongs to an organization outside yours and its subsidiaries

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "Waste with id='550e8400-e29b-41d4-a716-446655440000' not found", "code": "NOT_FOUND"}
```

## Related Endpoints

> **[Get Waste](/api-reference/wastes/get)**
>
> View the current state of a waste

> **[Update Waste](/api-reference/wastes/update)**
>
> Modify a waste


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.