X (Twitter) Direct Messages API

Endpoints related to retrieving, managing Direct Messages

Operations 9

POST /2/dm_conversations X Create DM Conversation #
GET /2/dm_conversations/media/{dm_id}/{media_id}/{resource_id} X Download DM Media #
GET /2/dm_conversations/with/{participant_id}/dm_events X Get DM Events for a DM Conversation #
POST /2/dm_conversations/with/{participant_id}/messages X Create DM Message by Participant ID #
POST /2/dm_conversations/{dm_conversation_id}/messages X Create DM Message by Conversation ID #
GET /2/dm_conversations/{id}/dm_events X Get DM Events for a DM Conversation #
GET /2/dm_events X Get DM Events #
DELETE /2/dm_events/{event_id} X Delete DM Event #
GET /2/dm_events/{event_id} X Get DM Event by ID #

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/twitter-direct-messages-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

twitter-direct-messages-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  description: X API v2 available endpoints
  version: '2.161'
  title: X API v2 Account Activity Direct Messages API
  termsOfService: https://developer.x.com/en/developer-terms/agreement-and-policy.html
  contact:
    name: X Developers
    url: https://developer.x.com/
  license:
    name: X Developer Agreement and Policy
    url: https://developer.x.com/en/developer-terms/agreement-and-policy.html
servers:
- description: X API
  url: https://api.x.com
tags:
- name: Direct Messages
  description: Endpoints related to retrieving, managing Direct Messages
  externalDocs:
    description: Find out more
    url: https://developer.twitter.com/en/docs/twitter-api/direct-messages
paths:
  /2/dm_conversations:
    post:
      security:
      - OAuth2UserToken:
        - dm.write
        - tweet.read
        - users.read
      - UserToken: []
      tags:
      - Direct Messages
      summary: X Create DM Conversation
      description: Initiates a new direct message conversation with specified participants.
      operationId: createDirectMessagesConversation
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDmConversationRequest'
      responses:
        '201':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateDmEventResponse'
        default:
          description: The request has failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /2/dm_conversations/media/{dm_id}/{media_id}/{resource_id}:
    get:
      security:
      - OAuth2UserToken:
        - dm.read
      tags:
      - Direct Messages
      summary: X Download DM Media
      description: Downloads media attached to a legacy Direct Message. The requesting user must be a participant in the conversation containing the specified DM event. The response body contains raw binary bytes.
      externalDocs:
        url: https://developer.x.com/
      operationId: dmConversationsMediaDownload
      parameters:
      - name: dm_id
        in: path
        description: The unique identifier of the Direct Message event containing the media.
        required: true
        schema:
          $ref: '#/components/schemas/DmEventId'
        style: simple
        example: '1234567890'
      - name: media_id
        in: path
        description: The unique identifier of the media attached to the Direct Message.
        required: true
        schema:
          $ref: '#/components/schemas/MediaId'
        style: simple
        example: '1234567890'
      - name: resource_id
        in: path
        description: The resource identifier of the media file, including file extension (e.g. 'hVJQTwig.jpg').
        required: true
        schema:
          $ref: '#/components/schemas/DmResourceId'
        style: simple
        example: '1234567890'
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/octet-stream:
              schema:
                $ref: '#/components/schemas/BinaryPayload'
        default:
          description: The request has failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /2/dm_conversations/with/{participant_id}/dm_events:
    get:
      security:
      - OAuth2UserToken:
        - dm.read
        - tweet.read
        - users.read
      - UserToken: []
      tags:
      - Direct Messages
      summary: X Get DM Events for a DM Conversation
      description: Retrieves direct message events for a specific conversation.
      operationId: getDirectMessagesEventsByParticipantId
      parameters:
      - name: participant_id
        in: path
        description: The ID of the participant user for the One to One DM conversation.
        required: true
        schema:
          $ref: '#/components/schemas/UserId'
        style: simple
        example: '1234567890'
      - name: max_results
        in: query
        description: The maximum number of results.
        required: false
        schema:
          type: integer
          minimum: 1
          maximum: 100
          format: int32
          default: 100
        style: form
        example: 10
      - name: pagination_token
        in: query
        description: This parameter is used to get a specified 'page' of results.
        required: false
        schema:
          $ref: '#/components/schemas/PaginationToken32'
        style: form
        example: next_token_abc123
      - name: event_types
        in: query
        description: The set of event_types to include in the results.
        required: false
        schema:
          type: array
          minItems: 1
          uniqueItems: true
          items:
            type: string
            enum:
            - MessageCreate
            - ParticipantsJoin
            - ParticipantsLeave
          default:
          - MessageCreate
          - ParticipantsLeave
          - ParticipantsJoin
          example:
          - MessageCreate
          - ParticipantsLeave
        explode: false
        style: form
        example:
        - MessageCreate
        - ParticipantsLeave
      - $ref: '#/components/parameters/DmEventFieldsParameter'
      - $ref: '#/components/parameters/DmEventExpansionsParameter'
      - $ref: '#/components/parameters/MediaFieldsParameter'
      - $ref: '#/components/parameters/UserFieldsParameter'
      - $ref: '#/components/parameters/TweetFieldsParameter'
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Get2DmConversationsWithParticipantIdDmEventsResponse'
        default:
          description: The request has failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /2/dm_conversations/with/{participant_id}/messages:
    post:
      security:
      - OAuth2UserToken:
        - dm.write
        - tweet.read
        - users.read
      - UserToken: []
      tags:
      - Direct Messages
      summary: X Create DM Message by Participant ID
      description: Sends a new direct message to a specific participant by their ID.
      operationId: createDirectMessagesByParticipantId
      parameters:
      - name: participant_id
        in: path
        description: The ID of the recipient user that will receive the DM.
        required: true
        schema:
          $ref: '#/components/schemas/UserId'
        style: simple
        example: '1234567890'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMessageRequest'
      responses:
        '201':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateDmEventResponse'
        default:
          description: The request has failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /2/dm_conversations/{dm_conversation_id}/messages:
    post:
      security:
      - OAuth2UserToken:
        - dm.write
        - tweet.read
        - users.read
      - UserToken: []
      tags:
      - Direct Messages
      summary: X Create DM Message by Conversation ID
      description: Sends a new direct message to a specific conversation by its ID.
      operationId: createDirectMessagesByConversationId
      parameters:
      - name: dm_conversation_id
        in: path
        description: The DM Conversation ID.
        required: true
        schema:
          type: string
        style: simple
        example: '1234567890'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMessageRequest'
      responses:
        '201':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateDmEventResponse'
        default:
          description: The request has failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /2/dm_conversations/{id}/dm_events:
    get:
      security:
      - OAuth2UserToken:
        - dm.read
        - tweet.read
        - users.read
      - UserToken: []
      tags:
      - Direct Messages
      summary: X Get DM Events for a DM Conversation
      description: Retrieves direct message events for a specific conversation.
      operationId: getDirectMessagesEventsByConversationId
      parameters:
      - name: id
        in: path
        description: The DM conversation ID.
        required: true
        schema:
          $ref: '#/components/schemas/DmConversationId'
        style: simple
        example: '1234567890'
      - name: max_results
        in: query
        description: The maximum number of results.
        required: false
        schema:
          type: integer
          minimum: 1
          maximum: 100
          format: int32
          default: 100
        style: form
        example: 10
      - name: pagination_token
        in: query
        description: This parameter is used to get a specified 'page' of results.
        required: false
        schema:
          $ref: '#/components/schemas/PaginationToken32'
        style: form
        example: next_token_abc123
      - name: event_types
        in: query
        description: The set of event_types to include in the results.
        required: false
        schema:
          type: array
          minItems: 1
          uniqueItems: true
          items:
            type: string
            enum:
            - MessageCreate
            - ParticipantsJoin
            - ParticipantsLeave
          default:
          - MessageCreate
          - ParticipantsLeave
          - ParticipantsJoin
          example:
          - MessageCreate
          - ParticipantsLeave
        explode: false
        style: form
        example:
        - MessageCreate
        - ParticipantsLeave
      - $ref: '#/components/parameters/DmEventFieldsParameter'
      - $ref: '#/components/parameters/DmEventExpansionsParameter'
      - $ref: '#/components/parameters/MediaFieldsParameter'
      - $ref: '#/components/parameters/UserFieldsParameter'
      - $ref: '#/components/parameters/TweetFieldsParameter'
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Get2DmConversationsIdDmEventsResponse'
        default:
          description: The request has failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /2/dm_events:
    get:
      security:
      - OAuth2UserToken:
        - dm.read
        - tweet.read
        - users.read
      - UserToken: []
      tags:
      - Direct Messages
      summary: X Get DM Events
      description: Retrieves a list of recent direct message events across all conversations.
      operationId: getDirectMessagesEvents
      parameters:
      - name: max_results
        in: query
        description: The maximum number of results.
        required: false
        schema:
          type: integer
          minimum: 1
          maximum: 100
          format: int32
          default: 100
        style: form
        example: 10
      - name: pagination_token
        in: query
        description: This parameter is used to get a specified 'page' of results.
        required: false
        schema:
          $ref: '#/components/schemas/PaginationToken32'
        style: form
        example: next_token_abc123
      - name: event_types
        in: query
        description: The set of event_types to include in the results.
        required: false
        schema:
          type: array
          minItems: 1
          uniqueItems: true
          items:
            type: string
            enum:
            - MessageCreate
            - ParticipantsJoin
            - ParticipantsLeave
          default:
          - MessageCreate
          - ParticipantsLeave
          - ParticipantsJoin
          example:
          - MessageCreate
          - ParticipantsLeave
        explode: false
        style: form
        example:
        - MessageCreate
        - ParticipantsLeave
      - $ref: '#/components/parameters/DmEventFieldsParameter'
      - $ref: '#/components/parameters/DmEventExpansionsParameter'
      - $ref: '#/components/parameters/MediaFieldsParameter'
      - $ref: '#/components/parameters/UserFieldsParameter'
      - $ref: '#/components/parameters/TweetFieldsParameter'
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Get2DmEventsResponse'
        default:
          description: The request has failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /2/dm_events/{event_id}:
    delete:
      security:
      - OAuth2UserToken:
        - dm.read
        - dm.write
      - UserToken: []
      tags:
      - Direct Messages
      summary: X Delete DM Event
      description: Deletes a specific direct message event by its ID, if owned by the authenticated user.
      operationId: deleteDirectMessagesEvents
      parameters:
      - name: event_id
        in: path
        description: The ID of the direct-message event to delete.
        required: true
        schema:
          $ref: '#/components/schemas/DmEventId'
        style: simple
        example: '1234567890'
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteDmResponse'
        default:
          description: The request has failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    get:
      security:
      - OAuth2UserToken:
        - dm.read
        - tweet.read
        - users.read
      - UserToken: []
      tags:
      - Direct Messages
      summary: X Get DM Event by ID
      description: Retrieves details of a specific direct message event by its ID.
      operationId: getDirectMessagesEventsById
      parameters:
      - name: event_id
        in: path
        description: dm event id.
        required: true
        schema:
          $ref: '#/components/schemas/DmEventId'
        style: simple
        example: '1234567890'
      - $ref: '#/components/parameters/DmEventFieldsParameter'
      - $ref: '#/components/parameters/DmEventExpansionsParameter'
      - $ref: '#/components/parameters/MediaFieldsParameter'
      - $ref: '#/components/parameters/UserFieldsParameter'
      - $ref: '#/components/parameters/TweetFieldsParameter'
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Get2DmEventsEventIdResponse'
        default:
          description: The request has failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    NextToken:
      type: string
      description: The next token.
      minLength: 1
    CashtagFields:
      type: object
      description: Represent the portion of text recognized as a Cashtag, and its start and end position within the text.
      required:
      - tag
      properties:
        tag:
          type: string
          example: TWTR
    NoteTweetText:
      type: string
      description: The note content of the Tweet.
      example: Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\u2026 https:\/\/t.co\/56a0vZUx7i
    PlaceId:
      type: string
      description: The identifier for this place.
      example: f7eb2fa2fea288b1
    Poll:
      type: object
      description: Represent a Poll attached to a Tweet.
      required:
      - id
      - options
      properties:
        duration_minutes:
          type: integer
          minimum: 5
          maximum: 10080
          format: int32
        end_datetime:
          type: string
          format: date-time
        id:
          $ref: '#/components/schemas/PollId'
        options:
          type: array
          minItems: 2
          maxItems: 4
          items:
            $ref: '#/components/schemas/PollOption'
        voting_status:
          type: string
          enum:
          - open
          - closed
    DmResourceId:
      type: string
      description: The resource identifier of the media file, including file extension.
      pattern: ^[a-zA-Z0-9_.-]{1,50}$
      example: tJg5kUG5RKPi3jNi.jpg
    Media:
      type: object
      required:
      - type
      properties:
        height:
          $ref: '#/components/schemas/MediaHeight'
        media_key:
          $ref: '#/components/schemas/MediaKey'
        type:
          type: string
        width:
          $ref: '#/components/schemas/MediaWidth'
      discriminator:
        propertyName: type
        mapping:
          animated_gif: '#/components/schemas/AnimatedGif'
          photo: '#/components/schemas/Photo'
          video: '#/components/schemas/Video'
    DisplayTextRange:
      type: array
      description: Represent a boundary range (start and end zero-based indices) for the portion of text that is displayed for a post. `start` must be smaller than `end`. The start index is inclusive, the end index is exclusive.
      minItems: 2
      maxItems: 2
      items:
        type: integer
        minimum: 0
    DmAttachments:
      type: array
      description: Attachments to a DM Event.
      items:
        $ref: '#/components/schemas/DmMediaAttachment'
    UserWithheld:
      type: object
      description: Indicates withholding details for [withheld content](https://help.twitter.com/en/rules-and-policies/tweet-withheld-by-country).
      required:
      - country_codes
      properties:
        country_codes:
          type: array
          description: Provides a list of countries where this content is not available.
          minItems: 1
          uniqueItems: true
          items:
            $ref: '#/components/schemas/CountryCode'
        scope:
          type: string
          description: Indicates that the content being withheld is a `user`.
          enum:
          - user
    PaginationToken32:
      type: string
      description: A base32 pagination token.
      minLength: 16
    Place:
      type: object
      required:
      - id
      - full_name
      properties:
        contained_within:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/PlaceId'
        country:
          type: string
          description: The full name of the county in which this place exists.
          example: United States
        country_code:
          $ref: '#/components/schemas/CountryCode'
        full_name:
          type: string
          description: The full name of this place.
          example: Lakewood, CO
        geo:
          $ref: '#/components/schemas/Geo'
        id:
          $ref: '#/components/schemas/PlaceId'
        name:
          type: string
          description: The human readable name of this place.
          example: Lakewood
        place_type:
          $ref: '#/components/schemas/PlaceType'
    MediaWidth:
      type: integer
      description: The width of the media in pixels.
      minimum: 0
    BinaryPayload:
      type: string
      description: Raw binary data bytes.
      format: binary
    DmEvent:
      type: object
      required:
      - id
      - event_type
      properties:
        attachments:
          type: object
          description: Specifies the type of attachments (if any) present in this DM.
          properties:
            card_ids:
              type: array
              description: A list of card IDs (if cards are attached).
              minItems: 1
              items:
                type: string
            media_keys:
              type: array
              description: A list of Media Keys for each one of the media attachments (if media are attached).
              minItems: 1
              items:
                $ref: '#/components/schemas/MediaKey'
        cashtags:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/CashtagEntity'
        created_at:
          type: string
          format: date-time
        dm_conversation_id:
          $ref: '#/components/schemas/DmConversationId'
        event_type:
          type: string
          example: MessageCreate
        hashtags:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/HashtagEntity'
        id:
          $ref: '#/components/schemas/DmEventId'
        mentions:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/MentionEntity'
        participant_ids:
          type: array
          description: A list of participants for a ParticipantsJoin or ParticipantsLeave event_type.
          minItems: 1
          items:
            $ref: '#/components/schemas/UserId'
        referenced_tweets:
          type: array
          description: A list of Posts this DM refers to.
          minItems: 1
          items:
            type: object
            required:
            - id
            properties:
              id:
                $ref: '#/components/schemas/TweetId'
        sender_id:
          $ref: '#/components/schemas/UserId'
        text:
          type: string
        urls:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/UrlEntityDm'
    HashtagFields:
      type: object
      description: Represent the portion of text recognized as a Hashtag, and its start and end position within the text.
      required:
      - tag
      properties:
        tag:
          type: string
          description: The text of the Hashtag.
          example: MondayMotivation
    TopicId:
      type: string
      description: Unique identifier of this Topic.
    MentionFields:
      type: object
      description: Represent the portion of text recognized as a User mention, and its start and end position within the text.
      required:
      - username
      properties:
        id:
          $ref: '#/components/schemas/UserId'
        username:
          $ref: '#/components/schemas/UserName'
    EntityIndicesInclusiveExclusive:
      type: object
      description: Represent a boundary range (start and end index) for a recognized entity (for example a hashtag or a mention). `start` must be smaller than `end`.  The start index is inclusive, the end index is exclusive.
      required:
      - start
      - end
      properties:
        end:
          type: integer
          description: Index (zero-based) at which position this entity ends.  The index is exclusive.
          minimum: 0
          example: 61
        start:
          type: integer
          description: Index (zero-based) at which position this entity starts.  The index is inclusive.
          minimum: 0
          example: 50
    DmMediaAttachment:
      type: object
      required:
      - media_id
      properties:
        media_id:
          $ref: '#/components/schemas/MediaId'
    Error:
      type: object
      required:
      - code
      - message
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
    TweetWithheld:
      type: object
      description: Indicates withholding details for [withheld content](https://help.twitter.com/en/rules-and-policies/tweet-withheld-by-country).
      required:
      - copyright
      - country_codes
      properties:
        copyright:
          type: boolean
          description: Indicates if the content is being withheld for on the basis of copyright infringement.
        country_codes:
          type: array
          description: Provides a list of countries where this content is not available.
          minItems: 1
          uniqueItems: true
          items:
            $ref: '#/components/schemas/CountryCode'
        scope:
          type: string
          description: Indicates whether the content being withheld is the `tweet` or a `user`.
          enum:
          - tweet
          - user
    Get2DmConversationsIdDmEventsResponse:
      type: object
      properties:
        data:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/DmEvent'
        errors:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/Problem'
        includes:
          $ref: '#/components/schemas/Expansions'
        meta:
          type: object
          properties:
            next_token:
              $ref: '#/components/schemas/NextToken'
            previous_token:
              $ref: '#/components/schemas/PreviousToken'
            result_count:
              $ref: '#/components/schemas/ResultCount'
    PreviousToken:
      type: string
      description: The previous token.
      minLength: 1
    TweetText:
      type: string
      description: The content of the Tweet.
      example: Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\u2026 https:\/\/t.co\/56a0vZUx7i
    ContextAnnotationEntityFields:
      type: object
      description: Represents the data for the context annotation entity.
      required:
      - id
      properties:
        description:
          type: string
          description: Description of the context annotation entity.
          example: Example description for this resource.
        id:
          type: string
          description: The unique id for a context annotation entity.
          pattern: ^[0-9]{1,19}$
          example: '1234567890'
        name:
          type: string
          description: Name of the context annotation entity.
          example: Example User
    ResultCount:
      type: integer
      description: The number of results returned in this response.
      format: int32
    Expansions:
      type: object
      properties:
        media:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/Media'
        places:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/Place'
        polls:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/Poll'
        topics:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/Topic'
        tweets:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/Tweet'
        users:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/User'
    Tweet:
      type: object
      properties:
        attachments:
          type: object
          description: Specifies the type of attachments (if any) present in this Tweet.
          properties:
            media_keys:
              type: array
              description: A list of Media Keys for each one of the media attachments (if media are attached).
              minItems: 1
              items:
                $ref: '#/components/schemas/MediaKey'
            media_source_tweet_id:
              type: array
              description: A list of Posts the media on this Tweet was originally posted in. For example, if the media on a tweet is re-used in another Tweet, this refers to the original, source Tweet..
              minItems: 1
              items:
                $ref: '#/components/schemas/TweetId'
            poll_ids:
              type: array
              description: A list of poll IDs (if polls are attached).
              minItems: 1
              items:
                $ref: '#/components/schemas/PollId'
        author_id:
          $ref: '#/components/schemas/UserId'
        community_id:
          $ref: '#/components/schemas/CommunityId'
        context_annotations:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/ContextAnnotation'
        conversation_id:
          $ref: '#/components/schemas/TweetId'
        created_at:
          type: string
          description: Creation time of the Tweet.
          format: date-time
          example: '2021-01-06T18:40:40.000Z'
        display_text_range:
          $ref: '#/components/schemas/DisplayTextRange'
        edit_controls:
          type: object
          required:
          - is_edit_eligible
          - editable_until
          - edits_remaining
          properties:
            editable_until:
              type: string
              description: Time when Tweet is no longer editable.
              format: date-time
              example: '2021-01-06T18:40:40.000Z'
            edits_remaining:
              type: integer
              description: Number of times this Tweet can be edited.
            is_edit_eligible:
              type: boolean
              description: Indicates if this Tweet is eligible to be edited.
              example: false
        edit_history_tweet_ids:
          type: array
          description: A list of Tweet Ids in this Tweet chain.
          minItems: 1
          items:
            $ref: '#/components/schemas/TweetId'
        entities:
          $ref: '#/components/schemas/FullTextEntities'
        geo:
          type: object
          description: The location tagged on the Tweet, if the user provided one.
          properties:
            coordinates:
              $ref: '#/components/schemas/Point'
            place_id:
              $ref: '#/components/schemas/PlaceId'
        id:
          $ref: '#/components/schemas/TweetId'
        in_reply_to_user_id:
          $ref: '#/components/schemas/UserId'
        lang:
          type: string
          description: Language of the Tweet, if detected by X. Returned as a BCP47 language tag.
          example: en
        non_public_metrics:
          type: object
          description: Nonpublic engagement metrics for the Tweet at the time of the request.

# --- truncated at 32 KB (67 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/twitter/refs/heads/main/openapi/twitter-direct-messages-api-openapi.yml