openapi: 3.2.0 info: title: APImetrics Browser 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: Browser Monitor Statistics description: Aggregate statistics for Browser Monitors paths: /api/3/monitors/browser/{monitor_id}/stats/performance: post: tags: - Browser Monitor Statistics summary: Aggregate performance metrics for a monitor over a window description: 'Aggregate performance metrics for a 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-browser-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___2' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/api3__monitors__common__api_models__PerformanceResponse_Metric___2' '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/browser/{monitor_id}/stats/resources: post: tags: - Browser Monitor Statistics summary: Aggregate resource-level data from `resource_requests` for a monitor description: 'Aggregate resource-level data from `resource_requests` for a browser monitor. Returns: - `by_type`: per-resource-type breakdown (count, size) suitable for a pie chart. - `third_party_timeseries`: 1st-party vs 3rd-party load time per interval bucket (empty when no `interval` is supplied).' operationId: query-browser-monitor-resources 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/ResourcesRequest' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/ResourcesResponse' '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/browser/{monitor_id}/stats/sessions: post: tags: - Browser Monitor Statistics summary: Query the top-N raw page_metrics rows sorted by the chosen metric description: 'Return the top-N raw page_metrics rows sorted by the chosen metric. Powers the "worst sessions" / "slowest sessions" list — each row carries the individual result''s CWV values, location, and result_id so the client can deep-link to the result detail view.' operationId: query-browser-monitor-sessions 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/SessionsRequest' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/SessionsResponse' '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/browser/stats/performance: post: tags: - Browser Monitor Statistics summary: Aggregate performance metrics across all browser monitors in the project description: 'Aggregate performance metrics across all browser 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-browser-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___2' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/api3__monitors__common__api_models__PerformanceResponse_Metric___2' '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/browser/stats/resources: post: tags: - Browser Monitor Statistics summary: Aggregate resource-level data across all browser monitors in the project description: 'Aggregate resource-level data from `resource_requests` across all browser monitors in the project. Returns: - `by_type`: per-resource-type breakdown (count, size) suitable for a pie chart. - `third_party_timeseries`: 1st-party vs 3rd-party load time per interval bucket (empty when no `interval` is supplied).' operationId: query-browser-resources 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/ResourcesRequest' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/ResourcesResponse' '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/browser/stats/sessions: post: tags: - Browser Monitor Statistics summary: Top-N raw page_metrics rows across all browser monitors in the project description: 'Return the top-N raw page_metrics rows across all browser monitors in the project, sorted by the chosen metric. Each row carries its originating `monitor_id` so callers can attribute sessions back to the monitor that produced them.' operationId: query-browser-sessions 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/SessionsRequest' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/SessionsResponse' '400': description: Invalid request parameters (e.g. `to` before `from`) '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' components: schemas: Measure: type: string enum: - mean - p50 - p90 - p95 - p99 title: Measure ResourcesRequest: 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 the third-party time series (ISO 8601 duration, e.g. PT1H, PT15M). Omitted = third_party_timeseries is empty. type: object required: - from - to title: ResourcesRequest SessionRow: properties: monitor_id: anyOf: - type: string - type: 'null' title: Monitor Id description: ID of the monitor this session belongs to. Populated on both per-monitor and project-wide queries so callers can attribute rows back to a monitor. result_id: type: string title: Result Id timestamp: type: string format: date-time title: Timestamp description: UTC Timestamp of the page test location_id: type: string title: Location Id browser: anyOf: - type: string - type: 'null' title: Browser url: anyOf: - type: string - type: 'null' title: Url result_category: anyOf: - $ref: '#/components/schemas/ResultCategory' - type: 'null' metrics: additionalProperties: anyOf: - type: number - type: 'null' propertyNames: $ref: '#/components/schemas/api3__monitors__browser__stats__api_models__Metric' type: object title: Metrics description: 'Per-metric value for this individual result (e.g. {lcp: 4500, fcp: 2100, cls: 0.14})' type: object required: - result_id - timestamp - location_id title: SessionRow 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).' SortOrder: type: string enum: - asc - desc title: SortOrder SessionsMeta: 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 sort_by: type: string title: Sort By order: type: string title: Order limit: type: integer title: Limit type: object required: - from - to - sort_by - order - limit title: SessionsMeta 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. ResourceTypeBreakdown: properties: resource_type: type: string title: Resource Type description: Resource type as reported by the browser agent (e.g. script, stylesheet, image, font, fetch, xhr, document) avg_per_page: anyOf: - type: number - type: 'null' title: Avg Per Page description: Mean count of this resource type per page load avg_size_bytes_per_page: anyOf: - type: number - type: 'null' title: Avg Size Bytes Per Page description: Mean total encoded body size of this resource type per page (bytes) total_count: type: integer title: Total Count description: Total number of resources of this type observed across all pages default: 0 type: object required: - resource_type title: ResourceTypeBreakdown api3__monitors__common__api_models__PerformanceResponse_Metric___2: properties: results: items: $ref: '#/components/schemas/api3__monitors__common__api_models__PerformanceGroup_Metric___2' type: array title: Results meta: $ref: '#/components/schemas/api3__monitors__common__api_models__PerformanceMeta_Metric___2' type: object required: - results - meta title: PerformanceResponse[Metric] SessionsSortBy: type: string enum: - lcp - fcp - cls - fid - ttfb - total - dns - tcp - tls - resources_count - page_weight - timestamp title: SessionsSortBy ThirdPartyBucket: properties: interval_start: type: string title: Interval Start description: UTC ISO timestamp of the bucket start first_party_avg_ms: anyOf: - type: number - type: 'null' title: First Party Avg Ms description: Mean total time per page spent loading first-party resources third_party_avg_ms: anyOf: - type: number - type: 'null' title: Third Party Avg Ms description: Mean total time per page spent loading third-party resources first_party_avg_count: anyOf: - type: number - type: 'null' title: First Party Avg Count description: Mean count of first-party resources per page in this bucket third_party_avg_count: anyOf: - type: number - type: 'null' title: Third Party Avg Count description: Mean count of third-party resources per page in this bucket type: object required: - interval_start title: ThirdPartyBucket api3__monitors__common__api_models__PerformanceGroup_Metric___2: 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__browser__stats__api_models__Metric' type: object title: Metrics type: object required: - key - sample_count - metrics title: PerformanceGroup[Metric] api3__monitors__browser__stats__api_models__Metric: type: string enum: - lcp - fcp - cls - fid - ttfb - total - dns - tcp - tls - request - response - dom_processing - dom_content_loaded - load_event_end - resources_count - page_weight title: Metric ResourcesMeta: 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 type: object required: - from - to title: ResourcesMeta ResourcesResponse: properties: results: items: $ref: '#/components/schemas/ResourceTypeBreakdown' type: array title: Results description: Per-resource-type breakdown across pages in the window third_party_timeseries: items: $ref: '#/components/schemas/ThirdPartyBucket' type: array title: Third Party Timeseries description: First-vs-third-party load-time series bucketed by the requested interval. Empty when no `interval` is supplied. meta: $ref: '#/components/schemas/ResourcesMeta' type: object required: - results - meta title: ResourcesResponse GroupByDimension: type: string enum: - location - interval - monitor title: GroupByDimension 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 api3__monitors__common__api_models__PerformanceRequest_Metric___2: 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__browser__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__browser__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] SessionsResponse: properties: results: items: $ref: '#/components/schemas/SessionRow' type: array title: Results meta: $ref: '#/components/schemas/SessionsMeta' type: object required: - results - meta title: SessionsResponse ResultCategory: type: string enum: - PASS - SLOW - WARNING - FAIL title: ResultCategory api3__monitors__common__api_models__PerformanceMeta_Metric___2: 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__browser__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] HTTPValidationError: properties: detail: items: $ref: '#/components/schemas/ValidationError' type: array title: Detail type: object title: HTTPValidationError SessionsRequest: 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) sort_by: $ref: '#/components/schemas/SessionsSortBy' description: Metric to sort by. default: lcp order: $ref: '#/components/schemas/SortOrder' description: Sort order. default: desc limit: type: integer maximum: 200.0 minimum: 1.0 title: Limit description: Maximum rows to return. default: 10 type: object required: - from - to title: SessionsRequest 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