Skip to main content
GET
/
v1
/
vehicles
/
unique-values
Get Vehicle 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/vehicles/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 Vehicle Unique Values

Retrieve all unique values for a specific vehicle field across your organization, 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 that have been used to import vehicles so users can filter by source file.

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 vehicle field to get unique values forAvailable values: file_id, created_atExample: field=file_id

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/vehicles/unique-values?field=file_id" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}"

Successful Response

{
  "field": "file_id",
  "total_count": 3,
  "values": [
    {
      "value": "880e8400-e29b-41d4-a716-446655440000",
      "label": "fleet_import_2024_q1.csv",
      "count": 45
    },
    {
      "value": "990e8400-e29b-41d4-a716-446655440001",
      "label": "fleet_import_2024_q2.csv",
      "count": 32
    },
    {
      "value": null,
      "label": null,
      "count": 8
    }
  ]
}

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 parameter
{
  "detail": [
    {
      "loc": ["query", "field"],
      "msg": "field required",
      "type": "value_error.missing"
    }
  ]
}

List Vehicles

Retrieve vehicles with filtering and pagination

Bulk Delete by Filters

Delete all vehicles matching filter criteria

Consumption Unique Values

Get unique values for consumption fields

Vehicle Overview

Learn about the Vehicles API