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

# Mark WhatsApp message as read

> Marks an inbound WhatsApp message as read and syncs the status with WhatsApp API.

**Key Features:**
- Only inbound messages can be marked as read
- Optimistically updates local status for immediate feedback
- Asynchronously syncs with WhatsApp API via background job
- Skips messages already marked as read
- Supports optional typing indicator control

**Sandbox Mode:**
Messages from sandbox conversations (no WhatsApp config) are handled appropriately with sandbox-specific processing.




## OpenAPI

````yaml api/legacy/openapi-whatsapp.yaml patch /whatsapp_messages/{id}/mark_as_read
openapi: 3.0.3
info:
  title: Kapso External API - WhatsApp API
  description: >-
    API for programmatically interacting with Kapso agents, executions, and
    WhatsApp conversations. This specification includes only WhatsApp API
    endpoints.
  version: 1.0.0
  contact:
    name: Kapso Support
servers:
  - url: https://app.kapso.ai/api/v1
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /whatsapp_messages/{id}/mark_as_read:
    patch:
      tags:
        - WhatsApp Messages
      summary: Mark WhatsApp message as read
      description: >
        Marks an inbound WhatsApp message as read and syncs the status with
        WhatsApp API.


        **Key Features:**

        - Only inbound messages can be marked as read

        - Optimistically updates local status for immediate feedback

        - Asynchronously syncs with WhatsApp API via background job

        - Skips messages already marked as read

        - Supports optional typing indicator control


        **Sandbox Mode:**

        Messages from sandbox conversations (no WhatsApp config) are handled
        appropriately with sandbox-specific processing.
      operationId: markWhatsappMessageAsRead
      parameters:
        - name: id
          in: path
          required: true
          description: The ID of the WhatsApp message to mark as read
          schema:
            type: string
            format: uuid
        - name: typing_indicator
          in: query
          required: false
          description: Whether to show typing indicator in WhatsApp (defaults to true)
          schema:
            type: boolean
            default: true
      responses:
        '200':
          description: Message successfully marked as read
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/WhatsappMessage'
              examples:
                success:
                  summary: Message marked as read
                  value:
                    data:
                      id: msg-123abc
                      phone_number: '+1234567890'
                      message_type: text
                      content: Hello
                      direction: inbound
                      status: read
                      whatsapp_message_id: wamid.HBgLMTIzNDU2Nzg5MAUCAw==
                      created_at: '2024-01-15T10:30:00Z'
                      updated_at: '2024-01-15T10:31:00Z'
        '400':
          description: Bad request - attempting to mark outbound message as read
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                outbound_message:
                  summary: Cannot mark outbound message
                  value:
                    error: Can only mark inbound messages as read
        '401':
          description: Unauthorized - invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Message not found or doesn't belong to authorized project
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                not_found:
                  summary: Message not found
                  value:
                    error: WhatsApp message not found
components:
  schemas:
    WhatsappMessage:
      type: object
      properties:
        id:
          type: string
          format: uuid
        phone_number:
          type: string
        message_type:
          type: string
          enum:
            - text
            - image
            - video
            - audio
            - document
            - template
            - location
            - interactive
            - reaction
            - contacts
          description: The type of WhatsApp message
        content:
          type: string
          description: Human-readable representation of the message content
        direction:
          type: string
          enum:
            - inbound
            - outbound
        status:
          type: string
        processing_status:
          type: string
          enum:
            - pending
            - processed
        whatsapp_message_id:
          type: string
        metadata:
          type: object
          nullable: false
          description: Type-specific metadata for the message
        media_url:
          type: string
          description: >-
            URL to access any attached media (for image, video, audio, document
            message types)
        message_type_data:
          type: object
          description: Type-specific data based on the message_type
          oneOf:
            - $ref: '#/components/schemas/TextMessageData'
            - $ref: '#/components/schemas/ImageMessageData'
            - $ref: '#/components/schemas/VideoMessageData'
            - $ref: '#/components/schemas/AudioMessageData'
            - $ref: '#/components/schemas/DocumentMessageData'
            - $ref: '#/components/schemas/LocationMessageData'
            - $ref: '#/components/schemas/TemplateMessageData'
            - $ref: '#/components/schemas/InteractiveMessageData'
            - $ref: '#/components/schemas/ReactionMessageData'
            - $ref: '#/components/schemas/ContactsMessageData'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: string
          example: Resource not found
        status:
          type: integer
          example: 404
        message:
          type: string
          example: The requested resource could not be found
    TextMessageData:
      type: object
      description: Data specific to text messages
      properties:
        text:
          type: string
          description: The text content of the message
    ImageMessageData:
      type: object
      description: Data specific to image messages
      properties:
        caption:
          type: string
          description: Optional caption for the image
        media_id:
          type: string
          description: WhatsApp media ID for the image
        mime_type:
          type: string
          description: MIME type of the image (e.g., image/jpeg)
    VideoMessageData:
      type: object
      description: Data specific to video messages
      properties:
        caption:
          type: string
          description: Optional caption for the video
        media_id:
          type: string
          description: WhatsApp media ID for the video
        mime_type:
          type: string
          description: MIME type of the video (e.g., video/mp4)
    AudioMessageData:
      type: object
      description: Data specific to audio messages
      properties:
        media_id:
          type: string
          description: WhatsApp media ID for the audio
        mime_type:
          type: string
          description: MIME type of the audio (e.g., audio/ogg)
    DocumentMessageData:
      type: object
      description: Data specific to document messages
      properties:
        caption:
          type: string
          description: Optional caption for the document
        media_id:
          type: string
          description: WhatsApp media ID for the document
        mime_type:
          type: string
          description: MIME type of the document (e.g., application/pdf)
        filename:
          type: string
          description: Original filename of the document
    LocationMessageData:
      type: object
      description: Data specific to location messages
      properties:
        latitude:
          type: number
          format: float
          description: Latitude coordinate
        longitude:
          type: number
          format: float
          description: Longitude coordinate
        location_name:
          type: string
          description: Optional name for the location
        location_address:
          type: string
          description: Optional address for the location
    TemplateMessageData:
      type: object
      description: Data specific to template messages
      properties:
        template_name:
          type: string
          description: Name of the template used
        template_language:
          type: string
          description: Language code of the template (e.g., en_US)
        template_params:
          type: array
          description: Parameters used in the template
          items:
            type: string
        header_type:
          type: string
          description: Type of header used in the template
          enum:
            - text
            - image
            - video
            - document
        header_params:
          type: string
          description: Content for the template header
        header_filename:
          type: string
          description: Filename for document headers
    InteractiveMessageData:
      type: object
      description: Data specific to interactive messages
      properties:
        interactive_type:
          type: string
          enum:
            - button
            - list
          description: Type of interactive message
        body_text:
          type: string
          description: Main text content of the interactive message
        header_text:
          type: string
          description: Optional header text
        footer_text:
          type: string
          description: Optional footer text
        buttons:
          type: array
          description: Buttons for button-type interactive messages
          items:
            type: object
            properties:
              id:
                type: string
                description: Unique identifier for the button
              title:
                type: string
                description: Display text for the button
        sections:
          type: array
          description: Sections for list-type interactive messages
          items:
            type: object
            properties:
              title:
                type: string
                description: Section title
              rows:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                      description: Row identifier
                    title:
                      type: string
                      description: Row title
                    description:
                      type: string
                      description: Optional row description
        reply_option_id:
          type: string
          description: For replies, the ID of the selected option
        reply_option_title:
          type: string
          description: For replies, the title of the selected option
        list_button_text:
          type: string
          description: Text for the button that opens the list (for list-type messages)
    ReactionMessageData:
      type: object
      description: Data specific to reaction messages
      properties:
        reaction_emoji:
          type: string
          description: Emoji used for the reaction
        reacted_to_message_id:
          type: string
          description: ID of the message being reacted to
    ContactsMessageData:
      type: object
      description: >
        Data specific to contact messages. Supports 1-257 contacts per WhatsApp
        guidelines.

        At least one contact with a name (formatted_name or first_name) is
        required.
      properties:
        contacts:
          type: array
          minItems: 1
          maxItems: 257
          description: List of contact cards to send
          items:
            type: object
            required:
              - name
            properties:
              name:
                type: object
                description: >-
                  Contact name information. Either formatted_name or first_name
                  is required.
                properties:
                  formatted_name:
                    type: string
                    description: Full formatted contact name
                    example: Barbara J. Johnson
                  first_name:
                    type: string
                    description: First name
                    example: Barbara
                  last_name:
                    type: string
                    description: Last name
                    example: Johnson
                  middle_name:
                    type: string
                    description: Middle name
                    example: Joana
                  prefix:
                    type: string
                    description: Name prefix
                    example: Dr.
                  suffix:
                    type: string
                    description: Name suffix
                    example: Esq.
              birthday:
                type: string
                format: date
                description: Contact birthday in YYYY-MM-DD format
                example: '1999-01-23'
              phones:
                type: array
                description: List of phone numbers
                items:
                  type: object
                  required:
                    - phone
                  properties:
                    phone:
                      type: string
                      description: Phone number (international format recommended)
                      example: '+16505559999'
                    type:
                      type: string
                      description: Phone number type
                      example: Mobile
                    wa_id:
                      type: string
                      description: WhatsApp ID (normalized phone number without + prefix)
                      example: '19175559999'
              emails:
                type: array
                description: List of email addresses
                items:
                  type: object
                  required:
                    - email
                  properties:
                    email:
                      type: string
                      format: email
                      description: Email address
                      example: bjohnson@luckyshrub.com
                    type:
                      type: string
                      description: Email type
                      example: Work
              addresses:
                type: array
                description: List of physical addresses
                items:
                  type: object
                  properties:
                    street:
                      type: string
                      description: Street address
                      example: 1 Lucky Shrub Way
                    city:
                      type: string
                      description: City
                      example: Menlo Park
                    state:
                      type: string
                      description: State or province
                      example: CA
                    zip:
                      type: string
                      description: ZIP or postal code
                      example: '94025'
                    country:
                      type: string
                      description: Country name
                      example: United States
                    country_code:
                      type: string
                      description: ISO country code
                      example: US
                    type:
                      type: string
                      description: Address type
                      example: Office
              urls:
                type: array
                description: List of URLs
                items:
                  type: object
                  required:
                    - url
                  properties:
                    url:
                      type: string
                      format: uri
                      description: URL
                      example: https://www.luckyshrub.com
                    type:
                      type: string
                      description: URL type
                      example: Company
              org:
                type: object
                description: Organization information
                properties:
                  company:
                    type: string
                    description: Company name
                    example: Lucky Shrub
                  department:
                    type: string
                    description: Department name
                    example: Legal
                  title:
                    type: string
                    description: Job title
                    example: Lead Counsel
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key required for all endpoints

````