Metrics
Get account metrics
Read levios account KPIs and the top-performing automations for a chosen 7-day or 30-day time window, ready to render on a dashboard view.
GET
/
api
/
v1
/
metrics
Get account metrics
curl --request GET \
--url https://levios.app/api/v1/metrics \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://levios.app/api/v1/metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://levios.app/api/v1/metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"kpis": {
"active_automations": {
"active": 4503599627370495,
"paused": 4503599627370495,
"total": 4503599627370495
},
"dms_sent": {
"delta_pct": 0,
"prev": 4503599627370495,
"value": 4503599627370495
},
"leads": {
"last_window": 4503599627370495,
"total": 4503599627370495
},
"new_contacts": {
"delta_pct": 0,
"prev": 4503599627370495,
"value": 4503599627370495
}
},
"top_automations": [
{
"dms_last_7d": 4503599627370495,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"last_fired_at": "<string>",
"name": "<string>",
"status": "draft"
}
],
"window": "30d"
}{
"error": {
"code": "api_invalid_content_length",
"message": "Invalid Content-Length.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_unauthorized",
"message": "Authentication required.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_account_not_granted",
"message": "This credential is not authorized for the request.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_body_too_large",
"message": "The JSON request body exceeds 1 MiB.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_unsupported_media_type",
"message": "Content-Type must be application/json.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_validation_error",
"message": "The request does not match the declared schema.",
"correlation_id": "<string>",
"details": {
"issues": [
{
"code": "<string>",
"path": [
1
]
}
]
}
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_internal_error",
"message": "The request could not be completed.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_metrics_read_unavailable",
"message": "The account metrics could not be read.",
"correlation_id": "<string>"
}
}This endpoint returns account KPIs and up to five top automations. Use an
account
id from List accounts as account_id.
Access
Your API key needs themetrics:read scope and access to the selected account.
Select a window
Setwindow to one of these enum values:
7d: the trailing 7-day period. This is the default.30d: the trailing 30-day period.
dms_sent and new_contacts, value covers the selected window and
prev covers the immediately preceding window of the same length.
delta_pct is the rounded percentage change between them. It is null when
prev is zero.
Returned KPIs
Thekpis object contains:
| Field | Meaning |
|---|---|
dms_sent | Sent direct messages in the selected and previous windows, with their percentage change. |
new_contacts | Contacts first seen in the selected and previous windows, with their percentage change. |
leads | total contacts with an email or phone and last_window captures that can be dated to the selected window. |
active_automations | Counts for live (active), paused, and total automations. The total can also include drafts. |
leads.last_window can be null when leads exist but their capture timestamps
are unavailable.
Top automations
top_automations contains at most five items. Each item includes id, name,
status, dms_last_7d, and last_fired_at.
The status enum has these values:
draft: saved but not processing new triggers.live: active and able to process matching triggers.paused: inactive until it is activated again.
dms_last_7d always covers the trailing seven days, even when you request the
30d account window. last_fired_at is null when the automation has not
fired.
Example request
curl --get \
--url 'https://levios.app/api/v1/metrics' \
--header "Authorization: Bearer ${LEVIOS_API_KEY}" \
--data-urlencode "account_id=${LEVIOS_ACCOUNT_ID}" \
--data-urlencode 'window=30d'
Query Parameters
Get account metrics
curl --request GET \
--url https://levios.app/api/v1/metrics \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://levios.app/api/v1/metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://levios.app/api/v1/metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"kpis": {
"active_automations": {
"active": 4503599627370495,
"paused": 4503599627370495,
"total": 4503599627370495
},
"dms_sent": {
"delta_pct": 0,
"prev": 4503599627370495,
"value": 4503599627370495
},
"leads": {
"last_window": 4503599627370495,
"total": 4503599627370495
},
"new_contacts": {
"delta_pct": 0,
"prev": 4503599627370495,
"value": 4503599627370495
}
},
"top_automations": [
{
"dms_last_7d": 4503599627370495,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"last_fired_at": "<string>",
"name": "<string>",
"status": "draft"
}
],
"window": "30d"
}{
"error": {
"code": "api_invalid_content_length",
"message": "Invalid Content-Length.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_unauthorized",
"message": "Authentication required.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_account_not_granted",
"message": "This credential is not authorized for the request.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_body_too_large",
"message": "The JSON request body exceeds 1 MiB.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_unsupported_media_type",
"message": "Content-Type must be application/json.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_validation_error",
"message": "The request does not match the declared schema.",
"correlation_id": "<string>",
"details": {
"issues": [
{
"code": "<string>",
"path": [
1
]
}
]
}
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_internal_error",
"message": "The request could not be completed.",
"correlation_id": "<string>"
}
}{
"error": {
"code": "api_metrics_read_unavailable",
"message": "The account metrics could not be read.",
"correlation_id": "<string>"
}
}
