Get API usage

OpenAPI contract

Method
GET
Path
/api/v1/analytics/api-usage
Security
jwtBearer (bearer) OR automationKey (bearer)
Response status
200 400 401 403 429 500
Request and response schemas
JSON
{
  "requestBody": {},
  "responses": {
    "200": {
      "description": "API usage analytics",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/ApiUsageResponse"
        }
      }
    },
    "400": {
      "description": "Invalid request",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/RequestError"
        }
      }
    },
    "401": {
      "description": "Authentication required or invalid",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "403": {
      "description": "Authenticated but not permitted",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "429": {
      "description": "Rate limit exceeded",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "500": {
      "description": "Unexpected server error",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    }
  }
}

GET /api/v1/analytics/api-usage accepts a JWT or an nfy_ key with analytics:read. range is one of 7d, 30d (default), 90d, or 1y; granularity is hour (default) or day.

The response contains five time-bucketed metrics, each with a range total and its points: NCU consumed, build count, build minutes (successful builds only), average NCU per build, and max concurrent builds. It also includes a grantLine showing NCU used against the monthly grant, independent of the selected range.

For a custom period, supply both from and to as ISO-8601 instants. They override range, must be ordered, and may span at most 366 days. Use each metric's total for the period summary; averaging the per-bucket NCU averages would give an incorrect result when buckets have different build counts.

http
GET /api/v1/analytics/api-usage?range=30d&granularity=hour
Authorization: Bearer <access token>