Analytics & Usage Metrics

Monitor API key usage and performance metrics

Overview

Track your API usage, monitor request patterns, and understand your integration's performance. This helps optimize your integration and plan for scaling.

Endpoints

GEThttps://server.nyraai.io/api/external/analytics

Get API key usage statistics and request logs

Permission: analytics:read

Headers

x-api-keyrequired

API key

x-api-secretrequired

API secret

Authorizationrequired

Bearer hospital token

Response

{
  "success": true,
  "data": {
    "totalRequests": 1234,
    "requestsThisMonth": 450,
    "averageResponseTime": 245,
    "successRate": 98.5,
    "recentLogs": [
      {
        "id": "log-uuid",
        "endpoint": "GET /api/external/patients",
        "method": "GET",
        "status": 200,
        "responseTime": 120,
        "created_at": "2026-04-07T14:30:00Z"
      },
      {
        "id": "log-uuid-2",
        "endpoint": "POST /api/external/appointments",
        "method": "POST",
        "status": 201,
        "responseTime": 350,
        "created_at": "2026-04-07T14:25:00Z"
      }
    ]
  }
}

Usage Example

curl -X GET "https://server.nyraai.io/api/external/analytics" \
  -H "x-api-key: nyra_..." \
  -H "x-api-secret: secret..." \
  -H "Authorization: Bearer token..."

Key Metrics

Total Requests

Cumulative number of API requests made with this key

Success Rate

Percentage of requests that returned 2xx status codes

Average Response Time

Average time (ms) to process requests

Monthly Usage

Number of requests in current calendar month

Request Logs

Understanding the log entries

FieldDescription
endpointThe API endpoint called
methodHTTP method (GET, POST, etc.)
statusHTTP response status code
responseTimeTime to process request in milliseconds
created_atTimestamp of the request

Usage Tips

  • ✓ Monitor success rate to catch authentication/permission issues early
  • ✓ Track response times to identify performance bottlenecks
  • ✓ Use monthly usage data for capacity planning
  • ✓ Set up alerts for unusual success rate drops
  • ✓ Review error patterns to improve integration reliability