title: Usage

description: Retrieve usage metrics and reports for your API subscriptions.

Usage

Monitor how your account consumes each subscribed API. Use these endpoints to build dashboards, set alerts, and track costs.


Get usage summary

Returns aggregated usage statistics across all subscribed APIs.

GET /v1/usage
ParameterTypeDefaultDescription
fromstring30 days agoStart date (ISO 8601).
tostringtodayEnd date (ISO 8601).
granularitystringdayTime bucket: hour, day, week, month.
# cURL
curl "https://api.wontopos.com/v1/usage?from=2026-03-01&to=2026-03-30&granularity=day" 
  -H "Authorization: Bearer sk_live_your_key_here"
// JavaScript
const res = await fetch(
  "https://api.wontopos.com/v1/usage?from=2026-03-01&to=2026-03-30",
  { headers: { Authorization: "Bearer sk_live_your_key_here" } }
);

Response:

{
  "period": {
    "from": "2026-03-01T00:00:00Z",
    "to": "2026-03-30T00:00:00Z"
  },
  "total_requests": 48200,
  "total_errors": 34,
  "total_cost_usd": 12.45,
  "by_api": [
    {
      "api_id": "api_1a2b3c4d",
      "name": "Global Payments API",
      "requests": 32100,
      "errors": 12,
      "avg_latency_ms": 43,
      "cost_usd": 8.20
    },
    {
      "api_id": "api_5e6f7g8h",
      "name": "Geocoding API",
      "requests": 16100,
      "errors": 22,
      "avg_latency_ms": 120,
      "cost_usd": 4.25
    }
  ]
}

Get usage by API

Returns detailed usage metrics for a specific API subscription.

GET /v1/usage/:api_id
ParameterTypeRequiredDescription
api_idstringYesThe ID of the API to get usage for.
ParameterTypeDefaultDescription
fromstring30 days agoStart date (ISO 8601).
tostringtodayEnd date (ISO 8601).
granularitystringdayTime bucket: hour, day, week, month.
endpointstringFilter by specific endpoint path.

Response:

{
  "api_id": "api_1a2b3c4d",
  "name": "Global Payments API",
  "period": {
    "from": "2026-03-01T00:00:00Z",
    "to": "2026-03-30T00:00:00Z"
  },
  "total_requests": 32100,
  "total_errors": 12,
  "avg_latency_ms": 43,
  "cost_usd": 8.20,
  "plan_limit": 50000,
  "usage_percentage": 64.2,
  "timeseries": [
    { "date": "2026-03-01", "requests": 1050, "errors": 1, "avg_latency_ms": 41 },
    { "date": "2026-03-02", "requests": 980, "errors": 0, "avg_latency_ms": 44 }
  ]
}

Usage alerts

Set up [webhooks](/docs/api-reference/webhooks) to receive a `usage.limit_reached` event when consumption hits 80% of your plan limit.

Data availability

Usage data is updated every 5 minutes. Real-time data may have up to a 5-minute delay.