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

# Organization Metrics

> Get entity counts and plan limits for an organization

# Organization Metrics

Retrieve a high-level summary of all entity counts for an organization — facilities, vehicles, employees, invoices, and more. Also returns the organization's plan limits. Useful for building dashboards or checking data completeness before running calculations.

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

### Path Parameters

<ParamField path="organization_id" type="string" required>
  UUID of the organization to query
</ParamField>

## Response

<ResponseField name="limits" type="object">
  Plan limits for the organization

  <ResponseField name="facilities" type="integer">Maximum facilities allowed</ResponseField>
  <ResponseField name="vehicles" type="integer">Maximum vehicles allowed</ResponseField>
  <ResponseField name="employees" type="integer">Maximum employees allowed</ResponseField>
  <ResponseField name="business_travels" type="integer">Maximum business travels allowed</ResponseField>
  <ResponseField name="users" type="integer">Maximum users allowed</ResponseField>
  <ResponseField name="shipments" type="integer">Maximum shipments allowed</ResponseField>
  <ResponseField name="deliveries" type="integer">Maximum deliveries allowed</ResponseField>
  <ResponseField name="purchases" type="integer">Maximum purchases allowed</ResponseField>
</ResponseField>

<ResponseField name="facilities" type="integer">
  Number of active facilities (excluding logistic hubs)
</ResponseField>

<ResponseField name="vehicles" type="integer">
  Number of vehicles
</ResponseField>

<ResponseField name="employees" type="integer">
  Number of employees
</ResponseField>

<ResponseField name="business_travels" type="integer">
  Number of business travel records
</ResponseField>

<ResponseField name="hotel_stays" type="integer">
  Number of hotel stay records
</ResponseField>

<ResponseField name="purchases" type="integer">
  Number of purchase records
</ResponseField>

<ResponseField name="transport_downstream" type="integer">
  Number of downstream transport routes
</ResponseField>

<ResponseField name="transport_upstream" type="integer">
  Number of upstream transport routes
</ResponseField>

<ResponseField name="logistic_hubs" type="integer">
  Number of active logistic hubs
</ResponseField>

<ResponseField name="logistic_requests" type="integer">
  Number of active logistics requests
</ResponseField>

<ResponseField name="logistic_recharges" type="integer">
  Number of logistics recharge records
</ResponseField>

<ResponseField name="sold_products" type="integer">
  Number of sold product records
</ResponseField>

<ResponseField name="own_workforce" type="integer">
  Number of own workforce records
</ResponseField>

<ResponseField name="custom_emission_groups" type="integer">
  Number of custom emission factor groups
</ResponseField>

<ResponseField name="certification" type="integer">
  Number of certification records (ESRS governance)
</ResponseField>

<ResponseField name="policy" type="integer">
  Number of policy records (ESRS governance)
</ResponseField>

<ResponseField name="strategy" type="integer">
  Number of strategy records (ESRS governance)
</ResponseField>

<ResponseField name="action" type="integer">
  Number of action plan records (ESRS governance)
</ResponseField>

<ResponseField name="plan" type="integer">
  Number of plan records (ESRS governance)
</ResponseField>

<ResponseField name="trend" type="integer">
  Number of trend records (ESRS governance)
</ResponseField>

<ResponseField name="business_model" type="integer">
  Number of business model records (ESRS governance)
</ResponseField>

<ResponseField name="market" type="integer">
  Number of market records (ESRS governance)
</ResponseField>

<ResponseField name="intensity_metric_groups" type="integer">
  Number of intensity metric groups
</ResponseField>

<ResponseField name="sot_organization_measurement_campaign" type="integer">
  Number of SOT organization measurement campaigns
</ResponseField>

<ResponseField name="funds" type="integer">
  Number of fund records (ESRS governance)
</ResponseField>

<ResponseField name="social_governance" type="integer">
  Number of social governance records
</ResponseField>

<ResponseField name="events" type="integer">
  Number of event records
</ResponseField>

<ResponseField name="ms_risks" type="integer">
  Number of management system risk records
</ResponseField>

<ResponseField name="ms_opportunities" type="integer">
  Number of management system opportunity records
</ResponseField>

<ResponseField name="ms_nc_types" type="integer">
  Number of management system non-conformity type records
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl "https://api.dcycle.io/v1/organizations/${ORG_ID}/metrics" \
    -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

  org_id = os.getenv("DCYCLE_ORG_ID")
  response = requests.get(
      f"https://api.dcycle.io/v1/organizations/{org_id}/metrics",
      headers={
          "x-api-key": os.getenv("DCYCLE_API_KEY"),
          "x-organization-id": org_id,
      },
  )

  metrics = response.json()
  print(f"Facilities: {metrics['facilities']}/{metrics['limits']['facilities']}")
  print(f"Vehicles: {metrics['vehicles']}/{metrics['limits']['vehicles']}")
  print(f"Employees: {metrics['employees']}/{metrics['limits']['employees']}")
  ```

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

  const orgId = process.env.DCYCLE_ORG_ID;
  const { data: metrics } = await axios.get(
    `https://api.dcycle.io/v1/organizations/${orgId}/metrics`,
    {
      headers: {
        'x-api-key': process.env.DCYCLE_API_KEY,
        'x-organization-id': orgId,
      },
    }
  );

  console.log(`Facilities: ${metrics.facilities}/${metrics.limits.facilities}`);
  console.log(`Vehicles: ${metrics.vehicles}/${metrics.limits.vehicles}`);
  ```
</CodeGroup>

### Successful Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "limits": {
    "facilities": 50,
    "vehicles": 200,
    "employees": 1000,
    "business_travels": 5000,
    "users": 25,
    "shipments": 10000,
    "deliveries": 10000,
    "purchases": 5000
  },
  "facilities": 12,
  "logistic_hubs": 3,
  "logistic_requests": 145,
  "logistic_recharges": 28,
  "vehicles": 45,
  "employees": 320,
  "business_travels": 89,
  "hotel_stays": 34,
  "purchases": 1250,
  "transport_downstream": 67,
  "transport_upstream": 23,
  "own_workforce": 0,
  "custom_emission_groups": 2,
  "sold_products": 15,
  "certification": 1,
  "policy": 3,
  "strategy": 2,
  "action": 5,
  "plan": 1,
  "trend": 0,
  "business_model": 1,
  "market": 0,
  "intensity_metric_groups": 1,
  "sot_organization_measurement_campaign": 0,
  "funds": 0,
  "social_governance": 0,
  "events": 0,
  "ms_risks": 0,
  "ms_opportunities": 0,
  "ms_nc_types": 0
}
```

## Common Errors

### 401 Unauthorized

**Cause:** Missing or invalid API key

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

### 403 Forbidden

**Cause:** The authenticated user is not a member of the organization

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}
```

### 404 Not Found

**Cause:** The organization does not exist or you are not a member

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "Organization not found"}
```

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Organization Tree" icon="sitemap" href="/api-reference/organizations/tree">
    View the organization hierarchy
  </Card>

  <Card title="Emissions Summary" icon="chart-pie" href="/api-reference/emissions/get-summary">
    Get aggregated emission data
  </Card>
</CardGroup>
