Skip to main content
GET
/
v1
/
waste
/
unique-values
Get Waste Unique Values
const options = {
  method: 'GET',
  headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};

fetch('https://api.dcycle.io/v1/waste/unique-values', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "field": "<string>",
  "total_count": 123,
  "values": {
    "value": {},
    "label": {},
    "count": 123
  }
}

Get Waste Unique Values

Retrieve all unique values for a specific waste field within a facility, along with the count of records for each value. Useful for building filter dropdowns or understanding data distribution.
Use Case: This endpoint is commonly used to populate filter options in a UI — for example, listing all distinct file IDs or LER codes present in a facility’s waste records so users can filter by them.

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

field
string
required
The waste field to get unique values forAvailable values: file_id, created_at, identification_name, ler_code, rd_codeExample: field=file_id
facility_id
string
required
The UUID of the facility to scope the query toExample: 660e8400-e29b-41d4-a716-446655440000

Response

field
string
The field name that was queried
total_count
integer
Total number of unique values found
values
array[object]
List of unique values with their record counts

Example

curl -X GET "https://api.dcycle.io/v1/waste/unique-values?field=ler_code&facility_id=660e8400-e29b-41d4-a716-446655440000" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}"

Successful Response

{
  "field": "ler_code",
  "total_count": 3,
  "values": [
    {
      "value": "15 01 01",
      "label": "Paper and cardboard packaging",
      "count": 45
    },
    {
      "value": "20 01 01",
      "label": "Paper and cardboard",
      "count": 32
    },
    {
      "value": null,
      "label": null,
      "count": 5
    }
  ]
}

Field Reference

FieldDescriptionValue format
file_idSource import file UUIDUUID string
created_atRecord creation dateISO date string
identification_nameWaste identification name or invoice numberText string
ler_codeEuropean Waste List (LER) codeCode string (e.g. 15 01 01)
rd_codeRecovery/disposal operation codeCode string (e.g. R1)

Common Errors

401 Unauthorized

Cause: Missing or invalid API key
{
  "detail": "Invalid API key",
  "code": "INVALID_API_KEY"
}

422 Validation Error

Cause: Missing or invalid field or facility_id parameter
{
  "detail": [
    {
      "loc": ["query", "field"],
      "msg": "field required",
      "type": "value_error.missing"
    }
  ]
}

List Wastes

Retrieve waste records with filtering and pagination

Bulk Delete by Filters

Delete all waste records matching filter criteria

Bulk Delete Wastes

Delete specific waste records by ID

Wastes Overview

Learn about the Wastes API