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

# Search logs in a log repository

> Search logs in a log repository



## OpenAPI

````yaml /public-apis/openapi/log-repositories.json post /v1/log-repositories/logs/search
openapi: 3.0.0
info:
  version: 1.0.0
  contact:
    name: Maxim Engineering
    email: eng@getmaxim.ai
  title: Maxim SDK API - log-repositories
  description: API documentation for Maxim SDK log-repositories endpoints
servers:
  - url: https://api.getmaxim.ai
security: []
paths:
  /v1/log-repositories/logs/search:
    post:
      tags:
        - Log repository
      summary: Search logs in a log repository
      description: Search logs in a log repository
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                workspaceId:
                  type: string
                  description: Unique identifier for the workspace
                id:
                  type: string
                  description: Log repository ID
                type:
                  type: string
                  enum:
                    - session
                    - trace
                  description: Type of logs to retrieve (session or trace)
                timestamp:
                  type: object
                  properties:
                    gte:
                      type: string
                      nullable: true
                      description: >-
                        Start timestamp for filtering logs in UTC format (e.g.,
                        2024-01-01T00:00:00Z)
                    lte:
                      type: string
                      nullable: true
                      description: >-
                        End timestamp for filtering logs in UTC format (e.g.,
                        2024-01-31T23:59:59Z)
                  description: >-
                    Timestamp range for filtering logs eg: { gte:
                    '2024-01-01T00:00:00Z', lte: '2024-01-31T23:59:59Z' }
                sessionId:
                  type: string
                  description: Filter logs by session ID
                searchQuery:
                  type: string
                  description: Search query to filter logs
                traceFilters:
                  type: object
                  properties:
                    combinator:
                      type: string
                      enum:
                        - all
                        - any
                      description: >-
                        Determines how multiple filters are combined - either
                        ALL must match or ANY must match
                    filters:
                      type: array
                      items:
                        oneOf:
                          - type: object
                            properties:
                              columnName:
                                type: string
                                enum:
                                  - tags
                                description: Filter by trace tags (key-value pairs)
                              operator:
                                type: string
                                enum:
                                  - equal
                                  - not_equal
                              value:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    key:
                                      type: string
                                    value:
                                      type: string
                                  required:
                                    - key
                                    - value
                            required:
                              - columnName
                              - operator
                              - value
                          - type: object
                            properties:
                              columnName:
                                type: string
                                enum:
                                  - traceId
                                description: ' Filter by unique trace identifier'
                              operator:
                                type: string
                                enum:
                                  - '='
                              value:
                                type: string
                            required:
                              - columnName
                              - operator
                              - value
                          - type: object
                            properties:
                              columnName:
                                type: string
                                enum:
                                  - isError
                                description: ' Filter by error status'
                              operator:
                                type: string
                                enum:
                                  - '='
                                  - '!='
                              value:
                                type: string
                            required:
                              - columnName
                              - operator
                              - value
                          - type: object
                            properties:
                              columnName:
                                type: string
                                enum:
                                  - models
                                description: Filter by AI models used
                              operator:
                                type: string
                                enum:
                                  - '='
                                  - '!='
                                  - in
                                  - not_in
                              value:
                                type: string
                            required:
                              - columnName
                              - operator
                              - value
                          - type: object
                            properties:
                              columnName:
                                type: string
                                enum:
                                  - tokens
                                description: ' Filter by token usage '
                              operator:
                                type: string
                                enum:
                                  - '='
                                  - '!='
                                  - '>'
                                  - <
                                  - '>='
                                  - <=
                              value:
                                type: number
                            required:
                              - columnName
                              - operator
                              - value
                          - type: object
                            properties:
                              columnName:
                                type: string
                                enum:
                                  - cost
                                description: 'Filter by cost '
                              operator:
                                type: string
                                enum:
                                  - '='
                                  - '!='
                                  - '>'
                                  - <
                                  - '>='
                                  - <=
                              value:
                                type: number
                            required:
                              - columnName
                              - operator
                              - value
                          - type: object
                            properties:
                              columnName:
                                type: string
                                enum:
                                  - latency
                                description: Filter by latency/response time
                              operator:
                                type: string
                                enum:
                                  - '='
                                  - '!='
                                  - '>'
                                  - <
                                  - '>='
                                  - <=
                              value:
                                type: number
                            required:
                              - columnName
                              - operator
                              - value
                          - type: object
                            properties:
                              columnName:
                                type: string
                                enum:
                                  - userFeedback
                                description: Filter by user feedback score
                              operator:
                                type: string
                                enum:
                                  - '='
                                  - '!='
                                  - '>'
                                  - <
                                  - '>='
                                  - <=
                              value:
                                type: number
                            required:
                              - columnName
                              - operator
                              - value
                  required:
                    - combinator
                    - filters
                  description: Trace properties to filter on
                evaluatorFilters:
                  type: object
                  properties:
                    combinator:
                      type: string
                      enum:
                        - all
                        - any
                      description: >-
                        Determines how multiple evaluator filters are combined -
                        either ALL must match or ANY must match 
                    filters:
                      type: array
                      items:
                        oneOf:
                          - type: object
                            properties:
                              evaluatorName:
                                type: string
                              operator:
                                type: string
                                enum:
                                  - 'null'
                                  - notNull
                              value:
                                nullable: true
                            required:
                              - evaluatorName
                              - operator
                          - type: object
                            properties:
                              evaluatorName:
                                type: string
                              operator:
                                type: string
                                enum:
                                  - '='
                                  - '!='
                                  - '>'
                                  - <
                                  - '>='
                                  - <=
                              value:
                                anyOf:
                                  - type: string
                                  - type: number
                            required:
                              - evaluatorName
                              - operator
                              - value
                          - type: object
                            properties:
                              evaluatorName:
                                type: string
                              operator:
                                type: string
                                enum:
                                  - is
                              value:
                                type: string
                                enum:
                                  - pass
                                  - fail
                                  - Err
                                  - NA
                            required:
                              - evaluatorName
                              - operator
                              - value
                  required:
                    - combinator
                    - filters
                  description: Evaluator metrics to be filtered on
                page:
                  type: number
                  default: 0
                  description: Page number for pagination
                limit:
                  type: number
                  maximum: 50
                  default: 10
                  description: 'Number of records per page (max: 100)'
                sorting:
                  type: object
                  properties:
                    columnName:
                      type: string
                      description: Field to sort by (e.g., startTimestamp)
                    desc:
                      type: boolean
                      description: Sort direction (true for descending)
                  required:
                    - columnName
                    - desc
                  description: >-
                    Sorting configuration for logs eg: { id: 'startTimestamp',
                    desc: true }
              required:
                - workspaceId
                - id
                - type
      responses:
        '200':
          description: Logs retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      uniqueTags:
                        type: array
                        items:
                          type: string
                      logs:
                        type: array
                        items:
                          anyOf:
                            - type: object
                              properties:
                                id:
                                  type: string
                                tags:
                                  type: object
                                  additionalProperties:
                                    type: string
                                timestamp:
                                  type: string
                                startTimestamp:
                                  type: string
                                endTimestamp:
                                  type: string
                                name:
                                  type: string
                                feedback:
                                  type: object
                                  properties:
                                    score:
                                      type: number
                                    comment:
                                      type: string
                                  required:
                                    - score
                              required:
                                - id
                                - tags
                                - timestamp
                                - startTimestamp
                                - name
                            - type: object
                              properties:
                                id:
                                  type: string
                                name:
                                  type: string
                                tags:
                                  type: object
                                  additionalProperties:
                                    type: string
                                startTimestamp:
                                  type: string
                                sessionId:
                                  type: string
                                type:
                                  type: string
                                input:
                                  nullable: true
                                output:
                                  nullable: true
                                feedback:
                                  type: object
                                  properties:
                                    score:
                                      type: number
                                    comment:
                                      type: string
                                  required:
                                    - score
                                    - comment
                                duration:
                                  type: number
                                endTimestamp:
                                  type: string
                                version:
                                  type: number
                                timeline:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      traceId:
                                        type: string
                                      name:
                                        type: string
                                      id:
                                        type: string
                                      type:
                                        type: string
                                      startTimestamp:
                                        type: string
                                      tags:
                                        type: object
                                        additionalProperties:
                                          type: string
                                      timeline:
                                        type: array
                                        items:
                                          type: object
                                          properties:
                                            spanId:
                                              type: string
                                            modelParameters:
                                              type: object
                                              properties:
                                                presencePenalty:
                                                  type: number
                                                maxTokens:
                                                  type: number
                                                temperature:
                                                  type: number
                                                frequencyPenalty:
                                                  type: number
                                                topP:
                                                  type: number
                                              required:
                                                - presencePenalty
                                                - maxTokens
                                                - temperature
                                                - frequencyPenalty
                                                - topP
                                            provider:
                                              type: string
                                            name:
                                              type: string
                                            messages:
                                              type: array
                                              items:
                                                type: object
                                                properties:
                                                  role:
                                                    type: string
                                                  content:
                                                    type: string
                                                required:
                                                  - role
                                                  - content
                                            model:
                                              type: string
                                            id:
                                              type: string
                                            type:
                                              type: string
                                            startTimestamp:
                                              type: string
                                            completionResult:
                                              type: object
                                              properties:
                                                cost:
                                                  type: object
                                                  properties:
                                                    output:
                                                      type: number
                                                    input:
                                                      type: number
                                                    total:
                                                      type: number
                                                  required:
                                                    - output
                                                    - input
                                                    - total
                                                provider:
                                                  type: string
                                                created:
                                                  nullable: true
                                                usage:
                                                  type: object
                                                  properties:
                                                    completion_tokens:
                                                      type: number
                                                    prompt_tokens:
                                                      type: number
                                                    total_tokens:
                                                      type: number
                                                  required:
                                                    - completion_tokens
                                                    - prompt_tokens
                                                    - total_tokens
                                                model:
                                                  type: string
                                                model_params:
                                                  nullable: true
                                                id:
                                                  type: string
                                                choices:
                                                  type: array
                                                  items:
                                                    type: object
                                                    properties:
                                                      index:
                                                        type: number
                                                      message:
                                                        type: object
                                                        properties:
                                                          role:
                                                            type: string
                                                          content:
                                                            type: string
                                                          function_call:
                                                            nullable: true
                                                          tool_calls:
                                                            nullable: true
                                                        required:
                                                          - role
                                                          - content
                                                          - function_call
                                                          - tool_calls
                                                      finish_reason:
                                                        type: string
                                                      logprobs:
                                                        nullable: true
                                                    required:
                                                      - message
                                                      - finish_reason
                                                      - logprobs
                                                error:
                                                  nullable: true
                                              required:
                                                - cost
                                                - provider
                                                - created
                                                - usage
                                                - model
                                                - model_params
                                                - id
                                                - choices
                                                - error
                                            duration:
                                              type: number
                                            endTimestamp:
                                              type: string
                                            timestamp:
                                              type: string
                                            tags:
                                              type: object
                                              additionalProperties:
                                                type: string
                                            input:
                                              type: string
                                            docs:
                                              type: array
                                              items:
                                                type: string
                                          required:
                                            - spanId
                                            - name
                                            - id
                                            - type
                                    required:
                                      - traceId
                                      - name
                                      - id
                                      - type
                                      - startTimestamp
                                      - tags
                                      - timeline
                                evaluationData:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      evaluatorName:
                                        type: string
                                      score:
                                        type: number
                                      pass:
                                        type: boolean
                                      reasoning:
                                        type: string
                                      variables:
                                        type: object
                                        additionalProperties:
                                          type: string
                                      optionalVariables:
                                        type: object
                                        additionalProperties:
                                          type: string
                                    required:
                                      - evaluatorName
                                      - score
                                      - pass
                              required:
                                - id
                                - name
                                - tags
                                - startTimestamp
                                - sessionId
                                - type
                                - feedback
                                - duration
                                - endTimestamp
                                - version
                                - timeline
                                - evaluationData
                    required:
                      - uniqueTags
                      - logs
                  pagination:
                    type: object
                    properties:
                      total:
                        type: number
                      page:
                        type: number
                      limit:
                        type: number
                    required:
                      - total
                      - page
                      - limit
                required:
                  - data
                  - pagination
        '400':
          description: Invalid request parameters
        '404':
          description: Log repository not found
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-maxim-api-key
      description: API key for authentication

````