OpenAPI Specification
openapi: 3.0.0
info:
description: X API v2 available endpoints
version: '2.166'
title: X API v2 Account Activity Stream 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: Stream
description: Endpoints related to streaming
externalDocs:
description: Find out more
url: https://developer.x.com
paths:
/2/activity/stream:
get:
security:
- BearerToken: []
tags:
- Stream
summary: Activity Stream
description: Stream of X Activities
externalDocs:
url: https://docs.x.com/x-api/activity/activity-stream
operationId: activityStream
parameters:
- name: backfill_minutes
in: query
description: The number of minutes of backfill requested.
required: false
schema:
type: integer
minimum: 0
maximum: 5
format: int32
style: form
- name: start_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided.
required: false
example: '2021-02-01T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- name: end_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided.
required: false
example: '2021-02-01T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/ActivityStreamingResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
x-twitter-streaming: true
/2/activity/subscriptions:
post:
security:
- BearerToken: []
- OAuth2UserToken:
- dm.read
- like.read
- tweet.read
- UserToken: []
tags:
- Stream
summary: Create X activity subscription
description: Creates a subscription for an X activity event
externalDocs:
url: https://docs.x.com/x-api/activity/create-x-activity-subscription
operationId: createActivitySubscription
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ActivitySubscriptionCreateRequest'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/ActivitySubscriptionCreateResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/likes/compliance/stream:
get:
security:
- BearerToken: []
tags:
- Stream
summary: Stream Likes compliance data
description: Streams all compliance data related to Likes for Users.
operationId: streamLikesCompliance
parameters:
- name: backfill_minutes
in: query
description: The number of minutes of backfill requested.
required: false
schema:
type: integer
minimum: 0
maximum: 5
format: int32
style: form
- name: start_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Likes Compliance events will be provided.
required: false
example: '2021-02-01T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- name: end_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Likes Compliance events will be provided.
required: false
example: '2021-02-01T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/LikesComplianceStreamResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
x-twitter-streaming: true
/2/likes/firehose/stream:
get:
security:
- BearerToken: []
tags:
- Stream
summary: Stream all Likes
description: Streams all public Likes in real-time.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/tweets/filtered-stream/api-reference/get-likes-firehose-stream
operationId: streamLikesFirehose
parameters:
- name: backfill_minutes
in: query
description: The number of minutes of backfill requested.
required: false
schema:
type: integer
minimum: 0
maximum: 5
format: int32
style: form
- name: partition
in: query
description: The partition number.
required: true
schema:
type: integer
minimum: 1
maximum: 20
format: int32
style: form
- name: start_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided.
required: false
example: '2021-02-14T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- name: end_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided.
required: false
example: '2021-02-14T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- $ref: '#/components/parameters/LikeWithTweetAuthorFieldsParameter'
- $ref: '#/components/parameters/LikeWithTweetAuthorExpansionsParameter'
- $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/StreamingLikeResponseV2'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
x-twitter-streaming: true
/2/likes/sample10/stream:
get:
security:
- BearerToken: []
tags:
- Stream
summary: Stream sampled Likes
description: Streams a 10% sample of public Likes in real-time.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/likes/firehose/api-reference/get-likes-sample10-stream
operationId: streamLikesSample10
parameters:
- name: backfill_minutes
in: query
description: The number of minutes of backfill requested.
required: false
schema:
type: integer
minimum: 0
maximum: 5
format: int32
style: form
- name: partition
in: query
description: The partition number.
required: true
schema:
type: integer
minimum: 1
maximum: 2
format: int32
style: form
- name: start_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided.
required: false
example: '2021-02-14T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- name: end_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided.
required: false
example: '2021-02-14T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- $ref: '#/components/parameters/LikeWithTweetAuthorFieldsParameter'
- $ref: '#/components/parameters/LikeWithTweetAuthorExpansionsParameter'
- $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/StreamingLikeResponseV2'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
x-twitter-streaming: true
/2/tweets/compliance/stream:
get:
security:
- BearerToken: []
tags:
- Stream
summary: Stream Posts compliance data
description: Streams all compliance data related to Posts.
operationId: streamPostsCompliance
parameters:
- name: backfill_minutes
in: query
description: The number of minutes of backfill requested.
required: false
schema:
type: integer
minimum: 0
maximum: 5
format: int32
style: form
- name: partition
in: query
description: The partition number.
required: true
schema:
type: integer
minimum: 1
maximum: 4
format: int32
style: form
- name: start_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post Compliance events will be provided.
required: false
example: '2021-02-01T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- name: end_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Post Compliance events will be provided.
required: false
example: '2021-02-14T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/TweetComplianceStreamResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
x-twitter-streaming: true
/2/tweets/firehose/stream:
get:
security:
- BearerToken: []
tags:
- Stream
summary: Stream all Posts
description: Streams all public Posts in real-time.
operationId: streamPostsFirehose
parameters:
- name: backfill_minutes
in: query
description: The number of minutes of backfill requested.
required: false
schema:
type: integer
minimum: 0
maximum: 5
format: int32
style: form
- name: partition
in: query
description: The partition number.
required: true
schema:
type: integer
minimum: 1
maximum: 20
format: int32
style: form
- name: start_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided.
required: false
example: '2021-02-14T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- name: end_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided.
required: false
example: '2021-02-14T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- $ref: '#/components/parameters/TweetFieldsParameter'
- $ref: '#/components/parameters/TweetExpansionsParameter'
- $ref: '#/components/parameters/MediaFieldsParameter'
- $ref: '#/components/parameters/PollFieldsParameter'
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/PlaceFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/StreamingTweetResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
x-twitter-streaming: true
/2/tweets/firehose/stream/lang/en:
get:
security:
- BearerToken: []
tags:
- Stream
summary: Stream English Posts
description: Streams all public English-language Posts in real-time.
operationId: streamPostsFirehoseEn
parameters:
- name: backfill_minutes
in: query
description: The number of minutes of backfill requested.
required: false
schema:
type: integer
minimum: 0
maximum: 5
format: int32
style: form
- name: partition
in: query
description: The partition number.
required: true
schema:
type: integer
minimum: 1
maximum: 8
format: int32
style: form
- name: start_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided.
required: false
example: '2021-02-14T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- name: end_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided.
required: false
example: '2021-02-14T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- $ref: '#/components/parameters/TweetFieldsParameter'
- $ref: '#/components/parameters/TweetExpansionsParameter'
- $ref: '#/components/parameters/MediaFieldsParameter'
- $ref: '#/components/parameters/PollFieldsParameter'
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/PlaceFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/StreamingTweetResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
x-twitter-streaming: true
/2/tweets/firehose/stream/lang/ja:
get:
security:
- BearerToken: []
tags:
- Stream
summary: Stream Japanese Posts
description: Streams all public Japanese-language Posts in real-time.
operationId: streamPostsFirehoseJa
parameters:
- name: backfill_minutes
in: query
description: The number of minutes of backfill requested.
required: false
schema:
type: integer
minimum: 0
maximum: 5
format: int32
style: form
- name: partition
in: query
description: The partition number.
required: true
schema:
type: integer
minimum: 1
maximum: 2
format: int32
style: form
- name: start_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided.
required: false
example: '2021-02-14T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- name: end_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided.
required: false
example: '2021-02-14T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- $ref: '#/components/parameters/TweetFieldsParameter'
- $ref: '#/components/parameters/TweetExpansionsParameter'
- $ref: '#/components/parameters/MediaFieldsParameter'
- $ref: '#/components/parameters/PollFieldsParameter'
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/PlaceFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/StreamingTweetResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
x-twitter-streaming: true
/2/tweets/firehose/stream/lang/ko:
get:
security:
- BearerToken: []
tags:
- Stream
summary: Stream Korean Posts
description: Streams all public Korean-language Posts in real-time.
operationId: streamPostsFirehoseKo
parameters:
- name: backfill_minutes
in: query
description: The number of minutes of backfill requested.
required: false
schema:
type: integer
minimum: 0
maximum: 5
format: int32
style: form
- name: partition
in: query
description: The partition number.
required: true
schema:
type: integer
minimum: 1
maximum: 2
format: int32
style: form
- name: start_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided.
required: false
example: '2021-02-14T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- name: end_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided.
required: false
example: '2021-02-14T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- $ref: '#/components/parameters/TweetFieldsParameter'
- $ref: '#/components/parameters/TweetExpansionsParameter'
- $ref: '#/components/parameters/MediaFieldsParameter'
- $ref: '#/components/parameters/PollFieldsParameter'
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/PlaceFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/StreamingTweetResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
x-twitter-streaming: true
/2/tweets/firehose/stream/lang/pt:
get:
security:
- BearerToken: []
tags:
- Stream
summary: Stream Portuguese Posts
description: Streams all public Portuguese-language Posts in real-time.
operationId: streamPostsFirehosePt
parameters:
- name: backfill_minutes
in: query
description: The number of minutes of backfill requested.
required: false
schema:
type: integer
minimum: 0
maximum: 5
format: int32
style: form
- name: partition
in: query
description: The partition number.
required: true
schema:
type: integer
minimum: 1
maximum: 2
format: int32
style: form
- name: start_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided.
required: false
example: '2021-02-14T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- name: end_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided.
required: false
example: '2021-02-14T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- $ref: '#/components/parameters/TweetFieldsParameter'
- $ref: '#/components/parameters/TweetExpansionsParameter'
- $ref: '#/components/parameters/MediaFieldsParameter'
- $ref: '#/components/parameters/PollFieldsParameter'
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/PlaceFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/StreamingTweetResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
x-twitter-streaming: true
/2/tweets/label/stream:
get:
security:
- BearerToken: []
tags:
- Stream
summary: Stream Post labels
description: Streams all labeling events applied to Posts.
operationId: streamLabelsCompliance
parameters:
- name: backfill_minutes
in: query
description: The number of minutes of backfill requested.
required: false
schema:
type: integer
minimum: 0
maximum: 5
format: int32
style: form
- name: start_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided.
required: false
example: '2021-02-01T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- name: end_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided.
required: false
example: '2021-02-01T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/TweetLabelStreamResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
x-twitter-streaming: true
/2/tweets/sample/stream:
get:
security:
- BearerToken: []
tags:
- Stream
summary: Stream sampled Posts
description: Streams a 1% sample of public Posts in real-time.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/tweets/volume-streams/api-reference/get-tweets-sample-stream
operationId: streamPostsSample
parameters:
- name: backfill_minutes
in: query
description: The number of minutes of backfill requested.
required: false
schema:
type: integer
minimum: 0
maximum: 5
format: int32
style: form
- $ref: '#/components/parameters/TweetFieldsParameter'
- $ref: '#/components/parameters/TweetExpansionsParameter'
- $ref: '#/components/parameters/MediaFieldsParameter'
- $ref: '#/components/parameters/PollFieldsParameter'
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/PlaceFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/StreamingTweetResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
x-twitter-streaming: true
/2/tweets/sample10/stream:
get:
security:
- BearerToken: []
tags:
- Stream
summary: Stream 10% sampled Posts
description: Streams a 10% sample of public Posts in real-time.
operationId: streamPostsSample10
parameters:
- name: backfill_minutes
in: query
description: The number of minutes of backfill requested.
required: false
schema:
type: integer
minimum: 0
maximum: 5
format: int32
style: form
- name: partition
in: query
description: The partition number.
required: true
schema:
type: integer
minimum: 1
maximum: 2
format: int32
style: form
- name: start_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided.
required: false
example: '2021-02-14T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- name: end_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided.
required: false
example: '2021-02-14T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- $ref: '#/components/parameters/TweetFieldsParameter'
- $ref: '#/components/parameters/TweetExpansionsParameter'
- $ref: '#/components/parameters/MediaFieldsParameter'
- $ref: '#/components/parameters/PollFieldsParameter'
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/PlaceFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2TweetsSample10StreamResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
x-twitter-streaming: true
/2/tweets/search/stream:
get:
security:
- BearerToken: []
tags:
- Stream
summary: Stream filtered Posts
description: Streams Posts in real-time matching the active rule set.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/tweets/filtered-stream/api-reference/get-tweets-search-stream
operationId: streamPosts
parameters:
- name: backfill_minutes
in: query
description: The number of minutes of backfill requested.
required: false
schema:
type: integer
minimum: 0
maximum: 5
format: int32
style: form
- name: start_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided.
required: false
example: '2021-02-01T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- name: end_time
in: query
description: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided.
required: false
example: '2021-02-14T18:40:40.000Z'
schema:
type: string
format: date-time
style: form
- $ref: '#/components/parameters/TweetFieldsParameter'
- $ref: '#/components/parameters/TweetExpansionsParameter'
- $ref: '#/components/parameters/MediaFieldsParameter'
- $ref: '#/components/parameters/PollFieldsParameter'
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/PlaceFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/FilteredStreamingTweetResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
x-twitter-streaming: true
/2/tweets/search/stream/rules:
get:
security:
- BearerToken: []
tags:
- Stream
summary: Get stream rules
description: Retrieves the active rule set or a subset of rules for the filtered stream.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/tweets/filtered-stream/api-reference/get-tweets-search-stream-rules
operationId: getRules
parameters:
- name: ids
in: query
description: A comma-separated list of Rule IDs.
required: false
schema:
type: array
items:
$ref: '#/components/schemas/RuleId'
style: form
- name: max_results
in: query
description: The maximum number of results.
required: false
schema:
type: integer
minimum: 1
maximum: 1000
format: int32
default: 1000
style: form
- name: pagination_token
in: query
description: This value is populated by passing the 'next_token' returned in a request to paginate through results.
required: false
schema:
type: string
minLength: 16
maxLength: 16
style: form
responses:
'200':
description: The request has succeeded.
content:
a
# --- truncated at 32 KB (118 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/twitter-x/refs/heads/main/openapi/twitter-x-stream-api-openapi.yml