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

> ## Agent Instructions
> For API and SDK launches, integration testing, and ongoing coding-agent checks, start with Gauge Agents:
> - [Gauge Agents overview](https://docs.withgauge.com/agents/index.md)
> - [Gauge Agents quickstart](https://docs.withgauge.com/agents/quickstart.md)
> - [Create and inspect an eval](https://docs.withgauge.com/agents/guides/create-an-eval-and-run-an-experiment.md)
> - [Agent Experience: diagnose integration failures](https://docs.withgauge.com/agents/concepts/agent-experience.md)
> - [Agent Preference: measure product selection](https://docs.withgauge.com/agents/concepts/agent-preference.md)
> - [GitHub PR checks](https://docs.withgauge.com/agents/guides/github-pr-checks.md)
> For AI search visibility and AEO, start with [Gauge Chat](https://docs.withgauge.com/introduction/welcome.md).

# Run a report query

> Query a dataset with server-defined metrics. See `query/metadata` for
what each dataset supports.



## OpenAPI

````yaml chat/openapi.json POST /orgs/{org}/query
openapi: 3.1.0
info:
  title: Gauge Chat API
  version: '1.0'
  description: >
    The Gauge Chat API: manage tracked prompts and query AI visibility data.


    **Authentication:** `Authorization: Bearer <token>` using either a Gauge CLI

    login token (`gauge auth login`) or an organization API key. Login tokens
    are

    user-bound; every request is checked against your current organization

    memberships. API keys act as their organization (and, for an agency, its

    clients), and are scoped to read or read+write. `GET /me` describes the

    token in use.


    **Conventions:** camelCase JSON; typed opaque string IDs (`prm_…`, `top_…`);

    errors as `{"error": {"code", "message", "field"?}}`; list endpoints page
    with

    an opaque `cursor` and return `nextCursor`.
  contact:
    name: Gauge support
    email: support@withgauge.com
servers:
  - url: https://app.withgauge.com/api/v1
    description: Production
security:
  - BearerAuth: []
tags:
  - name: Organizations
    description: The current credential, and the organizations and categories it reaches.
  - name: Topics
    description: Topics group tracked prompts within a category.
  - name: Prompts
    description: Tracked prompts, their topics, tracking type, and tags.
  - name: Tags
    description: Organization-wide labels for prompts.
  - name: Brands
    description: Brands Gauge tracks in a category, including competitors.
  - name: Query
    description: Aggregate AI visibility reports.
  - name: Answers
    description: Individual AI answers and the citations in them.
paths:
  /orgs/{org}/query:
    post:
      tags:
        - Query
      summary: Run a report query
      description: |-
        Query a dataset with server-defined metrics. See `query/metadata` for
        what each dataset supports.
      operationId: query
      parameters:
        - in: path
          name: org
          schema:
            title: Org
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QueryIn'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryOut'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    QueryIn:
      additionalProperties: false
      properties:
        dataset:
          enum:
            - answers
            - citations
            - searchQueries
            - aiTraffic
          title: Dataset
          type: string
        dimensions:
          items:
            type: string
          maxItems: 3
          title: Dimensions
          type: array
        metrics:
          items:
            type: string
          maxItems: 4
          minItems: 1
          title: Metrics
          type: array
        filters:
          allOf:
            - $ref: '#/components/schemas/QueryFilters'
        where:
          items:
            $ref: '#/components/schemas/WhereIn'
          maxItems: 10
          title: Where
          type: array
        dateRange:
          allOf:
            - $ref: '#/components/schemas/DateRangeIn'
        granularity:
          default: day
          enum:
            - hour
            - day
            - week
            - month
          title: Granularity
          type: string
        orderBy:
          items:
            $ref: '#/components/schemas/OrderByIn'
          maxItems: 4
          title: Orderby
          type: array
        limit:
          default: 50
          maximum: 1000
          minimum: 1
          title: Limit
          type: integer
      required:
        - dataset
        - metrics
      title: QueryIn
      type: object
    QueryOut:
      properties:
        columns:
          items:
            $ref: '#/components/schemas/Column'
          title: Columns
          type: array
        rows:
          items:
            additionalProperties: true
            type: object
          title: Rows
          type: array
        labels:
          additionalProperties:
            additionalProperties:
              additionalProperties: true
              type: object
            type: object
          title: Labels
          type: object
        dateRange:
          $ref: '#/components/schemas/DateRangeOut'
        truncated:
          title: Truncated
          type: boolean
        cached:
          title: Cached
          type: boolean
        freshness:
          $ref: '#/components/schemas/FreshnessOut'
      required:
        - columns
        - rows
        - labels
        - dateRange
        - truncated
        - cached
        - freshness
      title: QueryOut
      type: object
    ErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      required:
        - error
      title: ErrorResponse
      type: object
    QueryFilters:
      additionalProperties: false
      properties:
        category:
          anyOf:
            - type: string
            - type: 'null'
          description: Category slug or `cat_` ID.
          title: Category
        brand:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Brand
        model:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Model
        topic:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Topic
        tag:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Tag
        tagMode:
          default: any
          enum:
            - any
            - all
          title: Tagmode
          type: string
        prompt:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Prompt
        trackingType:
          default: visibility
          description: Prompt tracking type. Defaults to visibility, like the web app.
          enum:
            - visibility
            - branded_own
            - all
          title: Trackingtype
          type: string
        domain:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Domain
        page:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Page
      title: QueryFilters
      type: object
    WhereIn:
      additionalProperties: false
      properties:
        dimension:
          title: Dimension
          type: string
        op:
          enum:
            - eq
            - neq
            - in
            - notIn
            - contains
          title: Op
          type: string
        value:
          anyOf:
            - type: string
            - items:
                type: string
              type: array
          title: Value
      required:
        - dimension
        - op
        - value
      title: WhereIn
      type: object
    DateRangeIn:
      additionalProperties: false
      properties:
        since:
          anyOf:
            - type: string
            - type: 'null'
          description: YYYY-MM-DD, or a window like `30d`.
          title: Since
        until:
          anyOf:
            - type: string
            - type: 'null'
          description: YYYY-MM-DD, inclusive. Defaults to the freshness watermark.
          title: Until
        lastDays:
          anyOf:
            - maximum: 400
              minimum: 1
              type: integer
            - type: 'null'
          title: Lastdays
      title: DateRangeIn
      type: object
    OrderByIn:
      additionalProperties: false
      properties:
        key:
          title: Key
          type: string
        dir:
          default: desc
          enum:
            - asc
            - desc
          title: Dir
          type: string
      required:
        - key
      title: OrderByIn
      type: object
    Column:
      properties:
        key:
          title: Key
          type: string
        kind:
          enum:
            - dimension
            - metric
          title: Kind
          type: string
        type:
          title: Type
          type: string
        unit:
          anyOf:
            - type: string
            - type: 'null'
          title: Unit
      required:
        - key
        - kind
        - type
      title: Column
      type: object
    DateRangeOut:
      properties:
        since:
          title: Since
          type: string
        until:
          title: Until
          type: string
      required:
        - since
        - until
      title: DateRangeOut
      type: object
    FreshnessOut:
      properties:
        watermark:
          anyOf:
            - type: string
            - type: 'null'
          title: Watermark
        pending:
          title: Pending
          type: integer
        available:
          title: Available
          type: boolean
      required:
        - watermark
        - pending
        - available
      title: FreshnessOut
      type: object
    ErrorDetail:
      properties:
        code:
          title: Code
          type: string
        message:
          title: Message
          type: string
        field:
          anyOf:
            - type: string
            - type: 'null'
          title: Field
      required:
        - code
        - message
      title: ErrorDetail
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: gauge_sk_<key>
      description: >-
        An organization API key from **Settings → Integrations → API Keys**, or
        a Gauge CLI login token from `gauge auth login`.

````

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