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

# Get DM History (XChat v3)

> Get DM history via XChat encrypted chat API.



## OpenAPI

````yaml /api-reference/openapi.json post /v3/twitter/dm-history
openapi: 3.1.0
info:
  title: Twitter API Service
  description: |2-

            A comprehensive Twitter API service that provides various Twitter operations including:
            
            * **Search Operations**: Advanced search, hashtags, cashtags
            * **Tweet Operations**: Post, like, retweet, quote, bookmark, delete
            * **User Operations**: Batch user information retrieval
            * **Influencer Operations**: Get tweets from top influencers
            
            All endpoints return standardized responses in the format:
            ```json
            {
                "code": 200,
                "msg": "success", 
                "data": {...}
            }
            ```
            
            ## Authentication
            
            This API uses Bearer token authentication. Include your token in the Authorization header:
            ```
            Authorization: Bearer your_token_here
            ```
            
  contact:
    name: API Support
    email: support@twitterxapi.com
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.twexapi.io
    description: Development server
security: []
paths:
  /v3/twitter/dm-history:
    post:
      tags:
        - DM Endpoints
      summary: Get DM History (XChat v3)
      description: Get DM history via XChat encrypted chat API.
      operationId: dm_history_api_v3_v3_twitter_dm_history_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetDmHistoryV3Query'
        required: true
      responses:
        '200':
          description: Conversation messages with pagination info.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetDmHistoryV3Response'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    GetDmHistoryV3Query:
      properties:
        recipient:
          type: string
          title: Recipient
          description: User id, @handle, conversationId a:b, or group g....
          example: '1928096185664843776:1989842918455291904'
        pin:
          anyOf:
            - type: string
            - type: 'null'
          title: Pin
          description: Identity PIN (default 1234).
          default: '1234'
          example: '1234'
        before:
          anyOf:
            - type: string
            - type: 'null'
          title: Before
          description: Oldest sequenceId for paging.
          example: '2075126186632757248'
        cookie:
          type: string
          title: Cookie
          description: >-
            Twitter authentication cookie or Twitter auth_token,
            [how-to-get-twitter-cookie](https://youtube-promotion.pages.dev/how-to-get-twitter-cookie)
          example: ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7
        proxy:
          anyOf:
            - type: string
            - type: 'null'
          title: Proxy
          description: >-
            Proxy ref for XChat session. Example:
            http://username:password@ip:port
          example: http://username:password@ip:port
      type: object
      required:
        - recipient
        - cookie
      title: GetDmHistoryV3Query
      description: Parameters for getting DM history via XChat v3
    GetDmHistoryV3Response:
      properties:
        code:
          type: integer
          title: Code
          description: Response code
          example: 200
        msg:
          type: string
          title: Msg
          description: Response message
          example: success
        data:
          anyOf:
            - $ref: '#/components/schemas/DmHistoryV3Data'
            - type: 'null'
          description: DM history data
      type: object
      required:
        - code
        - msg
      title: GetDmHistoryV3Response
      description: Response for getting DM history via XChat v3
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    DmHistoryV3Data:
      properties:
        conversation_id:
          type: string
          title: Conversation Id
          description: Conversation id
          example: '1928096185664843776:1989842918455291904'
        has_more:
          type: boolean
          title: Has More
          description: Whether older messages are available
          example: true
        messages:
          items:
            $ref: '#/components/schemas/MessageModel'
          type: array
          title: Messages
          description: List of message objects
      type: object
      required:
        - conversation_id
        - has_more
        - messages
      title: DmHistoryV3Data
      description: DM history payload for XChat v3
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    MessageModel:
      properties:
        id:
          type: string
          title: Id
          description: Message ID
          example: '1234567890123456789'
        text:
          type: string
          title: Text
          description: Message text
          example: Hello, how are you?
        time:
          type: string
          title: Time
          description: Message time
          example: '2024-01-01T12:00:00Z'
        attachment:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Attachment
          description: Message attachment
          example:
            type: image
            url: https://example.com/image.jpg
        sender_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Sender Id
          description: Sender ID
          example: '1234567890123456789'
        recipient_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Recipient Id
          description: Recipient ID
          example: '1234567890123456789'
      type: object
      required:
        - id
        - text
        - time
      title: MessageModel
      description: Message model
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````