> ## 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 Media (XChat v3)

> Fetch one XChat media attachment and return a playable URL. Use conversation_id, media_hash_key, and optional key_version from /v3/twitter/dm-history attachments.



## OpenAPI

````yaml /api-reference/openapi.json post /v3/twitter/dm-media
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-media:
    post:
      tags:
        - DM Endpoints
      summary: Get DM Media (XChat v3)
      description: >-
        Fetch one XChat media attachment and return a playable URL. Use
        conversation_id, media_hash_key, and optional key_version from
        /v3/twitter/dm-history attachments.
      operationId: dm_media_api_v3_v3_twitter_dm_media_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetDmMediaV3Query'
        required: true
      responses:
        '200':
          description: Playable media URL and metadata.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetDmMediaV3Response'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    GetDmMediaV3Query:
      properties:
        conversation_id:
          type: string
          title: Conversation Id
          description: Conversation id from /v3/twitter/dm-history
          example: '1928096185664843776:1989842918455291904'
        media_hash_key:
          type: string
          title: Media Hash Key
          description: Attachment media_hash_key from dm-history
          example: blRIlZCVIO
        key_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Key Version
          description: Optional message key_version from dm-history (recommended).
          example: '3'
        type_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Type Name
          description: Optional IMAGE/VIDEO/GIF hint
          example: VIDEO
        filename:
          anyOf:
            - type: string
            - type: 'null'
          title: Filename
          description: Optional filename hint
          example: clip.mp4
        pin:
          anyOf:
            - type: string
            - type: 'null'
          title: Pin
          description: Identity PIN (default 1234).
          default: '1234'
          example: '1234'
        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: 'Optional HTTP proxy. Example: http://username:password@ip:port'
          example: http://username:password@ip:port
      type: object
      required:
        - conversation_id
        - media_hash_key
        - cookie
      title: GetDmMediaV3Query
      description: Fetch one XChat media attachment and return a playable URL.
    GetDmMediaV3Response:
      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/GetDmMediaV3Data'
            - type: 'null'
          description: Media info
      type: object
      required:
        - code
        - msg
      title: GetDmMediaV3Response
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    GetDmMediaV3Data:
      properties:
        url:
          type: string
          title: Url
          description: Playable media URL
        path:
          type: string
          title: Path
          description: Media path on this API
        content_type:
          type: string
          title: Content Type
          description: MIME type
          example: video/mp4
        filename:
          anyOf:
            - type: string
            - type: 'null'
          title: Filename
          description: Suggested filename
        byte_length:
          type: integer
          title: Byte Length
          description: File size in bytes
        cached:
          type: boolean
          title: Cached
          description: Whether the media was already available
      type: object
      required:
        - url
        - path
        - content_type
        - byte_length
        - cached
      title: GetDmMediaV3Data
    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
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````