Executive Summary
🔍 Key Findings
This analysis reveals Twitter's internal API architecture used by their web client for community and direct messaging operations. All endpoints require OAuth2 authentication with a static bearer token plus dynamic CSRF tokens.
📚 API Categories Discovered
| Category | Endpoints | Description |
|---|---|---|
| Communities | 6 | Full CRUD operations for communities, member lists, tweets |
| Direct Messages | 7 | Inbox, conversations, read receipts, permissions |
| User & Preferences | 3 | Settings, affiliates, following lists |
| Timeline | 3 | Various feed types including community timelines |
| Media/Video | 31 | HLS streaming URLs (6 pattern types × multiple resolutions/bitrates) |
| Notifications | 1 | Badge counts for unread items |
| Analytics | 3 | Event tracking and user flow |
Authentication Architecture
Required Authentication Components
Application-level token, appears to be static across sessions:
[YOUR_STATIC_BEARER_TOKEN]
Must be extracted from cookies (ct0 cookie) and sent in x-csrf-token header:
[YOUR_CSRF_TOKEN_FROM_CT0_COOKIE]
Essential cookies from authenticated session:
auth_token=[YOUR_AUTH_TOKEN]
ct0=[YOUR_CSRF_TOKEN]
twid=u%3D[YOUR_USER_ID]
kdt=[YOUR_KDT_TOKEN]
att=[YOUR_ATT_TOKEN]
authorization: Bearer [YOUR_BEARER_TOKEN]
x-csrf-token: [YOUR_CSRF_TOKEN]
x-twitter-auth-type: OAuth2Session
x-twitter-active-user: yes
x-twitter-client-language: en
x-client-transaction-id: [UNIQUE_PER_REQUEST]
content-type: application/json
cookie: [YOUR_SESSION_COOKIES]
Authentication Flow
- User authenticates via standard Twitter OAuth2 login flow
- Session cookies are set (including CSRF token in ct0 cookie)
- Static bearer token is used for application-level auth
- CSRF token from cookies must be included in request headers
- Each request requires unique x-client-transaction-id (base64 random string)
Complete API Catalog
Communities APIs
6 EndpointsPurpose: Manage communities, fetch member lists, get community tweets, explore communities
Operation Hash: 2W09l7nD7ZbxGQHXvfB22w
Purpose: Get detailed information about a specific community
Rate Limit: 50 requests/15min
Returns: Community details including name, description, member count, rules, join policy
Operation Hash: aexCVeGbmrF7669joR04vQ
Purpose: Get tweets from a specific community timeline
Rate Limit: 500 requests/15min
Operation Hash: ScODPHsG2d28Xr-rDSBThg
Purpose: Query for create button UI state
Rate Limit: 500 requests/15min
Operation Hash: CtB3bu37M7nYOng5B1PG1w
Purpose: Get ranked/recommended communities timeline
Rate Limit: 500 requests/15min
Operation Hash: AQDy3iNv8tYQZTy9O60idw
Purpose: Explore communities discovery timeline
Rate Limit: 500 requests/15min
Operation Hash: ppTuEDxay9XWJg8dPI8j5w
Purpose: Fetch single community by ID
Rate Limit: 500 requests/15min
Direct Messages APIs
7 EndpointsPurpose: Manage DM inbox, conversations, read receipts, permissions
Purpose: Get DM inbox with conversation list
Rate Limit: 450 requests/15min
Purpose: Mark DM conversation as read
Request Body: conversationId={id}&last_read_event_id={message_id}
Content-Type: application/x-www-form-urlencoded
Operation Hash: sIC-NZ_cqXLO_WH4jDWFQA
Purpose: Get pinned DM conversations
Rate Limit: 500 requests/15min
Purpose: Check DM permissions for recipient users
Rate Limit: 450 requests/15min
Purpose: Fetch conversation history and messages
Rate Limit: 900 requests/15min
Purpose: Add welcome message to conversation
Purpose: Poll for DM updates (new messages, typing indicators)
Rate Limit: 450 requests/15min
User APIs
2 EndpointsPurpose: User preferences, flow tracking
Operation Hash: xFxU-O8hEYe74ovNVU74jA
Purpose: Get user preferences and settings
Rate Limit: 500 requests/15min
Purpose: Track user flow events for analytics
Rate Limit: 2000 requests/15min
Notifications APIs
1 EndpointPurpose: Badge counts and notification updates
Purpose: Get unread notification badge counts
Rate Limit: 180 requests/15min
Media/Video APIs
31 Unique URLsPurpose: HLS video streaming with multiple quality levels (m3u8 playlists, m4s segments)
Purpose: Master playlist - entry point for adaptive streaming
Format: HLS M3U8 playlist with variant streams
Purpose: Video stream playlist for specific resolution
Resolutions: 320x320, 480x270, 540x540, 1908x1072, 1920x1080, etc.
Codec: AVC1 (H.264)
Purpose: Video segment with specific bitrate range
Format: MPEG-4 segment (M4S)
Example: /vid/avc1/3000/6000/1908x1072/{hash}.m4s (3-6 Mbps)
Purpose: Audio stream playlist
Codec: MP4A (AAC)
Bitrate: 32000 (32 kbps) or 128000 (128 kbps)
Purpose: Audio segment
Format: MPEG-4 audio segment
Purpose: Full video file (not segmented)
Format: MP4
- Master playlists: 6 unique URLs (entry points for different videos)
- Resolution-specific playlists: 7 URLs (320x320, 320x400, 320x568, 480x270, 540x540, 1908x1072, 1920x1080)
- Video segments (.m4s): 12 URLs (various bitrate ranges: 0-3000, 3000-6000, 6000-9000, 9000-12000, 21000-30000 kbps)
- Audio playlists: 2 URLs (32 kbps)
- Audio segments (.m4s): 3 URLs (128 kbps at different time ranges)
- Full MP4 files: 2 URLs (non-segmented videos)
Note: All URLs use HLS adaptive bitrate streaming. The patterns above represent the 6 endpoint types that generate 31 unique URLs across different videos, resolutions, and bitrates captured in the session.
Timeline APIs
1 EndpointPurpose: Timeline queries for various contexts
Operation Hash: gwNDrhzDr9kuoulEqgSQcQ
Purpose: Get community members timeline slice
Rate Limit: 500 requests/15min
GraphQL - p2
1 EndpointPurpose: GraphQL CES (Client Event Service) endpoint
Purpose: Client event tracking and analytics
Operation: p2 (performance/analytics)
GraphQL - affiliatesQuery
1 EndpointPurpose: Query user affiliates and connections
Operation Hash: 1Sjin33Vk96OVlNTUG6zSg
Purpose: Get user affiliates data
Rate Limit: 50 requests/15min
GraphQL - CarouselQuery
1 EndpointPurpose: Carousel UI component data
Operation Hash: 7gBMELiDhLZ_MtyTElxYsA
Purpose: Get carousel content and layout
Rate Limit: 500 requests/15min
GraphQL - TopicCarouselQuery
1 EndpointPurpose: Topic-specific carousel UI component
Operation Hash: byVjaS0CUtBqAao_lhZFgA
Purpose: Get topic carousel content
Rate Limit: 500 requests/15min
Ads/Promoted APIs
1 EndpointPurpose: Promoted content tracking and logging
Purpose: Log promoted content impressions and interactions
Used for: Ad tracking, impression logging, engagement metrics
Live/Streaming APIs
1 EndpointPurpose: Live pipeline for real-time updates
Purpose: Subscribe/unsubscribe to live event streams
Base URL: api.x.com (not x.com)
Used for: Real-time notifications, live events, typing indicators
Other APIs
2 EndpointsPurpose: Miscellaneous endpoints that don't fit other categories
Purpose: Get list of users followed by a specific user
Rate Limit: 12000 requests/15min (very high)
Purpose: External Twitter video segments (alternative to amplify_video)
Note: Similar to amplify_video but for user-uploaded content
API Dependencies & Architecture
How to Read This Graph
- 🔐 Authentication Banner (Top): Required by ALL APIs shown below - must establish valid session with bearer token + CSRF before making any API calls
- Content APIs (Row 1): Communities, DMs, Timeline, User - these provide the primary data and can include media URLs in their responses
- Media/Video (Row 2): Media URLs are obtained from Content API responses (tweets contain video links, DMs contain images, etc.), then accessed directly
- Independent APIs (Row 3): Notifications, GraphQL queries (p2, Affiliates, Carousels), Ads, Live/Streaming - these operate independently after authentication without depending on other APIs
- Other (Row 2): Miscellaneous endpoints like following lists and external video segments
- Arrows: Show data dependencies only (not authentication requirements, which apply to all)
Rate Limits & Quotas
x-rate-limit-limit: Total requests allowed per windowx-rate-limit-remaining: Requests remaining in current windowx-rate-limit-reset: Unix timestamp when limit resets
| API Category | Endpoint | Limit | Window | Notes |
|---|---|---|---|---|
| Communities | CommunityQuery | 50 | 15 min | Lower limit for detailed queries |
| Communities | CommunityTweetsTimeline | 500 | 15 min | Standard GraphQL limit |
| Direct Messages | dm/inbox_timeline | 450 | 15 min | REST API limit |
| Direct Messages | dm/conversation/{id} | 900 | 15 min | Higher limit for conversations |
| User | friends/following/list | 12,000 | 15 min | Very high limit |
| Notifications | badge_count.json | 180 | 15 min | Frequent polling expected |