Skip to main content
GET
/
v1
/
analytics
/
usage
Get Usage Metrics
curl --request GET \
  --url https://api.example.com/v1/analytics/usage
{
  "success": false,
  "error": "organization_id or user_id is required"
}

Endpoint

GET /v1/analytics/usage

Authentication

Requires X-API-Key header with your API key.

Query Parameters

organization_id
string
Organization unique ID to get usage for. Either organization_id or user_id is required.
user_id
string
User unique ID to get usage for. Either organization_id or user_id is required.
start_date
string
Optional. Start date for filtering (ISO 8601 format, e.g., 2026-02-10T00:00:00Z). If provided, queries usage logs instead of counters (slower but filtered).
end_date
string
Optional. End date for filtering (ISO 8601 format, e.g., 2026-03-12T23:59:59Z). If provided, queries usage logs instead of counters (slower but filtered).

Response

success
boolean
Whether the request was successful
usage
object
Usage metrics object

Example Requests

curl "https://partner.teli.ai/api/proxy/v1/analytics/usage?organization_id=1767623610019x414651971228139500" \
  -H "X-API-Key: YOUR_API_KEY"

Example Response (Organization)

{
  "success": true,
  "usage": {
    "organization_id": "1767623610019x414651971228139500",
    "organization_name": "Acme Corp",
    "sms": {
      "outbound": 12450,
      "inbound": 3821,
      "total": 16271
    },
    "mms": {
      "outbound": 245,
      "inbound": 67,
      "total": 312
    },
    "voice": {
      "seconds": 45678,
      "kb_seconds": 12345,
      "total_seconds": 58023
    },
    "period": "all_time"
  },
  "powered_by": "Teli"
}

Example Response (User)

{
  "success": true,
  "usage": {
    "user_id": "1768236789852x707565875153419434",
    "user_name": "John Smith",
    "user_email": "john@example.com",
    "sms": {
      "outbound": 1234,
      "inbound": 567,
      "total": 1801
    },
    "mms": {
      "outbound": 89,
      "inbound": 12,
      "total": 101
    },
    "voice": {
      "seconds": 5678,
      "kb_seconds": 1234,
      "total_seconds": 6912
    },
    "period": "all_time"
  },
  "powered_by": "Teli"
}

Error Responses

{
  "success": false,
  "error": "organization_id or user_id is required"
}

Notes

  • All counters represent all-time totals since account creation
  • SMS/MMS counts are in segments (not messages) — a long message may count as multiple segments
  • Voice seconds include both regular calls and knowledge base-enhanced calls
  • kb_seconds tracks calls that used knowledge base retrieval (premium feature)
  • Counters are updated in real-time as usage occurs