# Get an environment's analytics dashboard

> Source: https://truto.one/docs/api-reference/admin/analytics/dashboard/

`GET /analytics/dashboard`

Resource: **Analytics**

## Query parameters

- **`environment_id`** _(string, required)_
  The environment to report on. The caller must belong to it.
- **`from`** _(string)_
  First UTC day (inclusive). Defaults to 30 days before `to`. Clamped to the 90-day window.
- **`to`** _(string)_
  Last UTC day (inclusive). Defaults to today; a range that includes today runs up to now.

## Response body

- **`environment_id`** _(string)_
- **`from`** _(string)_
- **`to`** _(string)_
- **`previous`** _(object)_
  - **`from`** _(string)_
  - **`to`** _(string)_
- **`buckets`** _(array<string>)_
- **`generated_at`** _(string)_
  When the numbers were read. Responses are cached for a few minutes.
- **`kpis`** _(object)_
  Each headline number for the range, the span of the same length before it, and a daily series. `accounts`, `active_accounts` and `active_integrations` describe the accounts as they are now, so they have no previous value or series.
  - **`api_calls`** _(object)_
    - **`value`** _(number)_
      Null when there is nothing to measure, e.g. a rate with no requests behind it.
    - **`previous`** _(number)_
      The same figure for the span of equal length just before the range (ending at the same time of day); null when that span is not inside the 90-day window, and for numbers that describe the accounts as they are now.
    - **`series`** _(array<number>)_
      One value per day of the range (null for a rate or latency with no requests that day); empty for numbers that describe the accounts as they are now.
  - **`billable_api_calls`** _(object)_
    - **`value`** _(number)_
      Null when there is nothing to measure, e.g. a rate with no requests behind it.
    - **`previous`** _(number)_
      The same figure for the span of equal length just before the range (ending at the same time of day); null when that span is not inside the 90-day window, and for numbers that describe the accounts as they are now.
    - **`series`** _(array<number>)_
      One value per day of the range (null for a rate or latency with no requests that day); empty for numbers that describe the accounts as they are now.
  - **`errors`** _(object)_
    - **`value`** _(number)_
      Null when there is nothing to measure, e.g. a rate with no requests behind it.
    - **`previous`** _(number)_
      The same figure for the span of equal length just before the range (ending at the same time of day); null when that span is not inside the 90-day window, and for numbers that describe the accounts as they are now.
    - **`series`** _(array<number>)_
      One value per day of the range (null for a rate or latency with no requests that day); empty for numbers that describe the accounts as they are now.
  - **`error_rate`** _(object)_
    - **`value`** _(number)_
      Null when there is nothing to measure, e.g. a rate with no requests behind it.
    - **`previous`** _(number)_
      The same figure for the span of equal length just before the range (ending at the same time of day); null when that span is not inside the 90-day window, and for numbers that describe the accounts as they are now.
    - **`series`** _(array<number>)_
      One value per day of the range (null for a rate or latency with no requests that day); empty for numbers that describe the accounts as they are now.
  - **`rate_limited`** _(object)_
    - **`value`** _(number)_
      Null when there is nothing to measure, e.g. a rate with no requests behind it.
    - **`previous`** _(number)_
      The same figure for the span of equal length just before the range (ending at the same time of day); null when that span is not inside the 90-day window, and for numbers that describe the accounts as they are now.
    - **`series`** _(array<number>)_
      One value per day of the range (null for a rate or latency with no requests that day); empty for numbers that describe the accounts as they are now.
  - **`latency_p95`** _(object)_
    - **`value`** _(number)_
      Null when there is nothing to measure, e.g. a rate with no requests behind it.
    - **`previous`** _(number)_
      The same figure for the span of equal length just before the range (ending at the same time of day); null when that span is not inside the 90-day window, and for numbers that describe the accounts as they are now.
    - **`series`** _(array<number>)_
      One value per day of the range (null for a rate or latency with no requests that day); empty for numbers that describe the accounts as they are now.
  - **`provider_latency_p95`** _(object)_
    - **`value`** _(number)_
      Null when there is nothing to measure, e.g. a rate with no requests behind it.
    - **`previous`** _(number)_
      The same figure for the span of equal length just before the range (ending at the same time of day); null when that span is not inside the 90-day window, and for numbers that describe the accounts as they are now.
    - **`series`** _(array<number>)_
      One value per day of the range (null for a rate or latency with no requests that day); empty for numbers that describe the accounts as they are now.
  - **`records_synced`** _(object)_
    - **`value`** _(number)_
      Null when there is nothing to measure, e.g. a rate with no requests behind it.
    - **`previous`** _(number)_
      The same figure for the span of equal length just before the range (ending at the same time of day); null when that span is not inside the 90-day window, and for numbers that describe the accounts as they are now.
    - **`series`** _(array<number>)_
      One value per day of the range (null for a rate or latency with no requests that day); empty for numbers that describe the accounts as they are now.
  - **`sync_failures`** _(object)_
    - **`value`** _(number)_
      Null when there is nothing to measure, e.g. a rate with no requests behind it.
    - **`previous`** _(number)_
      The same figure for the span of equal length just before the range (ending at the same time of day); null when that span is not inside the 90-day window, and for numbers that describe the accounts as they are now.
    - **`series`** _(array<number>)_
      One value per day of the range (null for a rate or latency with no requests that day); empty for numbers that describe the accounts as they are now.
  - **`webhook_events`** _(object)_
    - **`value`** _(number)_
      Null when there is nothing to measure, e.g. a rate with no requests behind it.
    - **`previous`** _(number)_
      The same figure for the span of equal length just before the range (ending at the same time of day); null when that span is not inside the 90-day window, and for numbers that describe the accounts as they are now.
    - **`series`** _(array<number>)_
      One value per day of the range (null for a rate or latency with no requests that day); empty for numbers that describe the accounts as they are now.
  - **`webhook_failure_rate`** _(object)_
    - **`value`** _(number)_
      Null when there is nothing to measure, e.g. a rate with no requests behind it.
    - **`previous`** _(number)_
      The same figure for the span of equal length just before the range (ending at the same time of day); null when that span is not inside the 90-day window, and for numbers that describe the accounts as they are now.
    - **`series`** _(array<number>)_
      One value per day of the range (null for a rate or latency with no requests that day); empty for numbers that describe the accounts as they are now.
  - **`mcp_calls`** _(object)_
    - **`value`** _(number)_
      Null when there is nothing to measure, e.g. a rate with no requests behind it.
    - **`previous`** _(number)_
      The same figure for the span of equal length just before the range (ending at the same time of day); null when that span is not inside the 90-day window, and for numbers that describe the accounts as they are now.
    - **`series`** _(array<number>)_
      One value per day of the range (null for a rate or latency with no requests that day); empty for numbers that describe the accounts as they are now.
  - **`new_accounts`** _(object)_
    - **`value`** _(number)_
      Null when there is nothing to measure, e.g. a rate with no requests behind it.
    - **`previous`** _(number)_
      The same figure for the span of equal length just before the range (ending at the same time of day); null when that span is not inside the 90-day window, and for numbers that describe the accounts as they are now.
    - **`series`** _(array<number>)_
      One value per day of the range (null for a rate or latency with no requests that day); empty for numbers that describe the accounts as they are now.
  - **`accounts`** _(object)_
    - **`value`** _(number)_
      Null when there is nothing to measure, e.g. a rate with no requests behind it.
    - **`previous`** _(number)_
      The same figure for the span of equal length just before the range (ending at the same time of day); null when that span is not inside the 90-day window, and for numbers that describe the accounts as they are now.
    - **`series`** _(array<number>)_
      One value per day of the range (null for a rate or latency with no requests that day); empty for numbers that describe the accounts as they are now.
  - **`active_accounts`** _(object)_
    - **`value`** _(number)_
      Null when there is nothing to measure, e.g. a rate with no requests behind it.
    - **`previous`** _(number)_
      The same figure for the span of equal length just before the range (ending at the same time of day); null when that span is not inside the 90-day window, and for numbers that describe the accounts as they are now.
    - **`series`** _(array<number>)_
      One value per day of the range (null for a rate or latency with no requests that day); empty for numbers that describe the accounts as they are now.
  - **`active_integrations`** _(object)_
    - **`value`** _(number)_
      Null when there is nothing to measure, e.g. a rate with no requests behind it.
    - **`previous`** _(number)_
      The same figure for the span of equal length just before the range (ending at the same time of day); null when that span is not inside the 90-day window, and for numbers that describe the accounts as they are now.
    - **`series`** _(array<number>)_
      One value per day of the range (null for a rate or latency with no requests that day); empty for numbers that describe the accounts as they are now.
- **`by_category`** _(array<object>)_
  - **`category`** _(string)_
  - **`calls`** _(integer)_
- **`inventory`** _(object)_
  The environment's integrations and integrated accounts as they are now (sandbox accounts excluded).
  - **`as_of`** _(string)_
  - **`accounts`** _(integer)_
  - **`by_status`** _(object)_
  - **`active_connections`** _(integer)_
  - **`superquery_accounts`** _(integer)_
  - **`installed_connectors`** _(integer)_
  - **`active_connectors`** _(integer)_
- **`account_events`** _(array<object>)_
  Integrated account lifecycle events in the range, from the logs (for example `created`, `updated`, `deleted`).
  - **`event`** _(string)_
  - **`count`** _(integer)_
- **`integrations`** _(array<object>)_
  Every integration with API calls in the range or integrated accounts now, by API calls.
  - **`integration`** _(string)_
  - **`calls`** _(integer)_
    API calls as billing counts them (the `billable_api_calls` filter).
  - **`requests`** _(integer)_
    API requests, the denominator of the error rate.
  - **`errors`** _(integer)_
  - **`accounts`** _(integer)_
  - **`active_accounts`** _(integer)_
  - **`attention_accounts`** _(integer)_
    Accounts with status `needs_reauth`, `validation_error` or `post_install_error` now.

## Code examples

### curl

```bash
curl -X GET 'https://api.truto.one/analytics/dashboard' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json'
```

### JavaScript

```javascript
const response = await fetch('https://api.truto.one/analytics/dashboard', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/analytics/dashboard"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
```
