Get top failure reasons

OpenAPI contract

Method
GET
Path
/api/v1/analytics/failures/top
Security
jwtBearer (bearer) OR automationKey (bearer)
Response status
200 400 401 403 429 500
Request and response schemas
JSON
{
  "requestBody": {},
  "responses": {
    "200": {
      "description": "Top failures",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/AnalyticsTopResponse"
        }
      }
    },
    "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/failures/top accepts a JWT or an nfy_ key with analytics:read. It counts error messages from the authenticated user's non-draft builds in FAILED state within range (7d, 30d default, 90d, or 1y). Each error message is truncated to 200 characters before grouping. limit defaults to 5 and is capped at 50.

http
GET /api/v1/analytics/failures/top?range=30d&limit=5
Authorization: Bearer <access token>