> ## 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.

# Send DM

> Send DM to a user, $0.0025 per call.



## OpenAPI

````yaml /api-reference/openapi.json post /twitter/send-dm
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:
  /twitter/send-dm:
    post:
      tags:
        - DM Endpoints
      summary: Send DM
      description: Send DM to a user, $0.0025 per call.
      operationId: send_dm_api_twitter_send_dm_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendDmQuery'
        required: true
      responses:
        '200':
          description: A message objects.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendDmResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    SendDmQuery:
      properties:
        username:
          type: string
          title: Username
          description: Twitter username to send DM to
          example: myusername
        msg:
          type: string
          title: Msg
          description: Message to send
          example: Hello, how are you?
        media:
          anyOf:
            - type: string
            - type: 'null'
          title: Media
          description: Media URL to send
          example: https://example.com/image.jpg
        reply_to:
          anyOf:
            - type: string
            - type: 'null'
          title: Reply To
          description: Reply to message ID
          example: '1234567890123456789'
        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: >-
            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://app.proxy-cheap.com/r/qiMxub
          example: http://username:password@ip:port
      type: object
      required:
        - username
        - msg
        - cookie
      title: SendDmQuery
      description: Parameters for sending DM
    SendDmResponse:
      properties:
        code:
          type: integer
          title: Code
          description: Response code
          example: 200
        msg:
          type: string
          title: Msg
          description: Message sent
          example: success
        data:
          anyOf:
            - $ref: '#/components/schemas/MessageModel'
            - type: 'null'
          description: message object
          example:
            attachment:
              type: image
              url: https://example.com/image.jpg
            id: '1234567890123456789'
            text: Hello, how are you?
            time: '2024-01-01T12:00:00Z'
      type: object
      required:
        - code
        - msg
        - data
      title: SendDmResponse
      description: Response for sending DM
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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
        attachments:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Attachments
          description: XChat media attachments (v3).
          example:
            - attachment_id: cda5ccdd-af53-48a3-bdd1-5039a73aea25
              conversation_id: '1928096185664843776:1989842918455291904'
              filename: image.jpg
              filesize_bytes: 421299
              height: 1448
              key_version: '3'
              media_hash_key: blRIlZCVIO
              type: image
              type_name: IMAGE
              width: 1086
        sequence_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Sequence Id
          description: >-
            XChat sequence id. Use the oldest message's sequence_id as before
            for pagination.
          example: '2076661179334979585'
        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
    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

````