openapi: 3.0.0 info: description: X API v2 available endpoints version: '2.161' title: X API v2 Account Activity 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: Activity paths: /2/activity/stream: get: security: - BearerToken: [] tags: - Activity summary: X 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 example: 42 - 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 x-microcks-operation: delay: 0 dispatcher: FALLBACK /2/activity/subscriptions: delete: security: - BearerToken: [] tags: - Activity summary: X Delete X Activity Subscriptions by IDs description: Deletes multiple subscriptions for X activity events by their IDs externalDocs: url: https://docs.x.com/x-api/activity/delete-x-activity-subscriptions-by-ids operationId: deleteActivitySubscriptionsByIds parameters: - name: ids in: query description: Comma-separated list of subscription IDs to delete. required: true schema: type: array minItems: 1 maxItems: 100 items: $ref: '#/components/schemas/ActivitySubscriptionId' explode: false style: form example: [] responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/ActivitySubscriptionDeleteResponse' 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: - BearerToken: [] tags: - Activity summary: X Get X Activity Subscriptions description: Get a list of active subscriptions for XAA externalDocs: url: https://docs.x.com/x-api/activity/get-x-activity-subscriptions operationId: getActivitySubscriptions parameters: - name: max_results in: query description: The maximum number of results to return per page. required: false schema: type: integer minimum: 1 maximum: 100 format: int32 style: form example: 10 - name: pagination_token in: query description: This parameter is used to get the next 'page' of results. required: false schema: $ref: '#/components/schemas/PaginationToken32' style: form example: next_token_abc123 responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/ActivitySubscriptionGetResponse' 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 post: security: - BearerToken: [] - OAuth2UserToken: - dm.read - tweet.read - UserToken: [] tags: - Activity summary: X 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' x-microcks-operation: delay: 0 dispatcher: FALLBACK /2/activity/subscriptions/{subscription_id}: delete: security: - BearerToken: [] tags: - Activity summary: X Deletes X Activity Subscription description: Deletes a subscription for an X activity event externalDocs: url: https://docs.x.com/x-api/activity/deletes-x-activity-subscription operationId: deleteActivitySubscription parameters: - name: subscription_id in: path description: The ID of the subscription to delete. required: true schema: $ref: '#/components/schemas/ActivitySubscriptionId' style: simple example: '1234567890' responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/ActivitySubscriptionDeleteResponse' 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 put: security: - BearerToken: [] tags: - Activity summary: X Update X Activity Subscription description: Updates a subscription for an X activity event externalDocs: url: https://docs.x.com/x-api/activity/update-x-activity-subscription operationId: updateActivitySubscription parameters: - name: subscription_id in: path description: The ID of the subscription to update. required: true schema: $ref: '#/components/schemas/ActivitySubscriptionId' style: simple example: '1234567890' requestBody: content: application/json: schema: $ref: '#/components/schemas/ActivitySubscriptionUpdateRequest' responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/ActivitySubscriptionUpdateResponse' 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: WebhookConfigId: type: string description: The unique identifier of this webhook config. pattern: ^[0-9]{1,19}$ example: '1146654567674912769' UrlImage: type: object description: Represent the information for the URL image. properties: height: $ref: '#/components/schemas/MediaHeight' url: $ref: '#/components/schemas/Url' width: $ref: '#/components/schemas/MediaWidth' ActivitySubscriptionId: type: string description: The unique identifier of this subscription. pattern: ^[0-9]{1,19}$ example: '1146654567674912769' ActivityEventId: type: string description: The unique identifier of an Activity event. pattern: ^[0-9]{1,19}$ example: '1146654567674912769' ActivityStreamingResponse: type: object description: An activity event or error that can be returned by the x activity streaming API. properties: data: type: object properties: event_type: type: string event_uuid: $ref: '#/components/schemas/ActivityEventId' filter: $ref: '#/components/schemas/ActivitySubscriptionFilter' payload: $ref: '#/components/schemas/ActivityStreamingResponsePayload' tag: type: string errors: type: array minItems: 1 items: $ref: '#/components/schemas/Problem' example: [] UrlEntity: description: Represent the portion of text recognized as a URL, and its start and end position within the text. allOf: - $ref: '#/components/schemas/EntityIndicesInclusiveExclusive' - $ref: '#/components/schemas/UrlFields' UserName: type: string description: The X handle (screen name) of this user. pattern: ^[A-Za-z0-9_]{1,15}$ FollowActivityResponsePayload: type: object properties: source: $ref: '#/components/schemas/User' target: $ref: '#/components/schemas/User' additionalProperties: false ActivitySubscriptionGetResponse: type: object properties: data: type: array items: $ref: '#/components/schemas/ActivitySubscription' example: [] errors: type: array minItems: 1 items: $ref: '#/components/schemas/Problem' example: [] meta: type: object properties: next_token: type: string description: Token to retrieve the next page of results. result_count: type: integer description: Number of active subscriptions returned in response. format: int32 HttpStatusCode: type: integer description: HTTP Status Code. minimum: 100 maximum: 599 ActivitySubscriptionFilter: type: object description: An XAA subscription filter. properties: direction: type: string description: Optional direction filter for directional events. enum: - inbound - outbound example: inbound keyword: $ref: '#/components/schemas/Keyword' user_id: $ref: '#/components/schemas/UserId' additionalProperties: false ActivitySubscriptionDeleteResponse: type: object properties: data: type: object properties: deleted: type: boolean errors: type: array minItems: 1 items: $ref: '#/components/schemas/Problem' example: [] meta: type: object properties: total_subscriptions: type: integer description: Number of active subscriptions remaining. format: int32 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 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' HashtagEntity: allOf: - $ref: '#/components/schemas/EntityIndicesInclusiveExclusive' - $ref: '#/components/schemas/HashtagFields' ProfileUpdateActivityResponsePayload: type: object properties: after: type: string before: type: string additionalProperties: false ActivitySubscriptionUpdateRequest: type: object properties: tag: type: string minLength: 1 maxLength: 200 example: example_tag webhook_id: $ref: '#/components/schemas/WebhookConfigId' additionalProperties: false ActivityStreamingResponsePayload: oneOf: - $ref: '#/components/schemas/ProfileUpdateActivityResponsePayload' - $ref: '#/components/schemas/NewsActivityResponsePayload' - $ref: '#/components/schemas/FollowActivityResponsePayload' discriminator: propertyName: ../event_type mapping: follow.follow: '#/components/schemas/FollowActivityResponsePayload' follow.unfollow: '#/components/schemas/FollowActivityResponsePayload' news.new: '#/components/schemas/NewsActivityResponsePayload' profile.update.affiliate_badge: '#/components/schemas/ProfileUpdateActivityResponsePayload' profile.update.banner_picture: '#/components/schemas/ProfileUpdateActivityResponsePayload' profile.update.bio: '#/components/schemas/ProfileUpdateActivityResponsePayload' profile.update.geo: '#/components/schemas/ProfileUpdateActivityResponsePayload' profile.update.handle: '#/components/schemas/ProfileUpdateActivityResponsePayload' profile.update.profile_picture: '#/components/schemas/ProfileUpdateActivityResponsePayload' profile.update.screenname: '#/components/schemas/ProfileUpdateActivityResponsePayload' profile.update.url: '#/components/schemas/ProfileUpdateActivityResponsePayload' profile.update.verified_badge: '#/components/schemas/ProfileUpdateActivityResponsePayload' TweetId: type: string description: Unique identifier of this Tweet. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers. pattern: ^[0-9]{1,19}$ example: '1346889436626259968' 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 MediaKey: type: string description: The Media Key identifier for this attachment. pattern: ^([0-9]+)_([0-9]+)$ Error: type: object required: - code - message properties: code: type: integer format: int32 message: type: string ActivitySubscriptionCreateRequest: type: object required: - event_type - filter properties: event_type: type: string enum: - profile.update.bio - profile.update.profile_picture - profile.update.banner_picture - profile.update.screenname - profile.update.geo - profile.update.url - profile.update.verified_badge - profile.update.affiliate_badge - profile.update.handle - news.new - follow.follow - follow.unfollow - spaces.start - spaces.end - chat.received - chat.sent - chat.conversation_join - dm.sent - dm.received - dm.indicate_typing - dm.read example: profile.update.bio filter: $ref: '#/components/schemas/ActivitySubscriptionFilter' tag: type: string minLength: 1 maxLength: 200 example: example_tag webhook_id: $ref: '#/components/schemas/WebhookConfigId' additionalProperties: false MediaHeight: type: integer description: The height of the media in pixels. minimum: 0 ActivitySubscriptionUpdateResponse: type: object properties: data: type: object properties: subscription: $ref: '#/components/schemas/ActivitySubscription' total_subscriptions: type: integer description: Number of active subscriptions. format: int32 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 Keyword: type: string description: A keyword to filter on. minLength: 1 maxLength: 150 example: The President User: type: object description: The X User object. required: - id - name - username properties: affiliation: type: object description: Metadata about a user's affiliation. properties: badge_url: type: string description: The badge URL corresponding to the affiliation. format: uri description: type: string description: The description of the affiliation. url: type: string description: The URL, if available, to details about an affiliation. format: uri user_id: type: array minItems: 1 items: $ref: '#/components/schemas/UserId' connection_status: type: array description: Returns detailed information about the relationship between two users. minItems: 0 items: type: string description: Type of connection between users. enum: - follow_request_received - follow_request_sent - blocking - followed_by - following - muting created_at: type: string description: Creation time of this User. format: date-time description: type: string description: The text of this User's profile description (also known as bio), if the User provided one. entities: type: object description: A list of metadata found in the User's profile description. properties: description: $ref: '#/components/schemas/FullTextEntities' url: type: object description: Expanded details for the URL specified in the User's profile, with start and end indices. properties: urls: type: array minItems: 1 items: $ref: '#/components/schemas/UrlEntity' id: $ref: '#/components/schemas/UserId' location: type: string description: The location specified in the User's profile, if the User provided one. As this is a freeform value, it may not indicate a valid location, but it may be fuzzily evaluated when performing searches with location queries. most_recent_tweet_id: $ref: '#/components/schemas/TweetId' name: type: string description: The friendly name of this User, as shown on their profile. pinned_tweet_id: $ref: '#/components/schemas/TweetId' profile_banner_url: type: string description: The URL to the profile banner for this User. format: uri profile_image_url: type: string description: The URL to the profile image for this User. format: uri protected: type: boolean description: Indicates if this User has chosen to protect their Posts (in other words, if this User's Posts are private). public_metrics: type: object description: A list of metrics for this User. required: - followers_count - following_count - tweet_count - listed_count properties: followers_count: type: integer description: Number of Users who are following this User. following_count: type: integer description: Number of Users this User is following. like_count: type: integer description: The number of likes created by this User. listed_count: type: integer description: The number of lists that include this User. tweet_count: type: integer description: The number of Posts (including Retweets) posted by this User. receives_your_dm: type: boolean description: Indicates if you can send a DM to this User subscription_type: type: string description: 'The X Blue subscription type of the user, eg: Basic, Premium, PremiumPlus or None.' enum: - Basic - Premium - PremiumPlus - None url: type: string description: The URL specified in the User's profile. username: $ref: '#/components/schemas/UserName' verified: type: boolean description: Indicate if this User is a verified X User. verified_type: type: string description: 'The X Blue verified type of the user, eg: blue, government, business or none.' enum: - blue - government - business - none withheld: $ref: '#/components/schemas/UserWithheld' example: created_at: '2013-12-14T04:35:55Z' id: '2244994945' name: X Dev protected: false username: TwitterDev MentionEntity: allOf: - $ref: '#/components/schemas/EntityIndicesInclusiveExclusive' - $ref: '#/components/schemas/MentionFields' 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 FullTextEntities: type: object properties: annotations: type: array minItems: 1 items: description: Annotation for entities based on the Tweet text. allOf: - $ref: '#/components/schemas/EntityIndicesInclusiveInclusive' - type: object description: Represents the data for the annotation. properties: normalized_text: type: string description: Text used to determine annotation. example: Barack Obama probability: type: number description: Confidence factor for annotation type. minimum: 0 maximum: 1 format: double type: type: string description: Annotation type. example: Person cashtags: type: array minItems: 1 items: $ref: '#/components/schemas/CashtagEntity' hashtags: type: array minItems: 1 items: $ref: '#/components/schemas/HashtagEntity' mentions: type: array minItems: 1 items: $ref: '#/components/schemas/MentionEntity' urls: type: array minItems: 1 items: $ref: '#/components/schemas/UrlEntity' ActivitySubscriptionCreateResponse: type: object properties: data: type: object properties: subscription: $ref: '#/components/schemas/ActivitySubscription' total_subscriptions_for_instance_id: type: integer errors: type: array minItems: 1 items: $ref: '#/components/schemas/Problem' example: [] meta: type: object properties: total_subscriptions: type: integer description: Number of active subscriptions. format: int32 CountryCode: type: string description: A two-letter ISO 3166-1 alpha-2 country code. pattern: ^[A-Z]{2}$ example: US UrlFields: type: object description: Represent the portion of text recognized as a URL. required: - url properties: description: type: string description: Description of the URL landing page. example: This is a description of the website. display_url: type: string description: The URL as displayed in the X client. example: twittercommunity.com/t/introducing-… expanded_url: $ref: '#/components/schemas/Url' images: type: array minItems: 1 items: $ref: '#/components/schemas/UrlImage' media_key: $ref: '#/components/schemas/MediaKey' status: $ref: '#/components/schemas/HttpStatusCode' title: type: string description: Title of the page the URL points to. example: Introducing the v2 follow lookup endpoints unwound_url: type: string description: Fully resolved url. format: uri example: https://twittercommunity.com/t/introducing-the-v2-follow-lookup-endpoints/147118 url: $ref: '#/components/schemas/Url' ActivitySubscription: type: object description: An XActivity subscription. required: - subscription_id - event_type - filter - created_at - updated_at properties: created_at: type: string format: date-time example: '2026-04-17T12:00:00Z' event_type: type: string example: standard filter: $ref: '#/components/schemas/ActivitySubscriptionFilter' subscription_id: $ref: '#/components/schemas/ActivitySubscriptionId' tag: type: string example: example_tag updated_at: type: string format: date-time example: '2026-04-17T12:00:00Z' webhook_id: $ref: '#/components/schemas/WebhookConfigId' Problem: type: object description: An HTTP Problem Details object, as defined in IETF RFC 7807 (https://tools.ietf.org/html/rfc7807). required: - type - title properties: detail: type: string status: type: integer title: type: string type: type: string discriminator: propertyName: type mapping: about:blank: '#/components/schemas/GenericProblem' https://api.twitter.com/2/problems/client-disconnected: '#/components/schemas/ClientDisconnectedProblem' https://api.twitter.com/2/problems/client-forbidden: '#/components/schemas/ClientForbiddenProblem' https://api.twitter.com/2/problems/conflict: '#/components/schemas/ConflictProblem' https://api.twitter.com/2/problems/disallowed-resource: '#/components/schemas/DisallowedResourceProblem' https://api.twitter.com/2/problems/duplicate-rules: '#/components/schemas/DuplicateRuleProblem' https://api.twitter.com/2/problems/invalid-request: '#/components/schemas/InvalidRequestProblem' https://api.twitter.com/2/problems/invalid-rules: '#/components/schemas/InvalidRuleProblem' https://api.twitter.com/2/problems/noncompliant-rules: '#/components/schemas/NonCompliantRulesProblem' https://api.twitter.com/2/problems/not-authorized-for-field: '#/components/schemas/FieldUnauthorizedProblem' https://api.twitter.com/2/problems/not-authorized-for-resource: '#/components/schemas/ResourceUnauthorizedProblem' https://api.twitter.com/2/problems/operational-disconnect: '#/components/schemas/OperationalDisconnectProblem' https://api.twitter.com/2/problems/resource-not-found: '#/components/schemas/ResourceNotFoundProblem' https://api.twitter.com/2/problems/resource-unavailable: '#/components/schemas/ResourceUnavailableProblem' https://api.twitter.com/2/problems/rule-cap: '#/components/schemas/RulesCapProblem' https://api.twitter.com/2/problems/streaming-connection: '#/components/schemas/ConnectionExceptionProblem' https://api.twitter.com/2/problems/unsupported-authentication: '#/components/schemas/UnsupportedAuthenticationProblem' https://api.twitter.com/2/problems/usage-capped: '#/components/schemas/UsageCapExceededProblem' CashtagEntity: allOf: - $ref: '#/components/schemas/EntityIndicesInclusiveExclusive' - $ref: '#/components/schemas/CashtagFields' PaginationToken32: type: string description: A base32 pagination token. minLength: 16 NewsActivityResponsePayload: type: object properties: category: type: string headline: type: string hook: type: string summary: type: string additionalProperties: false Url: type: string description: A validly formatted URL. format: uri example: https://developer.twitter.com/en/docs/twitter-api MediaWidth: type: integer description: The width of the media in pixels. minimum: 0 UserId: type: string description: Unique identifier of this User. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers. pattern: ^[0-9]{1,19}$ example: '2244994945' EntityIndicesInclusiveInclusive: 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 inclusive. required: - start - end properties: end: type: integer description: Index (zero-based) at which position this entity ends. The index is inclusive. 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 securitySchemes: BearerToken: type: http scheme: bearer OAuth2UserToken: type: oauth2 flows: authorizationCode: authorizationUrl: https://api.x.com/2/oauth2/authorize tokenUrl: https://api.x.com/2/oauth2/token scopes: block.read: View accounts you have blocked. bookmark.read: Read your bookmarked Posts. bookmark.write: Create and delete your bookmarks. dm.read: Read all your Direct Messages. dm.write: Send and manage your Direct Messages. follows.read: View accounts you follow and accounts following you. follows.write: Follow and unfollow accounts on your behalf. like.read: View Posts you have liked and likes you can see. like.write: Like and unlike Posts on your behalf. list.read: View Lists, members, and followers of Lists you created or are a member of, including private Lists. list.write: Create and manage Lists on your behalf. media.write: Upload media, such as photos and videos, on your behalf. mute.read: View accounts you have muted. mute.write: Mute and unmute accounts on your behalf. offline.access: Request a refresh token for the app. space.read: View all Spaces you have access to. timeline.read: View all Custom Timelines you can see, including public Custom Timelines from other developers. tweet.moderate.write: Hide and unhide replies to your Posts. tweet.read: View all Posts you can see, including those from protected accounts. tweet.write: Post and repost on your behalf. users.read: View any account you can see, including protected accounts. UserToken: type: http scheme: OAuth