Mager API

Get API usage

GET/api/v1/usage

Request counts, charged moods, and response times for the account, broken down by endpoint and by day. Only calls that charged carry a cost, so polling a task never shows up as extra spend.

Authorization

MagerApiKey
x-mager-api-key<token>

Mager API key

In: header

Query Parameters

from?string

ISO start of the window. Defaults to 30 days ago.

to?string

ISO end of the window. Defaults to now.

Header Parameters

x-mager-api-key*string

Mager API key

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/api/v1/usage" \  -H "x-mager-api-key: YOUR_API_KEY"
{  "status": 200,  "message": "Success",  "data": {    "range": {      "from": "2026-07-04T00:00:00.000Z",      "to": "2026-08-03T00:00:00.000Z"    },    "totals": {      "requests": 1284,      "base_moods": 3120,      "charged_moods": 4680,      "avg_response_time_ms": 842    },    "by_endpoint": [      {        "endpoint": "/api/v1/generation-tasks",        "method": "POST",        "requests": 412,        "charged_moods": 4680,        "avg_response_time_ms": 2310      },      {        "endpoint": "/api/v1/generation-tasks/:taskId",        "method": "GET",        "requests": 831,        "charged_moods": 0,        "avg_response_time_ms": 96      }    ],    "by_day": [      {        "day": "2026-08-01",        "requests": 143,        "charged_moods": 520      },      {        "day": "2026-08-02",        "requests": 168,        "charged_moods": 615      }    ]  }}