Skip to content

User Usage Statistics

Get API usage statistics aggregated at the user level. Useful for billing and monitoring.

Get User Usage

Get usage summary for a specific user account.

Request

http
GET /v1/admin/users/:id/usage
Authorization: Bearer {admin_key}

Query Parameters

ParameterTypeDefaultDescription
start_dateISO 860130 days agoStart of period
end_dateISO 8601NowEnd of period

Example

bash
curl -X GET "https://api.insight.iagon.com/v1/admin/users/550e8400-e29b-41d4-a716-446655440000/usage?start_date=2026-01-01&end_date=2026-01-31" \
  -H "Authorization: Bearer YOUR_ADMIN_KEY"

Response (200 OK)

json
{
  "success": true,
  "data": {
    "user_account_id": "550e8400-e29b-41d4-a716-446655440000",
    "user_name": "Acme Corporation",
    "external_id": "cust_abc123",
    "total_requests": 152400,
    "successful_requests": 150200,
    "failed_requests": 2200,
    "avg_response_time_ms": 45,
    "credential_count": 3,
    "period_start": "2026-01-01T00:00:00Z",
    "period_end": "2026-01-31T23:59:59Z"
  }
}

Get All Users Usage

Get usage summary for all your users. Perfect for billing dashboards.

Request

http
GET /v1/admin/users/usage/summary
Authorization: Bearer {admin_key}

Query Parameters

ParameterTypeDefaultDescription
limitinteger20Results per page (1-100)
offsetinteger0Pagination offset
start_dateISO 860130 days agoStart of period
end_dateISO 8601NowEnd of period

Example

bash
curl -X GET "https://api.insight.iagon.com/v1/admin/users/usage/summary?start_date=2026-01-01" \
  -H "Authorization: Bearer YOUR_ADMIN_KEY"

Response (200 OK)

json
{
  "success": true,
  "data": [
    {
      "user_account_id": "550e8400-e29b-41d4-a716-446655440000",
      "user_name": "Acme Corporation",
      "external_id": "cust_abc123",
      "total_requests": 152400,
      "successful_requests": 150200,
      "failed_requests": 2200,
      "avg_response_time_ms": 45,
      "credential_count": 3,
      "period_start": "2026-01-01T00:00:00Z",
      "period_end": "2026-01-31T23:59:59Z"
    },
    {
      "user_account_id": "550e8400-e29b-41d4-a716-446655440002",
      "user_name": "Beta Inc",
      "external_id": "cust_xyz789",
      "total_requests": 8500,
      "successful_requests": 8400,
      "failed_requests": 100,
      "avg_response_time_ms": 38,
      "credential_count": 1,
      "period_start": "2026-01-01T00:00:00Z",
      "period_end": "2026-01-31T23:59:59Z"
    }
  ],
  "pagination": {
    "limit": 20,
    "offset": 0,
    "total": 2,
    "hasMore": false
  }
}

Usage Summary Fields

FieldDescription
total_requestsTotal API calls made
successful_requestsRequests with 2xx/3xx status
failed_requestsRequests with 4xx/5xx status
avg_response_time_msAverage response time
credential_countNumber of active API keys

Notes

  • Results sorted by total_requests descending (highest usage first)
  • Only includes active users (not suspended)
  • Aggregates usage across all credentials for each user
  • Use external_id to match with your billing system