X (Twitter) website screenshot

X (Twitter)

X (formerly Twitter) is a social media platform providing APIs for accessing and integrating with posts, users, spaces, direct messages, lists, media, trends, and real-time streaming data. The X API enables developers to build applications that read and write X data, manage advertising campaigns, and subscribe to real-time activity events. Available through pay-per-use credit-based pricing with enterprise options for high-volume access.

3 APIs 12 Features
Social MediaMicrobloggingReal-Time DataStreamingAdvertisingContent

APIs

X API

The core X API providing programmatic access to posts, users, spaces, lists, direct messages, bookmarks, likes, reposts, follows, blocks, mutes, trends, communities, and complia...

X Ads API

The X Ads API enables programmatic management of advertising campaigns on the X platform including campaign creation and scheduling, custom audience building, creative managemen...

X Activity API

The X Activity API provides real-time activity event subscriptions with sub-second delivery via streaming or webhooks. Subscribe to profile updates, follows, likes, reposts, and...

Collections

X API v2

POSTMAN

X API v2

OPEN

Arazzo Workflows

X Search, Bookmark a Post, Then Remove the Bookmark

Find a post by search, bookmark it, then delete that bookmark.

ARAZZO

X Create a List and Add a Member by Username

Create a new List, resolve a member handle, and add them to the List.

ARAZZO

X Confirm a List and Follow It

Read a List by id to confirm it exists, then follow that List.

ARAZZO

X Follow a User by Their Username

Resolve a target handle to an id, then follow that user.

ARAZZO

X List the Followers of a Handle

Resolve a username to an id, then page that user's followers.

ARAZZO

X List the Posts a Handle Has Liked

Resolve a username to an id, then fetch that user's liked posts.

ARAZZO

X Fetch a List's Details and Its Members

Read a List by id, then page the members of that List.

ARAZZO

X List the Posts Mentioning a Handle

Resolve a username to an id, then fetch posts that mention that user.

ARAZZO

X Mute a User by Their Username

Resolve a target handle to an id, then mute that user.

ARAZZO

X Pin the Authenticated User's First Owned List

List the owned Lists, then pin the first one to the user's profile.

ARAZZO

X Audit Engagement on a User's Latest Post

Resolve a handle, get their latest post, then list who liked it.

ARAZZO

X Create a Post, Like It, Then Delete It

Publish a post, like it from the authenticated account, then remove it.

ARAZZO

X Quote a Post Found by Search

Search recent posts, then publish a quote post of the top match.

ARAZZO

X Reply to a User's Latest Post

Resolve a handle, fetch their latest post, then reply to it.

ARAZZO

X Find a Post, Repost It, Then Undo the Repost

Search for a post, repost the top match, then remove the repost.

ARAZZO

X List Who Reposted a Handle's Latest Post

Resolve a handle, get their latest post, then list who reposted it.

ARAZZO

X Search Recent Posts and Hydrate the Top Match

Run a recent search, then fetch full details for the first matching post.

ARAZZO

X Unfollow a User by Their Username

Resolve a target handle to an id, then unfollow that user.

ARAZZO

X Resolve User and List Their Recent Posts

Look up a user by username, then pull their most recent posts.

ARAZZO

GraphQL

Twitter (X) GraphQL Schema

This conceptual GraphQL schema models the Twitter (X) API v2 data model. The X API v2 is a REST API available at `https://api.x.com/2`, but the types defined here represent the ...

GRAPHQL

Pricing Plans

Twitter Plans Pricing

1 plans

PLANS

Rate Limits

Twitter Rate Limits

13 limits

RATE LIMITS

FinOps

Features

Post Management

Create, delete, edit, repost, quote, like, and bookmark posts programmatically.

Real-Time Streaming

Access filtered streams, sampled streams, firehose, and language-specific streams for real-time post data.

Full-Archive Search

Search the complete archive of public posts with advanced query operators and date filtering.

User Lookup and Management

Look up users by ID or username, manage follows, blocks, mutes, and retrieve user metrics.

Spaces

Discover and look up live audio Spaces with host, speaker, and listener data.

Direct Messages

Send and receive direct messages, create conversations, and manage participants.

Lists

Create, manage, and query lists including membership, followers, and pinned lists.

Trends

Access personalized and geographic trending topics.

Media Upload

Upload images, videos, and large files using chunked upload with metadata and subtitle support.

Compliance

Access compliance streams and batch jobs for data deletion and user protection events.

Communities and Community Notes

Access community data and community notes for collaborative fact-checking.

Ad Campaign Management

Programmatically create, schedule, and manage advertising campaigns with targeting and budget controls.

Use Cases

Social Listening

Monitor brand mentions, sentiment, and conversations in real-time using filtered streams and search endpoints.

Content Publishing

Automate post creation, scheduling, and thread publishing for social media management platforms.

Analytics and Reporting

Retrieve post metrics, user engagement data, and campaign performance for business intelligence.

Bot Development

Build automated accounts that respond to mentions, post updates, or provide customer service.

Research and Academic Analysis

Access full-archive search and streaming data for social media research and trend analysis.

Advertising Automation

Programmatically manage ad campaigns, audiences, creatives, and bidding strategies at scale.

Real-Time Event Monitoring

Track live events, breaking news, and trending topics with streaming APIs and trend endpoints.

Community Management

Manage followers, lists, and direct messages for community engagement and moderation.

Integrations

Postman

Official Postman collections for exploring and testing X API endpoints interactively.

MCP Servers

Integration with AI tools and agents through Model Context Protocol servers.

Webhook Delivery

Real-time event delivery via webhooks for the Activity API.

Solutions

X API Pay-Per-Use

Credit-based pricing with no commitments. Pay only for what you use with access to core X API endpoints.

X API Enterprise

High-volume access with custom rate limits, dedicated account management, full firehose, and premium support.

X Ads API

Advertising platform API for campaign management, audience targeting, creative management, and analytics.

Semantic Vocabularies

X Api Context

23 classes · 118 properties

JSON-LD

API Governance Rules

X (Twitter) API Rules

53 rules · 17 errors 18 warnings 18 info

SPECTRAL

JSON Structure

X Api Activity Streaming Response Structure

2 properties

JSON STRUCTURE

X Api Activity Subscription Structure

7 properties

JSON STRUCTURE

X Api Add Or Delete Rules Request Structure

0 properties

JSON STRUCTURE

X Api Compliance Job Status Structure

0 properties

JSON STRUCTURE

X Api Compliance Job Structure

9 properties

JSON STRUCTURE

X Api Dm Event Structure

13 properties

JSON STRUCTURE

X Api Error Structure

2 properties

JSON STRUCTURE

X Api Expansions Structure

6 properties

JSON STRUCTURE

X Api Get2 Users Id Response Structure

3 properties

JSON STRUCTURE

X Api List Create Request Structure

3 properties

JSON STRUCTURE

X Api List Structure

8 properties

JSON STRUCTURE

X Api Media Structure

4 properties

JSON STRUCTURE

X Api Place Structure

8 properties

JSON STRUCTURE

X Api Poll Structure

5 properties

JSON STRUCTURE

X Api Problem Structure

4 properties

JSON STRUCTURE

X Api Space Structure

17 properties

JSON STRUCTURE

X Api Tweet Create Request Structure

16 properties

JSON STRUCTURE

X Api Tweet Create Response Structure

2 properties

JSON STRUCTURE

X Api Tweet Delete Response Structure

2 properties

JSON STRUCTURE

X Api Tweet Structure

29 properties

JSON STRUCTURE

X Api User Structure

21 properties

JSON STRUCTURE

Example Payloads

X Api Compliance Job Example

9 fields

EXAMPLE

X Api Dm Event Example

10 fields

EXAMPLE

X Api Error Example

2 fields

EXAMPLE

X Api Expansions Example

6 fields

EXAMPLE

X Api List Example

8 fields

EXAMPLE

X Api Media Example

4 fields

EXAMPLE

X Api Place Example

8 fields

EXAMPLE

X Api Poll Example

5 fields

EXAMPLE

X Api Problem Example

4 fields

EXAMPLE

X Api Space Example

10 fields

EXAMPLE

X Api Tweet Example

10 fields

EXAMPLE

X Api User Example

10 fields

EXAMPLE

Resources

🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
LinkedIn
LinkedIn
🌐
Portal
Portal
🚀
GettingStarted
GettingStarted
🌐
Console
Console
📝
Signup
Signup
🔑
Authentication
Authentication
📦
Python XDK
SDKs
📦
TypeScript XDK
SDKs
🔗
xurl
CLI
💰
Pricing
Pricing
📜
TermsOfService
TermsOfService
📜
PrivacyPolicy
PrivacyPolicy
🟢
StatusPage
StatusPage
💬
Support
Support
📰
Blog
Blog
📄
ReleaseNotes
ReleaseNotes
👥
GitHubOrganization
GitHubOrganization
👥
GitHubRepository
GitHubRepository
👥
GitHubRepository
GitHubRepository
👥
GitHubRepository
GitHubRepository
👥
GitHubRepository
GitHubRepository
👥
GitHubRepository
GitHubRepository
👥
GitHubRepository
GitHubRepository
🔧
Tools
Tools
🔗
Sandbox
Sandbox
💻
CodeExamples
CodeExamples
💻
CodeExamples
CodeExamples
🔗
PostmanWorkspace
PostmanWorkspace
🔗
PostmanCollection
PostmanCollection
🔗
X
X

Sources

Raw ↑
opencollection: 1.0.0
info:
  name: X API v2
  version: '2.161'
items:
- info:
    name: Account Activity
    type: folder
  items:
  - info:
      name: X Create Replay Job
      type: http
    http:
      method: POST
      url: https://api.x.com/2/account_activity/replay/webhooks/:webhook_id/subscriptions/all
      params:
      - name: webhook_id
        value: '1234567890'
        type: path
        description: The unique identifier for the webhook configuration.
      - name: from_date
        value: '202504242000'
        type: query
        description: The oldest (starting) UTC timestamp (inclusive) from which events will be provided, in `yyyymmddhhmm`
          format.
      - name: to_date
        value: '202504242200'
        type: query
        description: The latest (ending) UTC timestamp (exclusive) up to which events will be provided, in `yyyymmddhhmm`
          format.
      auth:
        type: bearer
        token: '{{bearerToken}}'
    docs: Creates a replay job to retrieve activities from up to the past 5 days for all subscriptions associated with a given
      webhook.
  - info:
      name: X Get Subscription Count
      type: http
    http:
      method: GET
      url: https://api.x.com/2/account_activity/subscriptions/count
      auth:
        type: bearer
        token: '{{bearerToken}}'
    docs: Retrieves a count of currently active Account Activity subscriptions.
  - info:
      name: X Validate Subscription
      type: http
    http:
      method: GET
      url: https://api.x.com/2/account_activity/webhooks/:webhook_id/subscriptions/all
      params:
      - name: webhook_id
        value: '1234567890'
        type: path
        description: The webhook ID to check subscription against.
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Checks a user’s Account Activity subscription for a given webhook.
  - info:
      name: X Create Subscription
      type: http
    http:
      method: POST
      url: https://api.x.com/2/account_activity/webhooks/:webhook_id/subscriptions/all
      params:
      - name: webhook_id
        value: '1234567890'
        type: path
        description: The webhook ID to check subscription against.
      body:
        type: json
        data: '{}'
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Creates an Account Activity subscription for the user and the given webhook.
  - info:
      name: X Get Subscriptions
      type: http
    http:
      method: GET
      url: https://api.x.com/2/account_activity/webhooks/:webhook_id/subscriptions/all/list
      params:
      - name: webhook_id
        value: '1234567890'
        type: path
        description: The webhook ID to pull subscriptions for.
      auth:
        type: bearer
        token: '{{bearerToken}}'
    docs: Retrieves a list of all active subscriptions for a given webhook.
  - info:
      name: X Delete Subscription
      type: http
    http:
      method: DELETE
      url: https://api.x.com/2/account_activity/webhooks/:webhook_id/subscriptions/:user_id/all
      params:
      - name: webhook_id
        value: '1234567890'
        type: path
        description: The webhook ID to check subscription against.
      - name: user_id
        value: '1234567890'
        type: path
        description: User ID to unsubscribe from.
      auth:
        type: bearer
        token: '{{bearerToken}}'
    docs: Deletes an Account Activity subscription for the given webhook and user ID.
- info:
    name: Activity
    type: folder
  items:
  - info:
      name: X Activity Stream
      type: http
    http:
      method: GET
      url: https://api.x.com/2/activity/stream
      params:
      - name: backfill_minutes
        value: '42'
        type: query
        description: The number of minutes of backfill requested.
      - name: start_time
        value: '2021-02-01T18:40:40.000Z'
        type: query
        description: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided.
      - name: end_time
        value: '2021-02-01T18:40:40.000Z'
        type: query
        description: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided.
      auth:
        type: bearer
        token: '{{bearerToken}}'
    docs: Stream of X Activities
  - info:
      name: X Get X Activity Subscriptions
      type: http
    http:
      method: GET
      url: https://api.x.com/2/activity/subscriptions
      params:
      - name: max_results
        value: '10'
        type: query
        description: The maximum number of results to return per page.
      - name: pagination_token
        value: next_token_abc123
        type: query
        description: This parameter is used to get the next 'page' of results.
      auth:
        type: bearer
        token: '{{bearerToken}}'
    docs: Get a list of active subscriptions for XAA
  - info:
      name: X Create X Activity Subscription
      type: http
    http:
      method: POST
      url: https://api.x.com/2/activity/subscriptions
      body:
        type: json
        data: '{}'
      auth:
        type: bearer
        token: '{{bearerToken}}'
    docs: Creates a subscription for an X activity event
  - info:
      name: X Delete X Activity Subscriptions by IDs
      type: http
    http:
      method: DELETE
      url: https://api.x.com/2/activity/subscriptions
      params:
      - name: ids
        value: ''
        type: query
        description: Comma-separated list of subscription IDs to delete.
      auth:
        type: bearer
        token: '{{bearerToken}}'
    docs: Deletes multiple subscriptions for X activity events by their IDs
  - info:
      name: X Update X Activity Subscription
      type: http
    http:
      method: PUT
      url: https://api.x.com/2/activity/subscriptions/:subscription_id
      params:
      - name: subscription_id
        value: '1234567890'
        type: path
        description: The ID of the subscription to update.
      body:
        type: json
        data: '{}'
      auth:
        type: bearer
        token: '{{bearerToken}}'
    docs: Updates a subscription for an X activity event
  - info:
      name: X Deletes X Activity Subscription
      type: http
    http:
      method: DELETE
      url: https://api.x.com/2/activity/subscriptions/:subscription_id
      params:
      - name: subscription_id
        value: '1234567890'
        type: path
        description: The ID of the subscription to delete.
      auth:
        type: bearer
        token: '{{bearerToken}}'
    docs: Deletes a subscription for an X activity event
- info:
    name: Chat
    type: folder
  items:
  - info:
      name: X Get Chat Conversations
      type: http
    http:
      method: GET
      url: https://api.x.com/2/chat/conversations
      params:
      - name: max_results
        value: '10'
        type: query
        description: Maximum number of conversations to return.
      - name: pagination_token
        value: next_token_abc123
        type: query
        description: Token for pagination to retrieve the next page of results.
      - name: chat_conversation.fields
        value: ''
        type: query
        description: A comma separated list of ChatConversation fields to display.
      - name: expansions
        value: ''
        type: query
        description: A comma separated list of fields to expand.
      - name: user.fields
        value: ''
        type: query
        description: A comma separated list of User fields to display.
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Retrieves a list of Chat conversations for the authenticated user's inbox.
  - info:
      name: X Create Chat Group Conversation
      type: http
    http:
      method: POST
      url: https://api.x.com/2/chat/conversations/group
      body:
        type: json
        data: '{}'
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Creates a new encrypted Chat group conversation on behalf of the authenticated user.
  - info:
      name: X Initialize Chat Group
      type: http
    http:
      method: POST
      url: https://api.x.com/2/chat/conversations/group/initialize
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: "Initializes a new XChat group conversation and returns a unique conversation ID.\n\nThis endpoint is the first\
      \ step in creating a group chat. The returned conversation_id \nshould be used in subsequent calls to POST /chat/conversations/group\
      \ to fully create and \nconfigure the group with members, admins, encryption keys, and other settings.\n\n**Workflow:**\n\
      1. Call this endpoint to get a `conversation_id`\n2. Use that `conversation_id` when calling `POST /chat/conversations/group`\
      \ to create the group\n\n"
  - info:
      name: X Get Chat Conversation
      type: http
    http:
      method: GET
      url: https://api.x.com/2/chat/conversations/:id
      params:
      - name: id
        value: '1234567890'
        type: path
        description: The recipient's user ID for a 1:1 conversation, or a group conversation ID (prefixed with 'g').
      - name: max_results
        value: '10'
        type: query
        description: Maximum number of message events to return.
      - name: pagination_token
        value: next_token_abc123
        type: query
        description: Token for pagination to retrieve the next page of results.
      - name: chat_message_event.fields
        value: ''
        type: query
        description: A comma separated list of ChatMessageEvent fields to display.
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Retrieves messages and key change events for a specific Chat conversation with pagination support. For 1:1 conversations,
      provide the recipient's user ID; the server constructs the canonical conversation ID from the authenticated user and
      recipient.
  - info:
      name: X Initialize Conversation Keys
      type: http
    http:
      method: POST
      url: https://api.x.com/2/chat/conversations/:id/keys
      params:
      - name: id
        value: '1234567890'
        type: path
        description: The recipient's user ID for a 1:1 conversation, or a group conversation ID (prefixed with 'g').
      body:
        type: json
        data: '{}'
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: 'Initializes encryption keys for a Chat conversation. This is the first step

      before sending messages in a new 1:1 conversation.


      For 1:1 conversations, provide the recipient''s user ID as the conversation_id.

      The server constructs the canonical conversation ID from the authenticated user

      and recipient.


      The request body must contain the conversation key version and participant keys

      (the conversation key encrypted for each participant using their public key).


      **Workflow (1:1 conversation):**

      1. Ge'
  - info:
      name: X Add Members to a Chat Group Conversation
      type: http
    http:
      method: POST
      url: https://api.x.com/2/chat/conversations/:id/members
      params:
      - name: id
        value: '1234567890'
        type: path
        description: The Chat group conversation ID.
      body:
        type: json
        data: '{}'
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Adds one or more members to an existing encrypted Chat group conversation, rotating the conversation key.
  - info:
      name: X Send Chat Message
      type: http
    http:
      method: POST
      url: https://api.x.com/2/chat/conversations/:id/messages
      params:
      - name: id
        value: '1234567890'
        type: path
        description: The recipient's user ID for a 1:1 conversation, or a group conversation ID (prefixed with 'g').
      body:
        type: json
        data: '{}'
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Sends an encrypted message to a specific Chat conversation. For 1:1 conversations, provide the recipient's user
      ID; the server constructs the canonical conversation ID from the authenticated user and recipient.
  - info:
      name: X Mark Conversation as Read
      type: http
    http:
      method: POST
      url: https://api.x.com/2/chat/conversations/:id/read
      params:
      - name: id
        value: '1234567890'
        type: path
        description: The recipient's user ID for a 1:1 conversation, or a group conversation ID (prefixed with 'g').
      body:
        type: json
        data: '{}'
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Marks a specific Chat conversation as read on behalf of the authenticated user. For 1:1 conversations, provide the
      recipient's user ID; the server constructs the canonical conversation ID from the authenticated user and recipient.
  - info:
      name: X Send Typing Indicator
      type: http
    http:
      method: POST
      url: https://api.x.com/2/chat/conversations/:id/typing
      params:
      - name: id
        value: '1234567890'
        type: path
        description: The recipient's user ID for a 1:1 conversation, or a group conversation ID (prefixed with 'g').
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Sends a typing indicator to a specific Chat conversation on behalf of the authenticated user. For 1:1 conversations,
      provide the recipient's user ID; the server constructs the canonical conversation ID from the authenticated user and
      recipient.
  - info:
      name: X Initialize Chat Media Upload
      type: http
    http:
      method: POST
      url: https://api.x.com/2/chat/media/upload/initialize
      body:
        type: json
        data: '{}'
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Initializes an XChat media upload session.
  - info:
      name: X Append Chat Media Upload
      type: http
    http:
      method: POST
      url: https://api.x.com/2/chat/media/upload/:id/append
      params:
      - name: id
        value: '1234567890'
        type: path
        description: The session/resume id from initialize.
      body:
        type: json
        data: '{}'
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Appends media data to an XChat upload session.
  - info:
      name: X Finalize Chat Media Upload
      type: http
    http:
      method: POST
      url: https://api.x.com/2/chat/media/upload/:id/finalize
      params:
      - name: id
        value: '1234567890'
        type: path
        description: The session/resume id from initialize.
      body:
        type: json
        data: '{}'
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Finalizes an XChat media upload session.
  - info:
      name: X Download Chat Media
      type: http
    http:
      method: GET
      url: https://api.x.com/2/chat/media/:id/:media_hash_key
      params:
      - name: id
        value: '1234567890'
        type: path
        description: The recipient's user ID for a 1:1 conversation, or a group conversation ID (prefixed with 'g').
      - name: media_hash_key
        value: example_value
        type: path
        description: The media hash key returned from the upload initialize step.
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Downloads encrypted media bytes from an XChat conversation. The response body contains raw binary bytes. For 1:1
      conversations, provide the recipient's user ID; the server constructs the canonical conversation ID from the authenticated
      user and recipient.
  - info:
      name: X Add Public Key
      type: http
    http:
      method: POST
      url: https://api.x.com/2/users/:id/public_keys
      params:
      - name: id
        value: '1234567890'
        type: path
        description: The ID of the requesting user.
      body:
        type: json
        data: '{}'
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Registers a user's public key for X Chat encryption.
- info:
    name: Communities
    type: folder
  items:
  - info:
      name: X Search Communities
      type: http
    http:
      method: GET
      url: https://api.x.com/2/communities/search
      params:
      - name: query
        value: Love
        type: query
        description: Query to search communities.
      - name: max_results
        value: '10'
        type: query
        description: The maximum number of search results to be returned by a request.
      - name: next_token
        value: next_token_abc123
        type: query
        description: This parameter is used to get the next 'page' of results. The value used with the parameter is pulled
          directly from the response provided by the API, and should not be modified.
      - name: pagination_token
        value: next_token_abc123
        type: query
        description: This parameter is used to get the next 'page' of results. The value used with the parameter is pulled
          directly from the response provided by the API, and should not be modified.
      - name: community.fields
        value: ''
        type: query
        description: A comma separated list of Community fields to display.
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Retrieves a list of Communities matching the specified search query.
  - info:
      name: X Get Community by ID
      type: http
    http:
      method: GET
      url: https://api.x.com/2/communities/:id
      params:
      - name: id
        value: '1234567890'
        type: path
        description: The ID of the Community.
      - name: community.fields
        value: ''
        type: query
        description: A comma separated list of Community fields to display.
      auth:
        type: bearer
        token: '{{bearerToken}}'
    docs: Retrieves details of a specific Community by its ID.
- info:
    name: Compliance
    type: folder
  items:
  - info:
      name: X Get Compliance Jobs
      type: http
    http:
      method: GET
      url: https://api.x.com/2/compliance/jobs
      params:
      - name: type
        value: tweets
        type: query
        description: Type of Compliance Job to list.
      - name: status
        value: created
        type: query
        description: Status of Compliance Job to list.
      - name: compliance_job.fields
        value: ''
        type: query
        description: A comma separated list of ComplianceJob fields to display.
      auth:
        type: bearer
        token: '{{bearerToken}}'
    docs: Retrieves a list of Compliance Jobs filtered by job type and optional status.
  - info:
      name: X Create Compliance Job
      type: http
    http:
      method: POST
      url: https://api.x.com/2/compliance/jobs
      body:
        type: json
        data: '{}'
      auth:
        type: bearer
        token: '{{bearerToken}}'
    docs: Creates a new Compliance Job for the specified job type.
  - info:
      name: X Get Compliance Job by ID
      type: http
    http:
      method: GET
      url: https://api.x.com/2/compliance/jobs/:id
      params:
      - name: id
        value: '1234567890'
        type: path
        description: The ID of the Compliance Job to retrieve.
      - name: compliance_job.fields
        value: ''
        type: query
        description: A comma separated list of ComplianceJob fields to display.
      auth:
        type: bearer
        token: '{{bearerToken}}'
    docs: Retrieves details of a specific Compliance Job by its ID.
- info:
    name: Connections
    type: folder
  items:
  - info:
      name: X Get Connection History
      type: http
    http:
      method: GET
      url: https://api.x.com/2/connections
      params:
      - name: status
        value: active
        type: query
        description: Filter by connection status. Use 'active' for current connections, 'inactive' for historical/disconnected
          connections, or 'all' for both.
      - name: endpoints
        value: filtered_stream
        type: query
        description: Filter by streaming endpoint. Specify one or more endpoint names to filter results.
      - name: max_results
        value: '10'
        type: query
        description: The maximum number of results to return per page.
      - name: pagination_token
        value: next_token_abc123
        type: query
        description: Token for paginating through results. Use the value from 'next_token' in the previous response.
      - name: connection.fields
        value: ''
        type: query
        description: A comma separated list of Connection fields to display.
      auth:
        type: bearer
        token: '{{bearerToken}}'
    docs: Returns active and historical streaming connections with disconnect reasons for the authenticated application.
  - info:
      name: X Terminate Multiple Connections
      type: http
    http:
      method: DELETE
      url: https://api.x.com/2/connections
      body:
        type: json
        data: '{}'
      auth:
        type: bearer
        token: '{{bearerToken}}'
    docs: Terminates multiple streaming connections by their UUIDs for the authenticated application.
  - info:
      name: X Terminate All Connections
      type: http
    http:
      method: DELETE
      url: https://api.x.com/2/connections/all
      auth:
        type: bearer
        token: '{{bearerToken}}'
    docs: Terminates all active streaming connections for the authenticated application.
  - info:
      name: X Terminate Connections by Endpoint
      type: http
    http:
      method: DELETE
      url: https://api.x.com/2/connections/:endpoint_id
      params:
      - name: endpoint_id
        value: filtered_stream
        type: path
        description: The endpoint ID to terminate connections for.
      auth:
        type: bearer
        token: '{{bearerToken}}'
    docs: Terminates all streaming connections for a specific endpoint ID for the authenticated application.
- info:
    name: Direct Messages
    type: folder
  items:
  - info:
      name: X Create DM Conversation
      type: http
    http:
      method: POST
      url: https://api.x.com/2/dm_conversations
      body:
        type: json
        data: '{}'
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Initiates a new direct message conversation with specified participants.
  - info:
      name: X Download DM Media
      type: http
    http:
      method: GET
      url: https://api.x.com/2/dm_conversations/media/:dm_id/:media_id/:resource_id
      params:
      - name: dm_id
        value: '1234567890'
        type: path
        description: The unique identifier of the Direct Message event containing the media.
      - name: media_id
        value: '1234567890'
        type: path
        description: The unique identifier of the media attached to the Direct Message.
      - name: resource_id
        value: '1234567890'
        type: path
        description: The resource identifier of the media file, including file extension (e.g. 'hVJQTwig.jpg').
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: 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.
  - info:
      name: X Get DM Events for a DM Conversation
      type: http
    http:
      method: GET
      url: https://api.x.com/2/dm_conversations/with/:participant_id/dm_events
      params:
      - name: participant_id
        value: '1234567890'
        type: path
        description: The ID of the participant user for the One to One DM conversation.
      - name: max_results
        value: '10'
        type: query
        description: The maximum number of results.
      - name: pagination_token
        value: next_token_abc123
        type: query
        description: This parameter is used to get a specified 'page' of results.
      - name: event_types
        value: MessageCreate,ParticipantsLeave
        type: query
        description: The set of event_types to include in the results.
      - name: dm_event.fields
        value: ''
        type: query
        description: A comma separated list of DmEvent fields to display.
      - name: expansions
        value: ''
        type: query
        description: A comma separated list of fields to expand.
      - name: media.fields
        value: ''
        type: query
        description: A comma separated list of Media fields to display.
      - name: user.fields
        value: ''
        type: query
        description: A comma separated list of User fields to display.
      - name: tweet.fields
        value: ''
        type: query
        description: A comma separated list of Tweet fields to display.
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Retrieves direct message events for a specific conversation.
  - info:
      name: X Create DM Message by Participant ID
      type: http
    http:
      method: POST
      url: https://api.x.com/2/dm_conversations/with/:participant_id/messages
      params:
      - name: participant_id
        value: '1234567890'
        type: path
        description: The ID of the recipient user that will receive the DM.
      body:
        type: json
        data: '{}'
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Sends a new direct message to a specific participant by their ID.
  - info:
      name: X Create DM Message by Conversation ID
      type: http
    http:
      method: POST
      url: https://api.x.com/2/dm_conversations/:dm_conversation_id/messages
      params:
      - name: dm_conversation_id
        value: '1234567890'
        type: path
        description: The DM Conversation ID.
      body:
        type: json
        data: '{}'
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Sends a new direct message to a specific conversation by its ID.
  - info:
      name: X Get DM Events for a DM Conversation
      type: http
    http:
      method: GET
      url: https://api.x.com/2/dm_conversations/:id/dm_events
      params:
      - name: id
        value: '1234567890'
        type: path
        description: The DM conversation ID.
      - name: max_results
        value: '10'
        type: query
        description: The maximum number of results.
      - name: pagination_token
        value: next_token_abc123
        type: query
        description: This parameter is used to get a specified 'page' of results.
      - name: event_types
        value: MessageCreate,ParticipantsLeave
        type: query
        description: The set of event_types to include in the results.
      - name: dm_event.fields
        value: ''
        type: query
        description: A comma separated list of DmEvent fields to display.
      - name: expansions
        value: ''
        type: query
        description: A comma separated list of fields to expand.
      - name: media.fields
        value: ''
        type: query
        description: A comma separated list of Media fields to display.
      - name: user.fields
        value: ''
        type: query
        description: A comma separated list of User fields to display.
      - name: tweet.fields
        value: ''
        type: query
        description: A comma separated list of Tweet fields to display.
      auth:
        type: oauth2
        flow: authorization_code
        authorizationUrl: https://api.x.com/2/oauth2/authorize
        accessTokenUrl: https://api.x.com/2/oauth2/token
        credentials:
          clientId: '{{clientId}}'
          clientSecret: '{{clientSecret}}'
    docs: Retrieves d

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