openapi: 3.2.0 info: title: APImetrics API Monitor Statistics API description: API for the APImetrics platform termsOfService: http://apimetrics.io/tos/ contact: name: APIContext Support url: https://apicontext.io/ email: support@apicontext.com license: name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0.html version: v2026-09-02 tags: - name: API Monitor Statistics description: Aggregate statistics for API Monitors paths: /api/3/monitors/api/{monitor_id}/stats/performance: post: tags: - API Monitor Statistics summary: Aggregate performance metrics for an API monitor over a window description: 'Aggregate performance metrics for an API monitor over a window. Returns the requested measures (e.g. mean, p50, p90) per metric, optionally grouped by location and/or time bucket.' operationId: query-api-monitor-performance security: - OAuth2: [] - ApiKey: [] parameters: - name: monitor_id in: path required: true schema: type: string pattern: ^[A-Za-z0-9_-]+$ title: Monitor ID - name: apimetrics-project-id in: header required: false schema: anyOf: - type: string - type: 'null' title: Apimetrics-Project-Id requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/api3__monitors__common__api_models__PerformanceRequest_Metric___1' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/api3__monitors__common__api_models__PerformanceResponse_Metric___1' '400': description: Invalid request parameters (e.g. `to` before `from`) '403': description: Monitor not owned by this project '404': description: Monitor not found '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /api/3/monitors/api/{monitor_id}/stats/dns-diagnostics: post: tags: - API Monitor Statistics summary: DNS diagnostics for an API monitor over a window description: 'Aggregate DNS diagnostics for an API monitor over a window. Returns a breakdown of observed DNS providers, resolved IPs, CNAME chains, NS servers, and mean lookup time, optionally grouped by location and/or time bucket.' operationId: query-api-monitor-dns-diagnostics security: - OAuth2: [] - ApiKey: [] parameters: - name: monitor_id in: path required: true schema: type: string pattern: ^[A-Za-z0-9_-]+$ title: Monitor ID - name: apimetrics-project-id in: header required: false schema: anyOf: - type: string - type: 'null' title: Apimetrics-Project-Id requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/DnsRequest' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/DnsDiagnosticsResponse' '400': description: Invalid request parameters (e.g. `to` before `from`) '403': description: Monitor not owned by this project '404': description: Monitor not found '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /api/3/monitors/api/stats/performance: post: tags: - API Monitor Statistics summary: Aggregate performance metrics across all API monitors in the project description: 'Aggregate performance metrics across all API monitors in the project. Pair with `group_by=monitor` to get one PerformanceGroup per monitor; with `group_by=monitor,interval` for per-monitor time-series. Without a `monitor` grouping, results are a single project-wide aggregate.' operationId: query-api-performance security: - OAuth2: [] - ApiKey: [] parameters: - name: apimetrics-project-id in: header required: false schema: anyOf: - type: string - type: 'null' title: Apimetrics-Project-Id requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/api3__monitors__common__api_models__PerformanceRequest_Metric___1' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/api3__monitors__common__api_models__PerformanceResponse_Metric___1' '400': description: Invalid request parameters (e.g. `to` before `from`) '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /api/3/monitors/api/stats/dns-diagnostics: post: tags: - API Monitor Statistics summary: DNS diagnostics across all API monitors in the project description: 'Aggregate DNS diagnostics across all API monitors in the project. Returns a breakdown of observed DNS providers, resolved IPs, CNAME chains, NS servers, and mean lookup time, optionally grouped by location and/or time bucket.' operationId: query-api-dns-diagnostics security: - OAuth2: [] - ApiKey: [] parameters: - name: apimetrics-project-id in: header required: false schema: anyOf: - type: string - type: 'null' title: Apimetrics-Project-Id requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/DnsRequest' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/DnsDiagnosticsResponse' '400': description: Invalid request parameters (e.g. `to` before `from`) '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' components: schemas: DiagnosticsGroup: properties: key: $ref: '#/components/schemas/GroupKey' sample_count: type: integer title: Sample Count description: Total results in this group dns_sample_count: type: integer title: Dns Sample Count description: Results with DNS metadata present top_location_id: anyOf: - type: string - type: 'null' title: Top Location Id description: Location with the most samples in this group fqdns: items: type: string type: array title: Fqdns description: Most frequently observed FQDNs registrars: items: type: string type: array title: Registrars description: Most frequently observed domain registrars dns_providers: items: type: string type: array title: Dns Providers description: Most frequently observed DNS resolver providers (by domain name) tlds: items: type: string type: array title: Tlds description: Most frequently observed TLDs a_records: items: $ref: '#/components/schemas/RecordCount' type: array title: A Records description: A record IPs observed, with per-record counts, most frequent first cname_records: items: $ref: '#/components/schemas/RecordCount' type: array title: Cname Records description: CNAME values observed, with per-record counts, most frequent first ns_servers: items: $ref: '#/components/schemas/RecordCount' type: array title: Ns Servers description: NS servers observed, with per-record counts, most frequent first namelookup_mean_ms: anyOf: - type: number - type: 'null' title: Namelookup Mean Ms description: Mean DNS lookup time in milliseconds (null when no timed samples present) type: object required: - key - sample_count - dns_sample_count - fqdns - registrars - dns_providers - tlds - a_records - cname_records - ns_servers title: DiagnosticsGroup GroupKey: properties: location_id: anyOf: - type: string - type: 'null' title: Location Id interval_start: anyOf: - type: string - type: 'null' title: Interval Start description: UTC ISO timestamp of the bucket start when interval grouping is in use monitor_id: anyOf: - type: string - type: 'null' title: Monitor Id description: Monitor ID when monitor grouping is in use type: object title: GroupKey description: 'Identifies which slice of data this group represents. Fields are present only when the request asked to group by that dimension (or, for `interval_start`, when an interval was requested).' api3__monitors__api__stats__api_models__Metric: type: string enum: - total - dns - connect - tls - ttfb - response title: Metric Measure: type: string enum: - mean - p50 - p90 - p95 - p99 title: Measure DnsDiagnosticsMeta: properties: monitor_id: anyOf: - type: string - type: 'null' title: Monitor Id from: type: string format: date-time title: From to: type: string format: date-time title: To interval: anyOf: - type: string format: duration - type: 'null' title: Interval group_by: items: $ref: '#/components/schemas/GroupByDimension' type: array title: Group By type: object required: - monitor_id - from - to - interval - group_by title: DnsDiagnosticsMeta ResultCategory: type: string enum: - PASS - SLOW - WARNING - FAIL title: ResultCategory api3__monitors__common__api_models__PerformanceRequest_Metric___1: properties: from: type: string format: date-time title: From description: Window start (UTC ISO timestamp, inclusive) to: type: string format: date-time title: To description: Window end (UTC ISO timestamp, exclusive) interval: anyOf: - type: string format: duration - type: 'null' title: Interval description: Bucket size for time-series grouping (ISO 8601 duration, e.g. PT1H, PT15M). Omitted = single bucket over the whole window. metrics: anyOf: - items: $ref: '#/components/schemas/api3__monitors__api__stats__api_models__Metric' type: array - type: 'null' title: Metrics description: Metrics to aggregate. Defaults to the monitor type's standard set. measures: anyOf: - items: $ref: '#/components/schemas/Measure' type: array - type: 'null' title: Measures description: Statistical measures to return per metric (e.g. mean, p50, p90). Defaults to mean, p50, p90, p95, p99. group_by: items: $ref: '#/components/schemas/GroupByDimension' type: array title: Group By description: Dimensions to group results by. locations: items: type: string type: array title: Locations description: Restrict to these location IDs. Empty = all locations. status: items: $ref: '#/components/schemas/ResultCategory' type: array title: Status description: Restrict to these result categories. Empty = all categories. poor_thresholds: additionalProperties: type: number minimum: 0.0 propertyNames: $ref: '#/components/schemas/api3__monitors__api__stats__api_models__Metric' type: object title: Poor Thresholds description: Per-metric threshold values. When supplied, the response includes a poor_count for each matching metric counting samples whose value exceeds the threshold. type: object required: - from - to title: PerformanceRequest[Metric] DnsRequest: properties: from: type: string format: date-time title: From description: Window start (UTC ISO timestamp, inclusive) to: type: string format: date-time title: To description: Window end (UTC ISO timestamp, exclusive) interval: anyOf: - type: string format: duration - type: 'null' title: Interval description: Bucket size for time-series grouping (ISO 8601 duration, e.g. PT1H). Omitted = single bucket over the whole window. group_by: items: $ref: '#/components/schemas/GroupByDimension' type: array title: Group By description: Dimensions to group results by. locations: items: type: string type: array title: Locations description: Restrict to these location IDs. Empty = all locations. status: items: $ref: '#/components/schemas/ResultCategory' type: array title: Status description: Restrict to these result categories. Empty = all categories. type: object required: - from - to title: DnsRequest MetricAggregate: properties: sample_count: type: integer title: Sample Count description: Number of samples with a measured value for this metric mean: anyOf: - type: number - type: 'null' title: Mean description: Arithmetic mean p50: anyOf: - type: number - type: 'null' title: P50 description: 50th percentile (median) p75: anyOf: - type: number - type: 'null' title: P75 description: 75th percentile p90: anyOf: - type: number - type: 'null' title: P90 description: 90th percentile p95: anyOf: - type: number - type: 'null' title: P95 description: 95th percentile p99: anyOf: - type: number - type: 'null' title: P99 description: 99th percentile p999: anyOf: - type: number - type: 'null' title: P999 description: 99.9th percentile poor_count: anyOf: - type: integer - type: 'null' title: Poor Count description: Number of samples whose value is worse than the poor threshold supplied via the `poor_thresholds` query param. Null when no threshold was supplied for this metric. type: object required: - sample_count title: MetricAggregate description: Aggregates for one metric within one result group. RecordCount: properties: record: type: string title: Record description: DNS record value (IP, hostname, etc.) count: type: integer title: Count description: Number of results in which this record was observed type: object required: - record - count title: RecordCount api3__monitors__common__api_models__PerformanceGroup_Metric___1: properties: key: $ref: '#/components/schemas/GroupKey' sample_count: type: integer title: Sample Count description: Total samples in this group pass_count: type: integer title: Pass Count description: Samples whose result_category is PASS or SLOW default: 0 top_location_id: anyOf: - type: string - type: 'null' title: Top Location Id description: Location_id with the most samples in this group; useful when the client isn't grouping by location but still needs an agent for display metrics: additionalProperties: $ref: '#/components/schemas/MetricAggregate' propertyNames: $ref: '#/components/schemas/api3__monitors__api__stats__api_models__Metric' type: object title: Metrics type: object required: - key - sample_count - metrics title: PerformanceGroup[Metric] HTTPValidationError: properties: detail: items: $ref: '#/components/schemas/ValidationError' type: array title: Detail type: object title: HTTPValidationError api3__monitors__common__api_models__PerformanceResponse_Metric___1: properties: results: items: $ref: '#/components/schemas/api3__monitors__common__api_models__PerformanceGroup_Metric___1' type: array title: Results meta: $ref: '#/components/schemas/api3__monitors__common__api_models__PerformanceMeta_Metric___1' type: object required: - results - meta title: PerformanceResponse[Metric] api3__monitors__common__api_models__PerformanceMeta_Metric___1: properties: monitor_id: anyOf: - type: string - type: 'null' title: Monitor Id from: type: string format: date-time title: From description: UTC ISO timestamp, inclusive to: type: string format: date-time title: To description: UTC ISO timestamp, exclusive interval: anyOf: - type: string format: duration - type: 'null' title: Interval metrics: items: $ref: '#/components/schemas/api3__monitors__api__stats__api_models__Metric' type: array title: Metrics measures: items: $ref: '#/components/schemas/Measure' type: array title: Measures group_by: items: $ref: '#/components/schemas/GroupByDimension' type: array title: Group By type: object required: - from - to - interval - metrics - measures - group_by title: PerformanceMeta[Metric] GroupByDimension: type: string enum: - location - interval - monitor title: GroupByDimension DnsDiagnosticsResponse: properties: results: items: $ref: '#/components/schemas/DiagnosticsGroup' type: array title: Results meta: $ref: '#/components/schemas/DnsDiagnosticsMeta' type: object required: - results - meta title: DnsDiagnosticsResponse ValidationError: properties: loc: items: anyOf: - type: string - type: integer type: array title: Location msg: type: string title: Message type: type: string title: Error Type input: title: Input ctx: type: object title: Context type: object required: - loc - msg - type title: ValidationError securitySchemes: OAuth2: type: oauth2 flows: authorizationCode: scopes: openid: OpenID Connect identity profile: User profile email: User email address authorizationUrl: https://auth.apimetrics.io/authorize?audience=https://client.apimetrics.io tokenUrl: https://auth.apimetrics.io/oauth/token ApiKey: type: apiKey in: header name: X-Api-Key