twexapi-io DM Endpoints API

The DM Endpoints API from twexapi-io — 5 operation(s) for dm endpoints.

Operations 5

POST /v2/dm/status Check DM Permissions (V2) #
POST /v3/twitter/send-dm Send DM (XChat v3) #
POST /v3/twitter/dm-history Get DM History (XChat v3) #
POST /v3/twitter/dm-media Get DM Media (XChat v3) #
POST /v3/twitter/conversations Get Conversations (XChat v3) #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/twexapi-io:twexapi-io-dm-endpoints-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

twexapi-io-dm-endpoints-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: TwexAPI REST DM Endpoints API
  description: 'TwexAPI exposes a REST API at `https://api.twexapi.io` for X/Twitter search, profiles, followers, posting, DMs, and agent integrations.


    **Capabilities include:**


    * **Search** — Advanced search, hashtags, cashtags

    * **Tweets** — Post, like, retweet, quote, bookmark, delete

    * **Users** — Batch user information retrieval

    * **Influencers** — Get tweets from top influencers


    All endpoints return a consistent envelope with `code`, `msg`, and `data` fields. See Error Handling for status codes and recovery.


    ## Authentication


    Send your API key on every request:


    ```txt

    Authorization: Bearer YOUR_API_KEY

    ```


    Write actions also require a Twitter cookie or `auth_token`. See Authentication for setup examples.'
  contact:
    name: TwexAPI Support
    email: support@twexapi.io
  license:
    name: MIT
  version: 1.0.0
servers:
- url: https://api.twexapi.io
  description: Development server
tags:
- name: DM Endpoints
paths:
  /v2/dm/status:
    post:
      tags:
      - DM Endpoints
      summary: Check DM Permissions (V2)
      description: 'Check DM status signals for user IDs or usernames. Send the targets as a JSON string array; queries use service-managed accounts.


        ```json

        ["44196397","elonmusk"]

        ```


        Results keep the existing fields and batch/credit limits. `can_dm_on_xchat=false` alone does not mean ordinary DMs are unavailable; the returned signals do not guarantee that sending will succeed.


        **Coming soon**: an object body with `users` and an optional sender `cookie` (`{"users":[...],"cookie":"..."}`). It is not yet available on the live API and currently returns HTTP 422; use the array format above until it ships.'
      operationId: dm_status_api_v2_v2_dm_status_post
      requestBody:
        content:
          application/json:
            schema:
              title: DMStatusRequest
              description: Send a string array of user IDs or usernames. The object form with users and an optional sender cookie is coming soon and not yet available.
              anyOf:
              - type: array
                items:
                  type: string
                title: LegacyTargetArray
                description: Original user ID or username array. Queries use service-managed accounts.
                example:
                - '44196397'
                - elonmusk
              - type: object
                title: SenderSessionRequest
                required:
                - users
                properties:
                  users:
                    type: array
                    items:
                      type: string
                    description: User IDs or usernames to check. Send numeric user IDs as strings.
                    example:
                    - '44196397'
                    - elonmusk
                  cookie:
                    type: string
                    pattern: \S
                    description: Optional actual sender's authorized X Cookie header value or raw auth_token. Omit to use service-managed accounts. Blank, null, or non-string values are invalid; authentication failures never fall back to the account pool.
                    example: auth_token=YOUR_X_AUTH_TOKEN; ct0=YOUR_CT0
                description: 'Coming soon: not yet available on the live API (returns HTTP 422). Use the supplied sender session when cookie is included; otherwise use service-managed accounts.'
                example:
                  users:
                  - '44196397'
                  - elonmusk
                  cookie: auth_token=YOUR_X_AUTH_TOKEN; ct0=YOUR_CT0
              example:
              - '44196397'
              - elonmusk
            example:
            - '44196397'
            - elonmusk
            examples:
              legacy_array:
                summary: Legacy array
                value:
                - '44196397'
                - elonmusk
        required: true
      responses:
        '200':
          description: A list of user DM status and verification metadata.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DMStatusResponseV2'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - HTTPBearer: []
  /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) or video via video_url (mutually exclusive). $0.0005 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: []
  /v3/twitter/dm-history:
    post:
      tags:
      - DM Endpoints
      summary: Get DM History (XChat v3)
      description: 'Get DM history via XChat encrypted chat API. Use count for page size (10–200). Set all=true to follow has_more and return every page. Or paginate manually: when has_more is true, pass the oldest message''s sequence_id as before.'
      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: []
  /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: []
  /v3/twitter/conversations:
    post:
      tags:
      - DM Endpoints
      summary: Get Conversations (XChat v3)
      description: Get XChat conversation list. Use count for page size (10–200). Set all=true to follow the inbox cursor and return every conversation.
      operationId: conversations_api_v3_v3_twitter_conversations_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetConversationsV3Query'
        required: true
      responses:
        '200':
          description: A list of conversation objects.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetConversationsV3Response'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - HTTPBearer: []
components:
  schemas:
    GetConversationsV3Response:
      properties:
        code:
          type: integer
          title: Code
          description: Response code
          example: 200
        msg:
          type: string
          title: Msg
          description: Response message
          example: success
        data:
          items:
            $ref: '#/components/schemas/ConversationV3Model'
          type: array
          title: Data
          description: Conversation list
      type: object
      required:
      - code
      - msg
      - data
      title: GetConversationsV3Response
      description: Response for getting XChat conversation list
    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
    GetConversationsV3Query:
      properties:
        count:
          anyOf:
          - type: integer
            maximum: 200
            minimum: 10
          - type: 'null'
          title: Count
          description: Max conversations per page (10–200, default 20).
          default: 100
          example: 100
        all:
          anyOf:
          - type: boolean
          - type: 'null'
          title: All
          description: Follow the inbox cursor and return every conversation (may be slow).
          default: false
          example: true
        cookie:
          type: string
          title: Cookie
          description: The user's own authorized Twitter session credentials or auth_token (BYOC — Bring Your Own Cookie). Stateless proxy execution with zero credential retention. See [Authentication Security](/authentication#write-operations--byoc-bring-your-own-cookie) and [How to get 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:
      - cookie
      title: GetConversationsV3Query
      description: Parameters for getting XChat conversation list
    ConversationV3Model:
      properties:
        conversation_id:
          type: string
          title: Conversation Id
          description: Conversation id
          example: 1928096185664843776:1989842918455291904
        type:
          type: string
          title: Type
          description: 'Conversation type: direct or group'
          example: direct
        is_muted:
          type: boolean
          title: Is Muted
          description: Whether the conversation is muted
          example: false
        participants:
          items:
            type: string
          type: array
          title: Participants
          description: Participant user ids
          example:
          - '1928096185664843776'
      type: object
      required:
      - conversation_id
      - type
      - is_muted
      - participants
      title: ConversationV3Model
      description: XChat conversation item
    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
    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: The user's own authorized Twitter session credentials or auth_token (BYOC — Bring Your Own Cookie). Stateless proxy execution with zero credential retention. See [Authentication Security](/authentication#write-operations--byoc-bring-your-own-cookie) and [How to get 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.
    DMStatusModelV2:
      properties:
        user_id:
          anyOf:
          - type: string
          - type: 'null'
          title: User Id
          description: The ID of the user.
        screen_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Screen Name
          description: The username of the user.
        is_blue_verified:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Blue Verified
        is_verified_organization_affiliate:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Verified Organization Affiliate
        verified:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Verified
        can_dm:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Can Dm
        can_dm_on_xchat:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Can Dm On Xchat
        dm_blocking:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Dm Blocking
        passes_premium_check:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Passes Premium Check
      type: object
      title: DMStatusModelV2
    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
    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). Mutually exclusive with video_url.
          example:
          - https://example.com/image.jpg
        video_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Video Url
          description: Public http(s) URL of one video to attach (mutually exclusive with image).
          example: https://video.twimg.com/amplify_video/2077160248830275584/vid/avc1/320x568/kwNDLTm
        pin:
          anyOf:
          - type: string
          - type: 'null'
          title: Pin
          description: Identity PIN (default 1234).
          default: '1234'
          example: '1234'
        cookie:
          type: string
          title: Cookie
          description: The user's own authorized Twitter session credentials or auth_token (BYOC — Bring Your Own Cookie). Stateless proxy execution with zero credential retention. See [Authentication Security](/authentication#write-operations--byoc-bring-your-own-cookie) and [How to get 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:
      - recipient
      - text
      - cookie
      title: SendDmV3Query
      description: Parameters for sending DM 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
    DMStatusResponseV2:
      properties:
        code:
          type: integer
          title: Code
          description: The status code of the response.
        msg:
          type: string
          title: Msg
          description: The message of the response.
        data:
          items:
            $ref: '#/components/schemas/DMStatusModelV2'
          type: array
          title: Data
          description: A list of DM status objects.
      type: object
      required:
      - code
      - msg
      - data
      title: DMStatusResponseV2
    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'
        count:
          anyOf:
          - type: integer
            maximum: 200
            minimum: 10
          - type: 'null'
          title: Count
          description: Max events per page (10–200, default 50).
          default: 50
          example: 50
        all:
          anyOf:
          - type: boolean
          - type: 'null'
          title: All
          description: Follow has_more and return every page.
          default: false
          example: false
        before:
          anyOf:
          - type: string
          - type: 'null'
          title: Before
          description: Oldest sequenceId for paging. Pass the previous page's oldest message sequence_id.
          example: '2076684837654876160'
        cookie:
          type: string
          title: Cookie
          description: The user's own authorized Twitter session credentials or auth_token (BYOC — Bring Your Own Cookie). Stateless proxy execution with zero credential retention. See [Authentication Security](/authentication#write-operations--byoc-bring-your-own-cookie) and [How to get 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:
      - recipient
      - cookie
      title: GetDmHistoryV3Query
      description: Parameters for getting DM history via 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
    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
    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
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer