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

# Request older chat history from the phone

> Asks the phone for older messages of a chat on demand (what WhatsApp Web does when you scroll up / "load older messages"). The request is anchored at the oldest message currently stored locally for that chat, so the chat must already have at least one stored message. The phone answers asynchronously with a history sync event that gets persisted into chat storage; this endpoint only confirms the request was sent, it does not return the older messages directly.



## OpenAPI

````yaml /openapi.yml post /chat/{chat_jid}/history
openapi: 3.0.0
info:
  title: WhatsApp API MultiDevice
  version: 9.7.0
  description: |
    This API is used for sending whatsapp via API.

    The web dashboard is a separate project (gowa-ui); the server downloads its
    latest release asset and serves it at `/` (or returns a JSON banner when
    APP_UI_ENABLED=false).

    Device scoping:
    - Send `X-Device-Id` on all device-scoped REST calls.
    - WebSocket: connect to `/ws?device_id=<id>`.
    - WebSocket auth (when basic auth is enabled): browsers cannot set an
      Authorization header on WebSocket connections, so also pass
      `&authorization=<base64(user:pass)>` in the query string. Use TLS in
      production since the credential is visible in the URL.
servers:
  - url: http://localhost:3000
security:
  - basicAuth: []
tags:
  - name: app
    description: Initial Connection to Whatsapp server
  - name: device
    description: Device management for multi-device support
  - name: user
    description: Getting information
  - name: send
    description: Send Message (Text/Image/File/Video).
  - name: message
    description: Message manipulation (revoke/react/update).
  - name: call
    description: Call management (reject incoming calls)
  - name: chat
    description: Chat conversations and messaging
  - name: group
    description: Group setting
  - name: newsletter
    description: newsletter setting
  - name: chatwoot
    description: Chatwoot integration for customer support
paths:
  /chat/{chat_jid}/history:
    post:
      tags:
        - chat
      summary: Request older chat history from the phone
      description: >-
        Asks the phone for older messages of a chat on demand (what WhatsApp Web
        does when you scroll up / "load older messages"). The request is
        anchored at the oldest message currently stored locally for that chat,
        so the chat must already have at least one stored message. The phone
        answers asynchronously with a history sync event that gets persisted
        into chat storage; this endpoint only confirms the request was sent, it
        does not return the older messages directly.
      operationId: requestChatHistory
      parameters:
        - $ref: '#/components/parameters/DeviceIdHeader'
        - in: path
          name: chat_jid
          schema:
            type: string
          required: true
          description: >-
            Chat JID (e.g., phone@s.whatsapp.net for individual or groupid@g.us
            for group). Percent-encoded values (e.g., groupid%40g.us) are
            accepted.
          example: 6289685028129@s.whatsapp.net
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                count:
                  type: integer
                  default: 50
                  minimum: 0
                  maximum: 500
                  example: 50
                  description: >-
                    Number of older messages to request from the phone. Omit it,
                    or send 0, to use the default of 50.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RequestChatHistoryResponse'
        '400':
          description: >-
            Bad Request (e.g. missing chat_jid, count out of range, or chat has
            no stored messages to anchor on)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBadRequest'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorUnauthorized'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorInternalServer'
components:
  parameters:
    DeviceIdHeader:
      name: X-Device-Id
      in: header
      required: false
      description: >
        Device identifier for multi-device support. Required when multiple
        devices are registered.

        If only one device is registered, it will be used as the default.

        Can also be provided as `device_id` query parameter.
      schema:
        type: string
        example: my-device-id
  schemas:
    RequestChatHistoryResponse:
      type: object
      properties:
        status:
          type: integer
          example: 200
        code:
          type: string
          example: SUCCESS
        message:
          type: string
          example: History sync requested successfully
        results:
          type: object
          properties:
            status:
              type: string
              example: requested
            chat_jid:
              type: string
              example: 6289685028129@s.whatsapp.net
            requested_count:
              type: integer
              example: 50
            anchor_message_id:
              type: string
              example: 3EB0C767D82B0A0D1234
            anchor_timestamp:
              type: string
              format: date-time
              example: '2026-05-16T08:00:00Z'
    ErrorBadRequest:
      type: object
      properties:
        code:
          type: string
          example: 400
          description: HTTP Status Code
        message:
          type: string
          example: field cannot be blank
          description: Detail error message
        results:
          type: object
          example: null
          description: additional data
    ErrorUnauthorized:
      type: object
      properties:
        code:
          type: string
          example: 401
          description: HTTP Status Code
        message:
          type: string
          example: Unauthorized access
          description: Detail error message
        results:
          type: object
          example: null
          description: additional data
    ErrorInternalServer:
      type: object
      properties:
        code:
          type: string
          example: INTERNAL_SERVER_ERROR
          description: SYSTEM_CODE_ERROR
        message:
          type: string
          example: you are not loggin
          description: Detail error message
        results:
          type: object
          example: null
          description: additional data
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.