> ## 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.

# List Wastes

> Retrieve a paginated list of waste records for a facility with filtering and enriched data

# List Wastes

Retrieve a paginated list of waste disposal records for a specific facility. Each record includes enriched data: CO2e emissions, emission factor codes (LER/RD), linked projects, unit details, and the user who uploaded it.

## Request

### Headers

<ParamField header="x-api-key" type="string" required>
  Your API key for authentication

  **Example:** `sk_live_1234567890abcdef`
</ParamField>

<ParamField header="x-organization-id" type="string" required>
  Your organization UUID

  **Example:** `a8315ef3-dd50-43f8-b7ce-d839e68d51fa`
</ParamField>

### Query Parameters

<ParamField query="facility_id" type="string" required>
  UUID of the facility to retrieve waste records for

  **Example:** `660e8400-e29b-41d4-a716-446655440000`
</ParamField>

<ParamField query="status[]" type="array[string]">
  Filter by waste record status. Can be specified multiple times.

  **Available values:** `uploaded`, `active`, `loading`, `error`

  **Example:** `status[]=active&status[]=uploaded`
</ParamField>

<ParamField query="start_date" type="date">
  Filter records with a start date on or after this date (ISO 8601)

  **Example:** `2024-01-01`
</ParamField>

<ParamField query="end_date" type="date">
  Filter records with an end date on or before this date (ISO 8601)

  **Example:** `2024-12-31`
</ParamField>

<ParamField query="file_id[]" type="array[string]">
  Filter by linked file UUID. Can be specified multiple times.

  **Example:** `file_id[]=550e8400-e29b-41d4-a716-446655440000`
</ParamField>

<ParamField query="created_at_from" type="datetime">
  Filter records created on or after this timestamp (ISO 8601)

  **Example:** `2024-01-01T00:00:00Z`
</ParamField>

<ParamField query="created_at_to" type="datetime">
  Filter records created on or before this timestamp (ISO 8601)

  **Example:** `2024-12-31T23:59:59Z`
</ParamField>

<ParamField query="co2e_status" type="string">
  Filter by CO2e calculation status

  **Available values:** `calculated`, `not_calculated`

  **Example:** `co2e_status=calculated`
</ParamField>

<ParamField query="identification_name[]" type="array[string]">
  Filter by waste identification name. Can be specified multiple times.

  **Example:** `identification_name[]=RSU-2024-001`
</ParamField>

<ParamField query="ler_code[]" type="array[string]">
  Filter by LER (European Waste Catalogue) code. Can be specified multiple times.

  **Example:** `ler_code[]=15 01 01`
</ParamField>

<ParamField query="rd_code[]" type="array[string]">
  Filter by RD disposal/recovery code. Can be specified multiple times.

  **Example:** `rd_code[]=R1`
</ParamField>

<ParamField query="project_id" type="string">
  Filter by project UUID

  **Example:** `770e8400-e29b-41d4-a716-446655440000`
</ParamField>

<ParamField query="sort" type="string">
  Sort field. Prefix with `-` for descending order.

  **Example:** `-start_date` (most recent first), `identification_name`
</ParamField>

<ParamField query="page" type="integer" default="1">
  Page number for pagination

  **Example:** `1`
</ParamField>

<ParamField query="size" type="integer" default="50">
  Number of items per page (max 100)

  **Example:** `50`
</ParamField>

## Response

<ResponseField name="items" type="array[object]">
  Array of waste record objects

  <Expandable title="Waste Object">
    <ResponseField name="id" type="string">
      Unique identifier (UUID) for the waste record
    </ResponseField>

    <ResponseField name="type" type="string">
      Always `"wastes"`
    </ResponseField>

    <ResponseField name="identification_name" type="string">
      Waste identification name or invoice number
    </ResponseField>

    <ResponseField name="invoice_id" type="string">
      Alias for `identification_name`
    </ResponseField>

    <ResponseField name="description" type="string">
      Description of the waste
    </ResponseField>

    <ResponseField name="status" type="string">
      Processing status: `uploaded`, `active`, `loading`, or `error`
    </ResponseField>

    <ResponseField name="start_date" type="date">
      Start date of the waste period
    </ResponseField>

    <ResponseField name="end_date" type="date">
      End date of the waste period
    </ResponseField>

    <ResponseField name="facility_id" type="string | null">
      UUID of the facility this waste belongs to
    </ResponseField>

    <ResponseField name="base_quantity" type="number">
      Original waste quantity in the specified unit
    </ResponseField>

    <ResponseField name="quantity" type="number">
      Effective quantity after applying the facility percentage factor
    </ResponseField>

    <ResponseField name="percentage" type="number | null">
      Percentage factor applied to base quantity when split across facilities (0–1)
    </ResponseField>

    <ResponseField name="total_km_to_waste_center" type="number">
      Distance to waste treatment center in kilometers
    </ResponseField>

    <ResponseField name="low_code" type="string | null">
      LER (European Waste Catalogue) code from the linked emission factor
    </ResponseField>

    <ResponseField name="rd_code" type="string | null">
      RD disposal/recovery operation code from the linked emission factor
    </ResponseField>

    <ResponseField name="co2e" type="number | null">
      CO2 equivalent emissions in kg CO2e. Populated asynchronously after record activation.
    </ResponseField>

    <ResponseField name="co2e_biomass" type="number">
      Biogenic CO2 emissions in kg CO2e
    </ResponseField>

    <ResponseField name="custom_emission_factor_id" type="string | null">
      UUID of the custom emission factor, if used instead of the standard one
    </ResponseField>

    <ResponseField name="custom_emission_factor" type="object | null">
      Full custom emission factor object if one is linked
    </ResponseField>

    <ResponseField name="unit" type="object | null">
      Unit of measurement for the waste quantity

      <Expandable title="Unit Object">
        <ResponseField name="id" type="string">
          Unit UUID
        </ResponseField>

        <ResponseField name="name" type="string">
          Unit name (e.g., `"kilogram_(kg)"`, `"tonne_(t)"`)
        </ResponseField>

        <ResponseField name="type" type="string">
          Unit category (e.g., `"weight"`)
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="user" type="object | null">
      User who uploaded or created the record

      <Expandable title="User Object">
        <ResponseField name="id" type="string">
          User UUID
        </ResponseField>

        <ResponseField name="first_name" type="string">
          First name
        </ResponseField>

        <ResponseField name="last_name" type="string">
          Last name
        </ResponseField>

        <ResponseField name="email" type="string">
          Email address
        </ResponseField>

        <ResponseField name="prefix" type="string | null">
          Phone prefix
        </ResponseField>

        <ResponseField name="phone_number" type="string | null">
          Phone number
        </ResponseField>

        <ResponseField name="onboarding_done" type="boolean | null">
          Whether the user has completed onboarding
        </ResponseField>

        <ResponseField name="profile_img_url" type="string | null">
          Profile image URL
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="uploaded_by" type="string | null">
      UUID of the user who created the record
    </ResponseField>

    <ResponseField name="source_invoice_id" type="string">
      Internal source record UUID (used when a single record is split across multiple facilities)
    </ResponseField>

    <ResponseField name="file_id" type="string | null">
      UUID of the linked file (if uploaded via bulk import)
    </ResponseField>

    <ResponseField name="file_name" type="string | null">
      Name of the linked import file
    </ResponseField>

    <ResponseField name="file_url" type="string | null">
      Download URL for the linked import file
    </ResponseField>

    <ResponseField name="error_messages" type="array[string] | null">
      List of error messages if `status` is `error`
    </ResponseField>

    <ResponseField name="linked_projects" type="array[object]">
      Projects this waste record is linked to
    </ResponseField>

    <ResponseField name="facility_percentages" type="array[object]">
      Facility distribution breakdown when a record is split across multiple facilities
    </ResponseField>

    <ResponseField name="created_at" type="datetime">
      Timestamp when the record was created
    </ResponseField>

    <ResponseField name="updated_at" type="datetime | null">
      Timestamp when the record was last updated
    </ResponseField>

    <ResponseField name="confidence" type="object | null">
      Per-field OCR confidence scores. Only present for records uploaded via PDF.

      **Example:** `{"waste_type": 0.95, "quantity": 0.82}`
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="total" type="integer">
  Total active and uploaded waste records in the facility (facility-wide counter, independent of filters)
</ResponseField>

<ResponseField name="total2" type="integer">
  Number of waste records currently being processed (`loading` status) in the facility
</ResponseField>

<ResponseField name="total_general" type="integer">
  Total records matching the current filters — use this for pagination calculations
</ResponseField>

<ResponseField name="page" type="integer">
  Current page number
</ResponseField>

<ResponseField name="size" type="integer">
  Number of items per page
</ResponseField>

<ResponseField name="filter_hash" type="string">
  Hash of the current filter state. Passed to Bulk Delete by Filters to confirm the filters haven't changed between listing and deleting.
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X GET "https://api.dcycle.io/v1/wastes?facility_id=660e8400-e29b-41d4-a716-446655440000&status[]=active&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 requests
  import os

  api_key = os.getenv("DCYCLE_API_KEY")
  org_id = os.getenv("DCYCLE_ORG_ID")

  headers = {
      "x-api-key": api_key,
      "x-organization-id": org_id
  }

  params = {
      "facility_id": "660e8400-e29b-41d4-a716-446655440000",
      "status[]": ["active"],
      "page": 1,
      "size": 50
  }

  response = requests.get(
      "https://api.dcycle.io/v1/wastes",
      headers=headers,
      params=params
  )

  result = response.json()
  for waste in result["items"]:
      print(f"{waste['identification_name']}: {waste['co2e']} kg CO2e")
  ```

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

  const apiKey = process.env.DCYCLE_API_KEY;
  const orgId = process.env.DCYCLE_ORG_ID;

  const headers = {
    'x-api-key': apiKey,
    'x-organization-id': orgId
  };

  const params = {
    facility_id: '660e8400-e29b-41d4-a716-446655440000',
    'status[]': ['active'],
    page: 1,
    size: 50
  };

  axios.get('https://api.dcycle.io/v1/wastes', { headers, params })
    .then(response => {
      response.data.items.forEach(waste => {
        console.log(`${waste.identification_name}: ${waste.co2e} kg CO2e`);
      });
    })
    .catch(error => console.error(error));
  ```
</CodeGroup>

### Successful Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "items": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "type": "wastes",
      "identification_name": "RSU-2024-001",
      "invoice_id": "RSU-2024-001",
      "description": "Municipal solid waste from office building",
      "status": "active",
      "start_date": "2024-01-01",
      "end_date": "2024-03-31",
      "facility_id": "660e8400-e29b-41d4-a716-446655440000",
      "base_quantity": 1500.0,
      "quantity": 1500.0,
      "percentage": 1.0,
      "total_km_to_waste_center": 25.0,
      "low_code": "20 03 01",
      "rd_code": "D1",
      "co2e": 312.5,
      "co2e_biomass": 0.0,
      "custom_emission_factor_id": null,
      "custom_emission_factor": null,
      "unit": {
        "id": "61743a63-ff70-459c-9567-5eee8f7dfd5c",
        "name": "kilogram_(kg)",
        "type": "weight"
      },
      "user": {
        "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "first_name": "Ana",
        "last_name": "García",
        "email": "ana.garcia@company.com",
        "prefix": null,
        "phone_number": null,
        "onboarding_done": true,
        "profile_img_url": null
      },
      "uploaded_by": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "source_invoice_id": "550e8400-e29b-41d4-a716-446655440000",
      "file_id": null,
      "file_name": null,
      "file_url": null,
      "error_messages": null,
      "linked_projects": [],
      "facility_percentages": [],
      "created_at": "2024-11-24T10:30:00Z",
      "updated_at": "2024-11-24T10:30:00Z",
      "confidence": null
    }
  ],
  "total": 47,
  "total2": 3,
  "total_general": 47,
  "page": 1,
  "size": 50,
  "filter_hash": "a3f5b2c1d4e6f789..."
}
```

## Common Errors

### 401 Unauthorized

**Cause:** Missing or invalid API key

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

**Solution:** Verify your API key is valid and active.

### 403 Forbidden

**Cause:** The facility does not belong to your organization

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": "Facility doesn't belong to organization",
  "code": "FACILITY_NOT_BELONG_TO_ORGANIZATION"
}
```

**Solution:** Verify the `facility_id` belongs to your organization using the [Facilities API](/api-reference/facilities/list).

### 422 Validation Error

**Cause:** Missing required `facility_id` or invalid query parameter values

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": [
    {
      "loc": ["query", "facility_id"],
      "msg": "field required",
      "type": "value_error.missing"
    }
  ]
}
```

**Solution:** Ensure `facility_id` is provided and all filter values are valid.

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Create Waste" icon="plus" href="/api-reference/wastes/create">
    Add a new waste disposal record
  </Card>

  <Card title="Update Waste" icon="pencil" href="/api-reference/wastes/update">
    Modify an existing waste record
  </Card>

  <Card title="Bulk Delete by Filters" icon="trash" href="/api-reference/wastes/bulk-delete-by-filters">
    Delete all records matching the current filters
  </Card>

  <Card title="Facilities" icon="building" href="/api-reference/facilities/list">
    List facilities for your organization
  </Card>
</CardGroup>
