> ## 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 Logs V2 events

> Search Logs V2 events for the project associated with your API key. Returns the same event payload shape used by the Logs V2 UI. Use POST when sending filters.



## OpenAPI

````yaml /api/platform/v1/openapi-platform.yaml get /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 Logs V2 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:
    get:
      tags:
        - Log Search
      summary: Search Logs V2 events
      description: >-
        Search Logs V2 events for the project associated with your API key.
        Returns the same event payload shape used by the Logs V2 UI. Use POST
        when sending filters.
      operationId: searchLogs
      parameters:
        - name: query
          in: query
          description: >-
            Free-text search query. Blank queries are allowed for browsing
            narrowed by source, filters, or problems_only.
          schema:
            type: string
        - name: period
          in: query
          description: >-
            Time window to search. Use context with around to fetch nearby
            events.
          schema:
            type: string
            enum:
              - 24h
              - 7d
              - context
            default: 24h
        - name: source
          in: query
          description: Logs V2 source to search. Use all to search every source.
          schema:
            type: string
            enum:
              - all
              - external_api_log
              - whatsapp_webhook_event
              - flow_event
              - webhook_delivery
            default: all
        - name: problems_only
          in: query
          description: Only return problem or error events.
          schema:
            type: boolean
            default: false
        - name: errors_only
          in: query
          description: Alias for problems_only.
          deprecated: true
          schema:
            type: boolean
            default: false
        - name: limit
          in: query
          description: Maximum number of events returned.
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: cursor
          in: query
          description: Cursor returned as pagination.next_cursor from a previous response.
          schema:
            type: string
        - name: around
          in: query
          description: >-
            Center a context search around this timestamp. Use with
            period=context.
          schema:
            type: string
            format: date-time
        - name: highlight_event_id
          in: query
          description: Include this event in the page when available.
          schema:
            type: string
        - name: highlight_resource_id
          in: query
          description: Include an event for this resource in the page when available.
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogSearchResponse'
              examples:
                found:
                  summary: Log events found
                  value:
                    data:
                      available: true
                      source: external_api_log
                      window:
                        since: '2026-07-06T12:00:00Z'
                        until: '2026-07-07T12:00:00Z'
                      events:
                        - id: evt_1
                          source: external_api_log
                          timestamp: '2026-07-07T11:59:00Z'
                          message: POST /v1/messages
                          http_method: POST
                          endpoint: /v1/messages
                          api_key_name: Production key
                          response_status: 422
                          payload:
                            error_message: Graph API failed
                      pagination:
                        has_more: false
                        next_cursor: null
                unavailable:
                  summary: Log search unavailable
                  value:
                    data:
                      available: false
                      events: []
        '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'
              examples:
                invalid_filters:
                  summary: Invalid filters
                  value:
                    error: >-
                      filters must be an array of {key, value} entries or an
                      object
                search_failed:
                  summary: Search failure
                  value:
                    data:
                      available: true
                      events: []
                      error: log search failed
                      code: elastic_search_failed
components:
  schemas:
    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
    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

````