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

# Get History Messages By UserID

> Get the direct message history with a user.



## OpenAPI

````yaml GET /twitter/get_dm_history_by_user_id
openapi: 3.0.1
info:
  title: TwitterAPI.io API
  description: >-
    Real-time access to public X (Twitter) data: tweets, users, search, lists,
    communities and streams. Pay per item returned.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.twitterapi.io
security:
  - ApiKeyAuth: []
paths:
  /twitter/get_dm_history_by_user_id:
    get:
      description: Get the direct message history with a user.
      parameters:
        - name: login_cookies
          in: query
          description: >-
            The login cookies of the user.You can get the login_cookie from
            /twitter/user_login_v2.Must be set
          required: true
          schema:
            type: string
            format: string
        - name: user_id
          in: query
          description: >-
            The id of the user to get the direct message history with.Must be
            set
          required: true
          schema:
            type: string
            format: string
        - name: proxy
          in: query
          description: >-
            The proxy to use.Please use high-quality residential proxies and
            avoid free proxies.Required.Example:
            http://username:password@ip:port . You can get proxy from:
            https://www.webshare.io/?referral_code=4e0q1n00a504
          schema:
            type: string
            format: string
      responses:
        '200':
          description: Messages response
          content:
            application/json:
              schema:
                type: object
                properties:
                  messages:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: ID of the message
                        recipient_id:
                          type: string
                          description: ID of the recipient user
                        sender_id:
                          type: string
                          description: ID of the sender user
                        text:
                          type: string
                          description: Content of the message
                        time:
                          type: string
                          description: >-
                            Timestamp of the message in milliseconds (Unix
                            epoch)
                    description: Array of messages
                  status:
                    type: string
                    description: Status of the request.success or error
                  message:
                    type: string
                    description: Message of the request.error message
        '400':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````

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