Skip to main content
GET
/
v1
/
waste-water-treatments
List Waste Water Treatments
const options = {
  method: 'GET',
  headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};

fetch('https://api.dcycle.io/v1/waste-water-treatments', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "items": {
    "id": "<string>",
    "type": "<string>",
    "status": "<string>",
    "invoice_id": "<string>",
    "start_date": "<string>",
    "end_date": "<string>",
    "facility_id": {},
    "quantity": 123,
    "base_quantity": 123,
    "m3_water_out": 123,
    "kg_sludge": 123,
    "percentage": 123,
    "co2e": {},
    "co2e_biomass": 123,
    "unit": {
      "id": "<string>",
      "name": "<string>",
      "type": "<string>"
    },
    "user": {
      "id": "<string>",
      "first_name": "<string>",
      "last_name": "<string>",
      "email": "<string>"
    },
    "uploaded_by": {},
    "source_invoice_id": "<string>",
    "file_url": {},
    "linked_projects": {},
    "facility_percentages": {},
    "created_at": {}
  },
  "total": 123,
  "total2": 123,
  "total_general": 123,
  "page": 123,
  "size": 123
}

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 Waste Water Treatments

Retrieve a paginated list of waste water treatment (WWT) records for a specific facility. Each record includes enriched data: CO2e emissions, linked projects, the user who uploaded it, and facility breakdown information.

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

Query Parameters

facility_id
string
required
UUID of the facility to retrieve waste water treatment records forExample: 660e8400-e29b-41d4-a716-446655440000
start_date
date
Filter records with a start date on or after this date (ISO 8601)Example: 2025-01-01
end_date
date
Filter records with an end date on or before this date (ISO 8601)Example: 2025-12-31
status[]
array[string]
Filter by record status. Can be specified multiple times.Available values: uploaded, active, loading, errorExample: status[]=active&status[]=uploaded
co2e_status
string
Filter by CO2e calculation statusAvailable values: calculated, not_calculatedExample: co2e_status=calculated
project_id
string
Filter by project UUIDExample: 770e8400-e29b-41d4-a716-446655440000
sort
string
Sort field. Prefix with - for descending order.Example: -start_date (most recent first), invoice_id
page
integer
default:"1"
Page number for paginationExample: 1
size
integer
default:"50"
Number of items per page (max 100)Example: 50

Response

items
array[object]
Array of waste water treatment record objects
total
integer
Total active and uploaded WWT records in the facility (facility-wide counter, independent of filters)
total2
integer
Number of WWT records currently being processed (loading status) in the facility
total_general
integer
Total records matching the current filters — use this for pagination calculations
page
integer
Current page number
size
integer
Number of items per page

Example

curl -X GET "https://api.dcycle.io/v1/waste-water-treatments?facility_id=660e8400-e29b-41d4-a716-446655440000&start_date=2025-01-01&end_date=2025-12-31&page=1&size=50" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}"

Successful Response

{
  "items": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "type": "waste_water_treatment",
      "status": "active",
      "invoice_id": "WWT-2025-001",
      "start_date": "2025-01-01",
      "end_date": "2025-01-31",
      "facility_id": "660e8400-e29b-41d4-a716-446655440000",
      "quantity": 12500.0,
      "base_quantity": 12000.0,
      "m3_water_out": 12000.0,
      "kg_sludge": 850.0,
      "percentage": 1,
      "co2e": 4521.3,
      "co2e_biomass": 0.0,
      "unit": {
        "id": "...",
        "name": "cubic_meter_(m3)",
        "type": "volume"
      },
      "user": {
        "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "first_name": "Ana",
        "last_name": "García",
        "email": "ana.garcia@company.com"
      },
      "uploaded_by": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "source_invoice_id": "550e8400-e29b-41d4-a716-446655440000",
      "file_url": null,
      "linked_projects": [],
      "facility_percentages": [],
      "created_at": "2025-02-01T10:30:00Z"
    }
  ],
  "total": 47,
  "total2": 0,
  "total_general": 12,
  "page": 1,
  "size": 50
}

Common Errors

401 Unauthorized

Cause: Missing or invalid API key
{
  "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
{
  "detail": "Facility doesn't belong to organization",
  "code": "FACILITY_NOT_BELONG_TO_ORGANIZATION"
}
Solution: Verify the facility_id belongs to your organization.

422 Validation Error

Cause: Missing required facility_id or invalid query parameter values Solution: Ensure facility_id is provided and all filter values are valid.

Bulk Upload Waste Water Treatments

Create multiple WWT records at once

Delete Waste Water Treatment

Delete a single WWT record by ID