> ## Documentation Index
> Fetch the complete documentation index at: https://www.kernel.sh/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Query reports

> Aggregate reports of one type, grouped by fields of their data. Results come from exported analytics data, which lags by about 75 minutes, so recently submitted reports may not be included yet. Tasks with no matching report do not appear, and with count_distinct a task can be counted in more than one group. A query that runs for more than 10 seconds returns 422 with code query_timeout. Requires tasks:read on the whole project.



## OpenAPI

````yaml https://api.onkernel.com/spec.json post /reports/query
openapi: 3.1.0
info:
  description: Developer tools and cloud infrastructure for AI agents to use web browsers
  title: Kernel API
  version: 0.1.0
servers:
  - description: API Server
    url: https://api.onkernel.com
security:
  - bearerAuth: []
tags:
  - description: Search the web and retrieve content for selected results.
    name: Search
  - description: Create and manage browser sessions.
    name: Browsers
  - description: Control mouse, keyboard, and screen on the browser instance.
    name: Browser Computer Controls
  - description: >-
      Execute Playwright code against the browser instance and manage the
      executors it runs in.
    name: Browser Playwright
  - description: Execute JavaScript in the browser instance's persistent Browser REPL.
    name: Browser REPL
  - description: Discover and invoke native page tools across the browser instance.
    name: Browser WebMCP
  - description: Read, write, and manage files on the browser instance.
    name: Browser Filesystem
  - description: Execute and manage processes on the browser instance.
    name: Browser Processes
  - description: Record and manage browser session video replays.
    name: Browser Replays
  - description: Stream logs from the browser instance.
    name: Browser Logs
  - description: >-
      Stream live telemetry events from a browser session, and manage the
      destinations sessions export them to.
    name: Browser Telemetry
  - description: Create, list, retrieve, and delete browser profiles.
    name: Profiles
  - description: Define tasks that agents work toward and link the browsers they use.
    name: Tasks
  - description: Discover report types and submit typed reports against tasks.
    name: Reports
  - description: Create and manage proxy configurations for routing browser traffic.
    name: Proxies
  - description: Create, list, retrieve, and delete browser extensions.
    name: Extensions
  - description: Create and manage browser pools for acquiring and releasing browsers.
    name: Browser Pools
  - description: Inspect the identity and authorization context for the current request.
    name: Authentication
  - description: >-
      Create and manage auth connections for automated credential capture and
      login.
    name: Managed Auth
  - description: Create and manage credentials for authentication.
    name: Credentials
  - description: Configure external credential providers like 1Password.
    name: Credential Providers
  - description: List applications and versions.
    name: Apps
  - description: Create and manage app deployments and stream deployment events.
    name: Deployments
  - description: Invoke actions and stream or query invocation status and events.
    name: Invocations
  - description: Read and manage organization-level limits.
    name: Organization
  - description: Create and manage projects for resource isolation within an organization.
    name: Projects
  - description: Create and manage API keys for organization and project-scoped access.
    name: API Keys
  - description: Read audit log records for the authenticated organization.
    name: Audit Logs
  - description: Resolve browser and proxy recommendations for bot-protected sites.
    name: Config Registry
paths:
  /reports/query:
    post:
      tags:
        - Reports
      summary: Query reports
      description: >-
        Aggregate reports of one type, grouped by fields of their data. Results
        come from exported analytics data, which lags by about 75 minutes, so
        recently submitted reports may not be included yet. Tasks with no
        matching report do not appear, and with count_distinct a task can be
        counted in more than one group. A query that runs for more than 10
        seconds returns 422 with code query_timeout. Requires tasks:read on the
        whole project.
      operationId: postReportsQuery
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QueryReportsRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryReportsResponse'
          description: Groups, largest value first
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - bearerAuth: []
components:
  schemas:
    QueryReportsRequest:
      additionalProperties: false
      description: An aggregation over reports of one type.
      properties:
        aggregate:
          $ref: '#/components/schemas/ReportQueryAggregate'
        filters:
          additionalProperties:
            oneOf:
              - type: string
              - type: number
              - type: boolean
          description: >-
            Exact matches on fields of the report data, keyed by field, such as
            {"data.site":"booking.com"}. Reports without the field do not match.
          maxProperties: 10
          type: object
        group_by:
          description: >-
            Fields of the report data to group by, such as data.symptom. Enums,
            numbers, booleans and strings of at most 255 characters can be
            grouped by. A report without a field groups under null.
          example:
            - data.symptom
          items:
            pattern: ^data(\.[A-Za-z0-9_]+)+$
            type: string
          maxItems: 3
          minItems: 1
          type: array
        limit:
          default: 100
          description: Maximum number of groups to return, largest value first.
          maximum: 1000
          minimum: 1
          type: integer
        occurred_after:
          description: Include reports that occurred at or after this time.
          format: date-time
          type: string
        occurred_before:
          description: >-
            Include reports that occurred before this time. At most 30 days
            after occurred_after.
          format: date-time
          type: string
        schema_version:
          description: >-
            Schema version to query. Fields are checked against this version's
            schema and only reports submitted with it are included. Defaults to
            the type's latest version.
          minimum: 1
          type: integer
        task_filter:
          $ref: '#/components/schemas/ReportQueryTaskFilter'
        type:
          description: Report type to query.
          example: bot_detection.observation
          maxLength: 128
          minLength: 1
          type: string
      required:
        - type
        - group_by
        - aggregate
        - occurred_after
        - occurred_before
      type: object
    QueryReportsResponse:
      properties:
        groups:
          items:
            $ref: '#/components/schemas/ReportQueryGroup'
          type: array
      required:
        - groups
      type: object
    ReportQueryAggregate:
      additionalProperties: false
      description: The value computed for each group.
      properties:
        field:
          description: >-
            Optional for count, where it can only be id. task_id for
            count_distinct, or a numeric data field such as
            data.expected_amount.minor_units for sum and avg.
          type: string
        operation:
          description: >-
            count counts reports; count_distinct counts distinct task_id values;
            sum and avg aggregate a numeric field of the report data, leaving
            out reports without it.
          enum:
            - count
            - count_distinct
            - sum
            - avg
          type: string
      required:
        - operation
      type: object
    ReportQueryTaskFilter:
      additionalProperties: false
      description: Only include reports whose task matches every filter given.
      properties:
        browser_ids:
          description: Only tasks linked to at least one of these browsers.
          items:
            minLength: 1
            type: string
          maxItems: 100
          type: array
        metadata:
          additionalProperties:
            type: string
          description: Task metadata entries the task must have, with these exact values.
          maxProperties: 20
          type: object
        started_after:
          description: Only tasks that started at or after this time.
          format: date-time
          type: string
        started_before:
          description: Only tasks that started before this time.
          format: date-time
          type: string
      type: object
    ReportQueryGroup:
      properties:
        key:
          additionalProperties: true
          description: >-
            Value of each group_by field for this group, such as
            {"data.symptom":"captcha"}; null when reports lack the field.
          type: object
        value:
          description: The aggregate for this group.
          format: double
          type: number
      required:
        - key
        - value
      type: object
    Error:
      properties:
        code:
          description: Application-specific error code (machine-readable)
          example: bad_request
          type: string
        details:
          description: Additional error details (for multiple errors)
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
        inner_error:
          $ref: '#/components/schemas/ErrorDetail'
        message:
          description: Human-readable error description for debugging
          example: 'Missing required field: app_name'
          type: string
        unsupported_fields:
          description: >-
            Request fields that are incompatible with the requested browser
            platform.
          items:
            type: string
          type: array
      required:
        - code
        - message
      type: object
    ErrorDetail:
      properties:
        code:
          description: Lower-level error code providing more specific detail
          example: invalid_input
          type: string
        message:
          description: Further detail about the error
          example: Provided version string is not semver compliant
          type: string
      type: object
  responses:
    BadRequest:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Bad Request – invalid input
    Unauthorized:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Unauthorized – missing or invalid authorization token
    Forbidden:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Forbidden – insufficient permissions or plan
    UnprocessableEntity:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Unprocessable Entity – request was valid but the operation failed
    TooManyRequests:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Too Many Requests – rate limit exceeded
      headers:
        Retry-After:
          description: Seconds to wait before retrying
          schema:
            type: integer
    InternalError:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Internal Server Error
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.