{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/getmattered/json-schema/getmattered-analytics-response-schema.json",
  "title": "AnalyticsResponse",
  "description": "Successful API response",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/getmattered-analytics-api-openapi.yml#/components/schemas/AnalyticsResponse",
  "type": "object",
  "properties": {
    "data": {
      "$ref": "#/$defs/AnalyticsData"
    },
    "meta": {
      "$ref": "#/$defs/ResponseMetadata"
    },
    "success": {
      "type": "boolean",
      "enum": [
        true
      ]
    }
  },
  "required": [
    "data",
    "success"
  ],
  "additionalProperties": false,
  "$defs": {
    "AnalyticsData": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "atsScoreDistribution": {
          "type": "object",
          "properties": {
            "excellent": {
              "type": "integer",
              "description": "Scores >= 80"
            },
            "fair": {
              "type": "integer",
              "description": "Scores >= 40 and < 60"
            },
            "good": {
              "type": "integer",
              "description": "Scores >= 60 and < 80"
            },
            "poor": {
              "type": "integer",
              "description": "Scores < 40"
            }
          },
          "required": [
            "excellent",
            "fair",
            "good",
            "poor"
          ],
          "additionalProperties": false,
          "description": "ATS score distribution across 4 buckets"
        },
        "avgAtsScore": {
          "type": [
            "number",
            "null"
          ],
          "description": "Average ATS score across all scored jobs"
        },
        "dailyAnswers": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DailyApplication"
          },
          "description": "Employer-confirmed answers per day for the last 14 days"
        },
        "dailyApplications": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DailyApplication"
          },
          "description": "Application counts per day for the last 14 days"
        },
        "matchQualityByWeek": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MatchQualityWeek"
          },
          "description": "Roles scored for this user per ISO week over the last 8 weeks, split into quality bands. Weeks with no supply are omitted."
        },
        "monthlyApplications": {
          "type": "integer",
          "description": "Jobs applied this month"
        },
        "outcomes": {
          "allOf": [
            {
              "$ref": "#/$defs/OutcomeMetrics"
            },
            {
              "description": "Real-outcome success metrics from the email + calendar pipeline."
            }
          ]
        },
        "previousWeekApplications": {
          "type": "integer",
          "description": "Jobs applied 14-7 days ago for trend comparison"
        },
        "recentActivity": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "company": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "companyDomain": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Trusted company-intel domain (company.domain) for the FE logo favicon fallback"
              },
              "companyLogoUrl": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Company logo URL (company-intel R2 logo, falling back to the scraped snapshot)"
              },
              "id": {
                "type": "integer"
              },
              "status": {
                "type": "string",
                "enum": [
                  "saved",
                  "preparing",
                  "applied",
                  "interviewing",
                  "offered",
                  "rejected",
                  "archived"
                ],
                "description": "Status of a job listing"
              },
              "title": {
                "type": "string"
              },
              "updatedAt": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "company",
              "companyDomain",
              "companyLogoUrl",
              "id",
              "status",
              "title",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "responseRate": {
          "type": "number",
          "description": "Percentage of applied jobs with response"
        },
        "statusCounts": {
          "type": "object",
          "properties": {
            "applied": {
              "type": "integer"
            },
            "archived": {
              "type": "integer"
            },
            "interviewing": {
              "type": "integer"
            },
            "offered": {
              "type": "integer"
            },
            "preparing": {
              "type": "integer"
            },
            "rejected": {
              "type": "integer"
            },
            "saved": {
              "type": "integer"
            }
          },
          "required": [
            "applied",
            "archived",
            "interviewing",
            "offered",
            "preparing",
            "rejected",
            "saved"
          ],
          "additionalProperties": false
        },
        "topCompanies": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "company": {
                "type": "string"
              },
              "companyDomain": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Trusted company-intel domain (company.domain) for the FE logo favicon fallback"
              },
              "companyLogoUrl": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Company logo URL"
              },
              "count": {
                "type": "integer"
              },
              "recentJobTitle": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Most recent job title at this company"
              }
            },
            "required": [
              "company",
              "companyDomain",
              "companyLogoUrl",
              "count",
              "recentJobTitle"
            ],
            "additionalProperties": false
          },
          "description": "Most applied-to companies with recent job title"
        },
        "totalJobs": {
          "type": "integer"
        },
        "unactionedHighMatches": {
          "type": "integer",
          "description": "Roles scored 80+ that the user has neither dismissed nor applied to. The one figure on the analytics screen that names a next action."
        },
        "weeklyApplications": {
          "type": "integer",
          "description": "Jobs applied this week"
        }
      },
      "required": [
        "atsScoreDistribution",
        "avgAtsScore",
        "dailyAnswers",
        "dailyApplications",
        "matchQualityByWeek",
        "monthlyApplications",
        "outcomes",
        "previousWeekApplications",
        "recentActivity",
        "responseRate",
        "statusCounts",
        "topCompanies",
        "totalJobs",
        "unactionedHighMatches",
        "weeklyApplications"
      ]
    },
    "DailyApplication": {
      "type": "object",
      "properties": {
        "count": {
          "type": "integer"
        },
        "date": {
          "type": "string",
          "description": "Date in YYYY-MM-DD format"
        }
      },
      "required": [
        "count",
        "date"
      ],
      "additionalProperties": false
    },
    "MatchQualityWeek": {
      "type": "object",
      "properties": {
        "excellent": {
          "type": "integer",
          "description": "Roles scored 90 or above"
        },
        "fair": {
          "type": "integer",
          "description": "Roles scored 60 to 79"
        },
        "strong": {
          "type": "integer",
          "description": "Roles scored 80 to 89"
        },
        "week": {
          "type": "string",
          "description": "ISO year-week key, e.g. 2026-31"
        }
      },
      "required": [
        "excellent",
        "fair",
        "strong",
        "week"
      ],
      "additionalProperties": false
    },
    "OutcomeMetrics": {
      "type": "object",
      "properties": {
        "emailResponseRate": {
          "type": "number",
          "description": "Share of classified inbound job emails that carry a positive signal (interview / scheduling / offer), as a percentage. 0 when no emails are classified."
        },
        "interviewsBooked": {
          "type": "integer",
          "description": "Applications that reached an interview-booked outcome (stage phone_screen/interview, or interview_booked_at set)."
        },
        "nextInterviewResultId": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Application-result id behind the SOONEST upcoming interview event, for the applications deep-link. Null when that event has no application behind it; absent on payloads that do not resolve it."
        },
        "offers": {
          "type": "integer",
          "description": "Applications with an offer outcome (applicationStage = offered)."
        },
        "positiveEmailSignals": {
          "type": "integer",
          "description": "Count of inbound emails classified as a positive signal (interview_invite / scheduling / reschedule / offer_letter)."
        },
        "upcomingInterviews": {
          "type": "integer",
          "description": "Synced calendar events flagged as interviews whose start time is in the future."
        }
      },
      "required": [
        "emailResponseRate",
        "interviewsBooked",
        "offers",
        "positiveEmailSignals",
        "upcomingInterviews"
      ],
      "additionalProperties": false,
      "description": "Real-outcome success metrics from the email + calendar pipeline (interviews booked, offers, upcoming interviews, email response rate)."
    },
    "ResponseMetadata": {
      "type": "object",
      "properties": {
        "duration": {
          "type": "number",
          "minimum": 0,
          "description": "Request duration in milliseconds"
        },
        "performance": {
          "type": "object",
          "properties": {
            "dbQueries": {
              "type": "integer",
              "minimum": 0
            },
            "totalDbTime": {
              "type": "number",
              "minimum": 0
            }
          },
          "description": "Performance metrics (preview/local only)"
        },
        "requestId": {
          "type": "string",
          "description": "Unique request identifier"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 timestamp"
        },
        "version": {
          "type": "string",
          "description": "API version"
        }
      }
    }
  }
}