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

# Query run logs

> Searches the log of one test run, filtering entries by kind, level, debug kind, turn or text, a page at a time. Each page also reports the log's total entry count and token use per model; send `nextOffset` back for the next page.



## OpenAPI

````yaml /specs-prettified/realtime/openapi.stable.json post /v1/stable/test-run/{runID}/logs
openapi: 3.0.0
info:
  title: Realtime
  description: Realtime gateway API service
  version: 1.0.0
  contact: {}
servers:
  - url: https://realtime-api.voiceflow.com
security: []
tags: []
paths:
  /v1/stable/test-run/{runID}/logs:
    post:
      tags:
        - Test Run
      summary: Query run logs
      description: Searches the log of one test run, filtering entries by kind, level,
        debug kind, turn or text, a page at a time. Each page also reports the
        log's total entry count and token use per model; send `nextOffset` back
        for the next page.
      operationId: StableTestRunController_queryLogs
      parameters:
        - name: runID
          required: true
          in: path
          schema:
            type: string
          x-vf-doc:
            description: The ID of the test run to operate on.
          description: The ID of the test run to operate on.
        - name: projectID
          required: true
          in: query
          schema:
            type: string
            description: The ID of the project to operate on.
        - name: environmentAlias
          required: true
          in: query
          schema:
            type: string
            description: The alias of the environment to operate on (e.g. `main`).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StableLogQueryRequest"
      responses:
        "200":
          description: Returns one page of the log entries that match the filters, with
            the counts for the whole log, the token use per model, and
            `nextOffset` for the next page (null on the last page).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StableLogQueryResponse"
          x-vf-doc:
            description: Returns one page of the log entries that match the filters, with
              the counts for the whole log, the token use per model, and
              `nextOffset` for the next page (null on the last page).
      security:
        - token: []
components:
  schemas:
    StableLogQueryRequest:
      type: object
      properties:
        kinds:
          description: Keep only entries of these kinds. Omit to keep every kind.
          minItems: 1
          maxItems: 5
          type: array
          items:
            $ref: "#/components/schemas/StableLogEntryKind"
        levels:
          description: Keep only entries at these levels, for example ["fatal", "error",
            "warn"] for what went wrong.
          minItems: 1
          maxItems: 5
          type: array
          items:
            $ref: "#/components/schemas/StableLogLevel"
        debugKinds:
          description: Keep only debug entries of these kinds. Setting it leaves out every
            entry that is not a debug log.
          minItems: 1
          maxItems: 8
          type: array
          items:
            $ref: "#/components/schemas/StableLogDebugKind"
        turns:
          description: Keep only entries of these turns. Turn 0 holds anything logged
            before the first input.
          minItems: 1
          maxItems: 100
          type: array
          items:
            type: integer
            minimum: 0
            maximum: 9007199254740991
        search:
          description: Keep only entries whose message or recorded data contains this
            text, ignoring case. It is plain text, not a regular expression.
            Separate alternatives with |, as in "timeout|denied", to keep
            entries that contain any of them.
          type: string
          minLength: 1
          maxLength: 256
        detail:
          default: summary
          allOf:
            - $ref: "#/components/schemas/StableLogDetail"
        limit:
          default: 50
          description: The most entries to return in one page.
          type: integer
          minimum: 1
          maximum: 200
        offset:
          default: 0
          description: How many matching entries to skip, for paging.
          type: integer
          minimum: 0
          maximum: 9007199254740991
        order:
          default: asc
          allOf:
            - $ref: "#/components/schemas/StableLogOrder"
      additionalProperties: false
    StableLogEntryKind:
      type: string
      enum:
        - user
        - agent
        - debug
        - check
        - system
      description: "user: what the user sent. agent: what the agent said or showed.
        debug: a runtime debug log. check: a test check result, test runs only.
        system: any other event, such as a block, a workflow or the end."
      x-enumNames:
        - USER
        - AGENT
        - DEBUG
        - CHECK
        - SYSTEM
    StableLogLevel:
      type: string
      enum:
        - fatal
        - error
        - warn
        - info
        - debug
      description: A debug log carries its own level. A failed check is error. Every
        other entry is info.
      x-enumNames:
        - FATAL
        - ERROR
        - WARN
        - INFO
        - DEBUG
    StableLogDebugKind:
      type: string
      enum:
        - llm
        - tokens
        - tool
        - agent
        - kb
        - variables
        - node
        - other
      description: "llm: a model call and its result. tokens: token and credit use of
        one model call. tool: a tool call or its result (functions, API tools,
        integrations, MCP tools). agent: an agent or playbook starting, ending
        or handing over. kb: a knowledge base search. variables: variable
        changes. node: a workflow step. other: anything else."
      x-enumNames:
        - LLM
        - TOKENS
        - TOOL
        - AGENT
        - KB
        - VARIABLES
        - NODE
        - OTHER
    StableLogDetail:
      type: string
      enum:
        - summary
        - full
      description: "summary: each entry with a one-line message and its small recorded
        values. full: also the entry as recorded, with strings cut at 4,000
        characters and lists at 50 items."
      x-enumNames:
        - SUMMARY
        - FULL
    StableLogOrder:
      type: string
      enum:
        - asc
        - desc
      description: "asc: oldest first. desc: newest first."
      x-enumNames:
        - ASC
        - DESC
    StableLogQueryResponse:
      type: object
      properties:
        total:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: Entries in the whole log.
        turnCount:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: The last turn the log reaches.
        counts:
          $ref: "#/components/schemas/StableLogCounts"
        tokens:
          type: array
          items:
            $ref: "#/components/schemas/StableLogTokenUsage"
          description: Token use per model over the whole log, largest first.
        matches:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: Entries that pass every filter.
        entries:
          type: array
          items:
            $ref: "#/components/schemas/StableLogEntry"
          description: This page of the matching entries.
        hasMore:
          type: boolean
        nextOffset:
          nullable: true
          description: The offset of the next page, or null when this page reaches the
            last match.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        truncated:
          type: boolean
          description: True when the page stopped before limit to stay under about 30,000
            tokens. Continue from nextOffset.
      required:
        - total
        - turnCount
        - counts
        - tokens
        - matches
        - entries
        - hasMore
        - nextOffset
        - truncated
    StableLogCounts:
      type: object
      properties:
        byKind:
          type: object
          properties:
            user:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            agent:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            debug:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            check:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            system:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
          required:
            - user
            - agent
            - debug
            - check
            - system
        byLevel:
          type: object
          properties:
            fatal:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            error:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            warn:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            info:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            debug:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
          required:
            - fatal
            - error
            - warn
            - info
            - debug
        byDebugKind:
          type: object
          properties:
            llm:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            tokens:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            tool:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            agent:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            kb:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            variables:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            node:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            other:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
          required:
            - llm
            - tokens
            - tool
            - agent
            - kb
            - variables
            - node
            - other
      required:
        - byKind
        - byLevel
        - byDebugKind
      description: How many entries of each kind, level and debug kind the whole log
        holds, before any filter.
    StableLogTokenUsage:
      type: object
      properties:
        model:
          type: string
        calls:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: Model calls that logged their token use.
        inputTokens:
          type: number
        outputTokens:
          type: number
        totalTokens:
          type: number
        credits:
          type: number
          description: Voiceflow credits the calls used, 0 when the log does not record
            them.
      required:
        - model
        - calls
        - inputTokens
        - outputTokens
        - totalTokens
        - credits
    StableLogEntry:
      type: object
      properties:
        index:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: Where the entry sits in the whole log, oldest first, from 0.
        turn:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: The turn of the entry. Each user input, a launch included, starts
            the next turn. Anything logged before the first input, such as a
            test run's greeting, is turn 0.
        time:
          type: string
          description: When the entry was logged, as an ISO 8601 timestamp.
        kind:
          $ref: "#/components/schemas/StableLogEntryKind"
        type:
          type: string
          description: The trace or request type as recorded, such as text, debug, launch
            or end.
        level:
          $ref: "#/components/schemas/StableLogLevel"
        debugKinds:
          description: Debug entries only. An entry can be of several kinds.
          type: array
          items:
            $ref: "#/components/schemas/StableLogDebugKind"
        source:
          description: "Debug entries only: the part of the runtime that logged it, such
            as Agent."
          type: string
        ref:
          allOf:
            - $ref: "#/components/schemas/StableLogEntryRef"
        message:
          type: string
          description: What happened, in one line of at most 500 characters.
        fields:
          description: Up to 24 small values recorded with the entry, such as model,
            tokens, latency, status or a variable before and after. Nested keys
            are joined with dots, and strings are cut at 200 characters.
          type: object
          additionalProperties:
            anyOf:
              - type: string
              - type: number
              - type: boolean
              - type: string
                nullable: true
                enum:
                  - null
        raw:
          description: "With detail full only: the entry as recorded, with strings cut at
            4,000 characters and lists at 50 items."
          type: object
          additionalProperties: {}
      required:
        - index
        - turn
        - time
        - kind
        - type
        - level
        - message
    StableLogEntryRef:
      type: object
      properties:
        type:
          type: string
          description: "What the entry is about: agent, function, api-tool,
            integration-tool, prompt or node."
        id:
          description: The ID of that agent, tool, prompt or workflow step.
          type: string
        name:
          description: Its name; for a workflow step, the name of its workflow.
          type: string
      required:
        - type
  securitySchemes:
    token:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: Voiceflow bearer token
````
