Skip to main content
GET
/
v1
/
transports
/
counts
Get Route Counts
const options = {method: 'GET', headers: {'x-organization-id': '<x-organization-id>'}};

fetch('https://api.dcycle.io/v1/transports/counts', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "pending": 123,
  "active": 123,
  "error": 123
}

Get Route Counts

Return a summary of how many transport routes are in each calculation state — pending, active, or error — for the authenticated organization. Optionally filter by transport direction or the file that uploaded the routes. This endpoint is useful for building status badges, progress indicators, and health dashboards without fetching the full route list.

Request

Authentication

Supports both authentication methods:
x-api-key
string
Your API key (use this or Authorization)Example: sk_live_1234567890abcdef
Authorization
string
Bearer JWT token (use this or x-api-key)Example: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...

Headers

x-organization-id
string
required
Your organization UUIDExample: a8315ef3-dd50-43f8-b7ce-d839e68d51fa

Query Parameters

transport_direction
string
Filter counts to a specific direction. One of: downstream, upstreamExample: downstream
file_id
string
Filter counts to routes that were created from a specific bulk-upload file (UUID)Example: f3a2b1c0-dead-beef-0000-123456789abc

Response

pending
integer
Number of routes currently awaiting emissions calculation. Default: 0
active
integer
Number of routes with successfully completed emissions calculation. Default: 0
error
integer
Number of routes where emissions calculation failed. Default: 0

Example

# All routes
curl -X GET "https://api.dcycle.io/v1/transports/counts" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}"

# Filter by direction
curl -X GET "https://api.dcycle.io/v1/transports/counts?transport_direction=downstream" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}"

# Filter by uploaded file
curl -X GET "https://api.dcycle.io/v1/transports/counts?file_id=f3a2b1c0-dead-beef-0000-123456789abc" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}"

Successful Response

{
  "pending": 3,
  "active": 142,
  "error": 1
}

All Routes Calculated

{
  "pending": 0,
  "active": 146,
  "error": 0
}

Common Errors

401 Unauthorized

Cause: Missing or invalid API key / JWT token
{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}

403 Forbidden

Cause: The authenticated user is not a member of the organization
{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}

422 Unprocessable Entity

Cause: Invalid value for a query parameter, e.g. an unrecognized transport_direction
{
  "detail": [
    {
      "loc": ["query", "transport_direction"],
      "msg": "value is not a valid enumeration member; permitted: 'downstream', 'upstream'",
      "type": "type_error.enum"
    }
  ]
}

List Transport Routes

Retrieve all transport routes with filtering and pagination

Get Transport Route

Get a specific transport route by ID with all sections and emissions

Create Transport Route

Create a new transport route with sections

Update Transport Route

Modify a transport route and replace its sections

Delete Transport Route

Remove a transport route permanently

Transport Overview

Full data model and distance calculation reference