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

> Send DM via XChat encrypted chat API (1:1 or existing group g...), optional image via media_urls (max 1). $0.0025 per call.



## OpenAPI

````yaml /api-reference/openapi.json post /v3/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:
  /v3/twitter/send-dm:
    post:
      tags:
        - DM Endpoints
      summary: Send DM (XChat v3)
      description: >-
        Send DM via XChat encrypted chat API (1:1 or existing group g...),
        optional image via media_urls (max 1). $0.0025 per call.
      operationId: send_dm_api_v3_v3_twitter_send_dm_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendDmV3Query'
        required: true
      responses:
        '200':
          description: A message object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendDmResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    SendDmV3Query:
      properties:
        recipient:
          type: string
          title: Recipient
          description: User id, @handle, or a group id (g...) for an existing group.
          example: baker_donn80196
        text:
          type: string
          title: Text
          description: Message body.
          example: hello from docs
        media_urls:
          anyOf:
            - items:
                type: string
              type: array
              maxItems: 1
            - type: 'null'
          title: Media Urls
          description: Public URL of one image to attach (max 1).
          example:
            - https://example.com/image.jpg
        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: >-
            Proxy ref for XChat session. Example:
            http://username:password@ip:port
          example: http://username:password@ip:port
      type: object
      required:
        - recipient
        - text
        - cookie
      title: SendDmV3Query
      description: Parameters for sending DM via XChat v3
    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
        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

````