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

# Search log events with filters

> Search log events with the same project-scoped data and filter catalog used by the logs UI.



## OpenAPI

````yaml /api/platform/v1/openapi-platform.yaml post /log_search
openapi: 3.1.0
info:
  title: Kapso Platform API
  version: 0.2.0
  description: >
    Build WhatsApp messaging into your product. Manage customers, connect phone
    numbers, send broadcasts, and handle conversations.
servers:
  - url: https://api.kapso.ai/platform/v1
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Customers
    description: Manage customer accounts
  - name: Setup Links
    description: WhatsApp onboarding via embedded signup
  - name: Phone Numbers
    description: Connect and manage WhatsApp numbers
  - name: Webhooks
    description: Subscribe to WhatsApp events
  - name: Display Names
    description: Update WhatsApp business display names
  - name: Broadcasts
    description: |
      Send template messages at scale

      **Alpha**: This API is in alpha and subject to change
  - name: Conversations
    description: Manage conversation state
  - name: Media
    description: Upload media files for WhatsApp messaging
  - name: Users
    description: Manage project team members
  - name: Inbox Embeds
    description: Create and manage embeddable inbox access links
  - name: Webhook Deliveries
    description: View webhook delivery attempts and their status
  - name: External API Logs
    description: View logs of external API calls made by the project
  - name: Log Search
    description: Search log events across API, Meta, workflow, and webhook sources
  - name: Provider Models
    description: List available AI provider models
  - name: WhatsApp Flows
    description: Build interactive WhatsApp Flows for surveys and forms
  - name: Contacts
    description: Manage WhatsApp contacts
paths:
  /log_search:
    post:
      tags:
        - Log Search
      summary: Search log events with filters
      description: >-
        Search log events with the same project-scoped data and filter catalog
        used by the logs UI.
      operationId: searchLogsWithFilters
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LogSearchRequest'
            examples:
              workflow_execution:
                summary: Search a workflow execution
                value:
                  query: flow-execution-1
                  period: 7d
                  source: flow_event
                  filters:
                    flow_execution_id: flow-execution-1
                    event_type: step_failed
              api_errors:
                summary: Search failed API calls
                value:
                  query: /messages
                  period: 24h
                  source: external_api_log
                  problems_only: true
                  filters:
                    endpoint_contains: /messages
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogSearchResponse'
              examples:
                found:
                  summary: Log events found
                  value:
                    data:
                      available: true
                      source: flow_event
                      window:
                        since: '2026-07-01T12:00:00Z'
                        until: '2026-07-07T12:00:00Z'
                      events:
                        - id: evt_2
                          source: flow_event
                          timestamp: '2026-07-07T11:58:00Z'
                          message: Flow Event step_failed agent_1
                          flow_execution_id: flow-execution-1
                          flow_event_id: flow-event-1
                          step_identifier: agent_1
                          step_type: FlowAgentStep
                          error_message: Tool call failed
                      pagination:
                        has_more: false
                        next_cursor: null
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '422':
          description: Invalid filters or search failure
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ErrorResponse'
                  - $ref: '#/components/schemas/LogSearchResponse'
components:
  schemas:
    LogSearchRequest:
      type: object
      properties:
        query:
          type: string
        period:
          type: string
          enum:
            - 24h
            - 7d
            - context
          default: 24h
        source:
          type: string
          enum:
            - all
            - external_api_log
            - whatsapp_webhook_event
            - flow_event
            - webhook_delivery
          default: all
        problems_only:
          type: boolean
          default: false
        errors_only:
          type: boolean
          default: false
          deprecated: true
          description: Alias for problems_only.
        limit:
          type: integer
          minimum: 1
          maximum: 100
          default: 50
        cursor:
          type: string
          description: Cursor returned as pagination.next_cursor from a previous response.
        around:
          type: string
          format: date-time
          description: >-
            Center a context search around this timestamp. Use with
            period=context.
        highlight_event_id:
          type: string
          description: Include this event in the page when available.
        highlight_resource_id:
          type: string
          description: Include an event for this resource in the page when available.
        filters:
          anyOf:
            - type: object
              additionalProperties:
                $ref: '#/components/schemas/LogSearchFilterValue'
            - type: array
              items:
                $ref: '#/components/schemas/LogSearchFilterEntry'
          example:
            flow_execution_id: flow-execution-1
    LogSearchResponse:
      type: object
      required:
        - data
      properties:
        data:
          type: object
          required:
            - available
            - events
          properties:
            available:
              type: boolean
            source:
              type:
                - string
                - array
                - 'null'
              items:
                type: string
            window:
              $ref: '#/components/schemas/LogSearchWindow'
            events:
              type: array
              items:
                $ref: '#/components/schemas/LogSearchEvent'
            pagination:
              $ref: '#/components/schemas/LogSearchPagination'
            error:
              type:
                - string
                - 'null'
            code:
              type:
                - string
                - 'null'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
    LogSearchFilterValue:
      anyOf:
        - type: string
        - type: integer
        - type: number
        - type: boolean
    LogSearchFilterEntry:
      type: object
      required:
        - key
        - value
      properties:
        key:
          type: string
          example: flow_execution_id
        value:
          $ref: '#/components/schemas/LogSearchFilterValue'
    LogSearchWindow:
      type: object
      properties:
        since:
          type: string
          format: date-time
        until:
          type: string
          format: date-time
    LogSearchEvent:
      type: object
      additionalProperties: true
      required:
        - id
        - source
      properties:
        id:
          type: string
          description: Indexed log event ID
          example: evt_1
        source:
          type: string
          enum:
            - external_api_log
            - whatsapp_webhook_event
            - flow_event
            - webhook_delivery
          example: external_api_log
        timestamp:
          type:
            - string
            - 'null'
          format: date-time
        occurred_at:
          type:
            - string
            - 'null'
          format: date-time
        ingested_at:
          type:
            - string
            - 'null'
          format: date-time
        level:
          type:
            - string
            - 'null'
          example: info
        status:
          type:
            - string
            - 'null'
          example: failed
        message:
          type:
            - string
            - 'null'
          example: POST /v1/messages
        resource_type:
          type:
            - string
            - 'null'
          example: external_api_log
        resource_id:
          type:
            - string
            - 'null'
        http_method:
          type:
            - string
            - 'null'
          example: POST
        endpoint:
          type:
            - string
            - 'null'
          example: /v1/messages
        api_key_id:
          type:
            - string
            - 'null'
        api_key_name:
          type:
            - string
            - 'null'
          example: Production key
        response_status:
          type:
            - integer
            - 'null'
          example: 422
        response_time_ms:
          type:
            - number
            - 'null'
        event_type:
          type:
            - string
            - 'null'
          example: agent_iteration_started
        field:
          type:
            - string
            - 'null'
        event:
          type:
            - string
            - 'null'
        message_type:
          type:
            - string
            - 'null'
        phone_number_id:
          type:
            - string
            - 'null'
        display_phone_number:
          type:
            - string
            - 'null'
        flow_name:
          type:
            - string
            - 'null'
          example: Support workflow
        flow_id:
          type:
            - string
            - 'null'
        flow_execution_id:
          type:
            - string
            - 'null'
        flow_event_id:
          type:
            - string
            - 'null'
        step_identifier:
          type:
            - string
            - 'null'
          example: agent_1
        step_type:
          type:
            - string
            - 'null'
        webhook_id:
          type:
            - string
            - 'null'
        webhook_url:
          type:
            - string
            - 'null'
        error_class:
          type:
            - string
            - 'null'
        error_message:
          type:
            - string
            - 'null'
        attributes:
          type:
            - object
            - 'null'
          additionalProperties: true
        payload:
          type:
            - object
            - 'null'
          additionalProperties: true
    LogSearchPagination:
      type: object
      properties:
        has_more:
          type: boolean
          example: false
        next_cursor:
          type:
            - string
            - 'null'
  responses:
    UnauthorizedError:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````