Twitter/X Spaces API
Endpoints related to retrieving, managing Spaces
Endpoints related to retrieving, managing Spaces
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/twitter-x-spaces-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
openapi: 3.2.0
info:
description: X API v2 available endpoints
version: '2.166'
title: X API v2 Account Activity Spaces 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: Spaces
description: Endpoints related to retrieving, managing Spaces
externalDocs:
description: Find out more
url: https://developer.twitter.com/en/docs/twitter-api/spaces
paths:
/2/spaces:
get:
security:
- BearerToken: []
- OAuth2UserToken:
- space.read
- tweet.read
- users.read
tags:
- Spaces
summary: Get Spaces by IDs
description: Retrieves details of multiple Spaces by their IDs.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/spaces/lookup/api-reference/get-spaces
operationId: getSpacesByIds
parameters:
- name: ids
in: query
description: The list of Space IDs to return.
required: true
schema:
type: array
minItems: 1
maxItems: 100
items:
type: string
description: The unique identifier of this Space.
pattern: ^[a-zA-Z0-9]{1,13}$
example: 1SLjjRYNejbKM
style: form
- $ref: '#/components/parameters/SpaceFieldsParameter'
- $ref: '#/components/parameters/SpaceExpansionsParameter'
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/TopicFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2SpacesResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/spaces/by/creator_ids:
get:
security:
- BearerToken: []
- OAuth2UserToken:
- space.read
- tweet.read
- users.read
tags:
- Spaces
summary: Get Spaces by creator IDs
description: Retrieves details of Spaces created by specified User IDs.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/spaces/lookup/api-reference/get-spaces-by-creator-ids
operationId: getSpacesByCreatorIds
parameters:
- name: user_ids
in: query
description: The IDs of Users to search through.
required: true
schema:
type: array
minItems: 1
maxItems: 100
items:
$ref: '#/components/schemas/UserId'
style: form
- $ref: '#/components/parameters/SpaceFieldsParameter'
- $ref: '#/components/parameters/SpaceExpansionsParameter'
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/TopicFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2SpacesByCreatorIdsResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/spaces/search:
get:
security:
- BearerToken: []
- OAuth2UserToken:
- space.read
- tweet.read
- users.read
tags:
- Spaces
summary: Search Spaces
description: Retrieves a list of Spaces matching the specified search query.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/spaces/search/api-reference/get-spaces-search
operationId: searchSpaces
parameters:
- name: query
in: query
description: The search query.
required: true
example: crypto
schema:
type: string
minLength: 1
maxLength: 2048
example: crypto
style: form
- name: state
in: query
description: The state of Spaces to search for.
required: false
schema:
type: string
enum:
- live
- scheduled
- all
default: all
style: form
- name: max_results
in: query
description: The number of results to return.
required: false
schema:
type: integer
minimum: 1
maximum: 100
format: int32
default: 100
style: form
- $ref: '#/components/parameters/SpaceFieldsParameter'
- $ref: '#/components/parameters/SpaceExpansionsParameter'
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/TopicFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2SpacesSearchResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/spaces/{id}:
get:
security:
- BearerToken: []
- OAuth2UserToken:
- space.read
- tweet.read
- users.read
tags:
- Spaces
summary: Get space by ID
description: Retrieves details of a specific space by its ID.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/spaces/lookup/api-reference/get-spaces-id
operationId: getSpacesById
parameters:
- name: id
in: path
description: The ID of the Space to be retrieved.
required: true
example: 1YqKDqWqdPLsV
schema:
type: string
description: The unique identifier of this Space.
pattern: ^[a-zA-Z0-9]{1,13}$
example: 1SLjjRYNejbKM
style: simple
- $ref: '#/components/parameters/SpaceFieldsParameter'
- $ref: '#/components/parameters/SpaceExpansionsParameter'
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/TopicFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2SpacesIdResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/spaces/{id}/buyers:
get:
security:
- OAuth2UserToken:
- space.read
- tweet.read
- users.read
tags:
- Spaces
summary: Get Space ticket buyers
description: Retrieves a list of Users who purchased tickets to a specific Space by its ID.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/spaces/lookup/api-reference/get-spaces-id-buyers
operationId: getSpacesBuyers
parameters:
- name: id
in: path
description: The ID of the Space to be retrieved.
required: true
example: 1YqKDqWqdPLsV
schema:
type: string
description: The unique identifier of this Space.
pattern: ^[a-zA-Z0-9]{1,13}$
example: 1SLjjRYNejbKM
style: simple
- name: pagination_token
in: query
description: This parameter is used to get a specified 'page' of results.
required: false
schema:
$ref: '#/components/schemas/PaginationToken32'
style: form
- name: max_results
in: query
description: The maximum number of results.
required: false
schema:
type: integer
minimum: 1
maximum: 100
format: int32
default: 100
style: form
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/TweetFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2SpacesIdBuyersResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/spaces/{id}/tweets:
get:
security:
- BearerToken: []
- OAuth2UserToken:
- space.read
- tweet.read
- users.read
tags:
- Spaces
summary: Get Space Posts
description: Retrieves a list of Posts shared in a specific Space by its ID.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/spaces/lookup/api-reference/get-spaces-id-tweets
operationId: getSpacesPosts
parameters:
- name: id
in: path
description: The ID of the Space to be retrieved.
required: true
example: 1YqKDqWqdPLsV
schema:
type: string
description: The unique identifier of this Space.
pattern: ^[a-zA-Z0-9]{1,13}$
example: 1SLjjRYNejbKM
style: simple
- name: max_results
in: query
description: The number of Posts to fetch from the provided space. If not provided, the value will default to the maximum of 100.
required: false
schema:
type: integer
minimum: 1
maximum: 100
format: int32
default: 100
example: 25
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/Get2SpacesIdTweetsResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
components:
schemas:
Topic:
type: object
description: The topic of a Space, as selected by its creator.
required:
- id
- name
properties:
description:
type: string
description: The description of the given topic.
example: All about technology
id:
$ref: '#/components/schemas/TopicId'
name:
type: string
description: The name of the given topic.
example: Technology
Place:
type: object
required:
- id
- full_name
properties:
contained_within:
type: array
minItems: 1
items:
$ref: '#/components/schemas/PlaceId'
country:
type: string
description: The full name of the county in which this place exists.
example: United States
country_code:
$ref: '#/components/schemas/CountryCode'
full_name:
type: string
description: The full name of this place.
example: Lakewood, CO
geo:
$ref: '#/components/schemas/Geo'
id:
$ref: '#/components/schemas/PlaceId'
name:
type: string
description: The human readable name of this place.
example: Lakewood
place_type:
$ref: '#/components/schemas/PlaceType'
Url:
type: string
description: A validly formatted URL.
format: uri
example: https://developer.twitter.com/en/docs/twitter-api
MediaKey:
type: string
description: The Media Key identifier for this attachment.
pattern: ^([0-9]+)_([0-9]+)$
NoteId:
type: string
description: The unique identifier of this Community Note.
pattern: ^[0-9]{1,19}$
example: '1146654567674912769'
Media:
type: object
required:
- type
properties:
height:
$ref: '#/components/schemas/MediaHeight'
media_key:
$ref: '#/components/schemas/MediaKey'
type:
type: string
width:
$ref: '#/components/schemas/MediaWidth'
discriminator:
propertyName: type
mapping:
animated_gif: '#/components/schemas/AnimatedGif'
photo: '#/components/schemas/Photo'
video: '#/components/schemas/Video'
Get2SpacesByCreatorIdsResponse:
type: object
properties:
data:
type: array
minItems: 1
items:
$ref: '#/components/schemas/Space'
errors:
type: array
minItems: 1
items:
$ref: '#/components/schemas/Problem'
includes:
$ref: '#/components/schemas/Expansions'
meta:
type: object
properties:
result_count:
$ref: '#/components/schemas/ResultCount'
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
Tweet:
type: object
properties:
attachments:
type: object
description: Specifies the type of attachments (if any) present in this Tweet.
properties:
media_keys:
type: array
description: A list of Media Keys for each one of the media attachments (if media are attached).
minItems: 1
items:
$ref: '#/components/schemas/MediaKey'
media_source_tweet_id:
type: array
description: A list of Posts the media on this Tweet was originally posted in. For example, if the media on a tweet is re-used in another Tweet, this refers to the original, source Tweet..
minItems: 1
items:
$ref: '#/components/schemas/TweetId'
poll_ids:
type: array
description: A list of poll IDs (if polls are attached).
minItems: 1
items:
$ref: '#/components/schemas/PollId'
author_id:
$ref: '#/components/schemas/UserId'
community_id:
$ref: '#/components/schemas/CommunityId'
context_annotations:
type: array
minItems: 1
items:
$ref: '#/components/schemas/ContextAnnotation'
conversation_id:
$ref: '#/components/schemas/TweetId'
created_at:
type: string
description: Creation time of the Tweet.
format: date-time
example: '2021-01-06T18:40:40.000Z'
display_text_range:
$ref: '#/components/schemas/DisplayTextRange'
edit_controls:
type: object
required:
- is_edit_eligible
- editable_until
- edits_remaining
properties:
editable_until:
type: string
description: Time when Tweet is no longer editable.
format: date-time
example: '2021-01-06T18:40:40.000Z'
edits_remaining:
type: integer
description: Number of times this Tweet can be edited.
is_edit_eligible:
type: boolean
description: Indicates if this Tweet is eligible to be edited.
example: false
edit_history_tweet_ids:
type: array
description: A list of Tweet Ids in this Tweet chain.
minItems: 1
items:
$ref: '#/components/schemas/TweetId'
entities:
$ref: '#/components/schemas/FullTextEntities'
geo:
type: object
description: The location tagged on the Tweet, if the user provided one.
properties:
coordinates:
$ref: '#/components/schemas/Point'
place_id:
$ref: '#/components/schemas/PlaceId'
id:
$ref: '#/components/schemas/TweetId'
in_reply_to_user_id:
$ref: '#/components/schemas/UserId'
lang:
type: string
description: Language of the Tweet, if detected by X. Returned as a BCP47 language tag.
example: en
matched_media_notes:
type: object
description: The matched media notes for the post.
properties:
match_status:
type: string
description: The status of the media note match.
example: matched_and_shown
note_id:
$ref: '#/components/schemas/NoteId'
non_public_metrics:
type: object
description: Nonpublic engagement metrics for the Tweet at the time of the request.
properties:
impression_count:
type: integer
description: Number of times this Tweet has been viewed.
format: int32
note_request_suggestions:
type: object
description: The note request suggestions for the post.
properties:
source_link:
$ref: '#/components/schemas/UrlEntity'
suggestion:
type: string
description: The text of the note request suggestion.
suggestion_id:
type: string
description: The unique identifier of the note request suggestion.
note_tweet:
type: object
description: The full-content of the Tweet, including text beyond 280 characters.
properties:
entities:
type: object
properties:
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'
text:
$ref: '#/components/schemas/NoteTweetText'
organic_metrics:
type: object
description: Organic nonpublic engagement metrics for the Tweet at the time of the request.
required:
- impression_count
- retweet_count
- reply_count
- like_count
properties:
impression_count:
type: integer
description: Number of times this Tweet has been viewed.
like_count:
type: integer
description: Number of times this Tweet has been liked.
reply_count:
type: integer
description: Number of times this Tweet has been replied to.
retweet_count:
type: integer
description: Number of times this Tweet has been Retweeted.
paid_partnership:
type: boolean
description: Indicates if this Post is a paid partnership, i.e. it has been disclosed by the author as containing paid promotion.
example: false
possibly_sensitive:
type: boolean
description: Indicates if this Tweet contains URLs marked as sensitive, for example content suitable for mature audiences.
example: false
promoted_metrics:
type: object
description: Promoted nonpublic engagement metrics for the Tweet at the time of the request.
properties:
impression_count:
type: integer
description: Number of times this Tweet has been viewed.
format: int32
like_count:
type: integer
description: Number of times this Tweet has been liked.
format: int32
reply_count:
type: integer
description: Number of times this Tweet has been replied to.
format: int32
retweet_count:
type: integer
description: Number of times this Tweet has been Retweeted.
format: int32
public_metrics:
type: object
description: Engagement metrics for the Tweet at the time of the request.
required:
- retweet_count
- reply_count
- like_count
- impression_count
- bookmark_count
properties:
bookmark_count:
type: integer
description: Number of times this Tweet has been bookmarked.
format: int32
impression_count:
type: integer
description: Number of times this Tweet has been viewed.
format: int32
like_count:
type: integer
description: Number of times this Tweet has been liked.
quote_count:
type: integer
description: Number of times this Tweet has been quoted.
reply_count:
type: integer
description: Number of times this Tweet has been replied to.
retweet_count:
type: integer
description: Number of times this Tweet has been Retweeted.
referenced_tweets:
type: array
description: A list of Posts this Tweet refers to. For example, if the parent Tweet is a Retweet, a Quoted Tweet or a Reply, it will include the related Tweet referenced to by its parent.
minItems: 1
items:
type: object
required:
- type
- id
properties:
id:
$ref: '#/components/schemas/TweetId'
type:
type: string
enum:
- retweeted
- quoted
- replied_to
reply_settings:
$ref: '#/components/schemas/ReplySettingsWithVerifiedUsers'
scopes:
type: object
description: The scopes for this tweet
properties:
followers:
type: boolean
description: Indicates if this Tweet is viewable by followers without the Tweet ID
example: false
source:
type: string
description: This is deprecated.
suggested_source_links:
type: array
minItems: 0
items:
$ref: '#/components/schemas/UrlEntity'
suggested_source_links_with_counts:
type: object
description: Suggested source links and the number of requests that included each link.
properties:
count:
type: integer
description: Number of note requests that included the source link.
url:
$ref: '#/components/schemas/UrlEntity'
text:
$ref: '#/components/schemas/TweetText'
username:
$ref: '#/components/schemas/UserName'
withheld:
$ref: '#/components/schemas/TweetWithheld'
example:
author_id: '2244994945'
created_at: Wed Jan 06 18:40:40 +0000 2021
id: '1346889436626259968'
text: Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\u2026 https:\/\/t.co\/56a0vZUx7i
username: XDevelopers
PollOption:
type: object
description: Describes a choice in a Poll object.
required:
- position
- label
- votes
properties:
label:
$ref: '#/components/schemas/PollOptionLabel'
position:
type: integer
description: Position of this choice in the poll.
votes:
type: integer
description: Number of users who voted for this choice.
PollId:
type: string
description: Unique identifier of this poll.
pattern: ^[0-9]{1,19}$
example: '1365059861688410112'
PlaceId:
type: string
description: The identifier for this place.
example: f7eb2fa2fea288b1
Get2SpacesIdResponse:
type: object
properties:
data:
$ref: '#/components/schemas/Space'
errors:
type: array
minItems: 1
items:
$ref: '#/components/schemas/Problem'
includes:
$ref: '#/components/schemas/Expansions'
Space:
type: object
description: ''
required:
- id
- state
properties:
created_at:
type: string
description: Creation time of the Space.
format: date-time
example: '2021-07-06T18:40:40.000Z'
creator_id:
$ref: '#/components/schemas/UserId'
ended_at:
type: string
description: End time of the Space.
format: date-time
example: '2021-07-06T18:40:40.000Z'
host_ids:
type: array
description: The user ids for the hosts of the Space.
items:
$ref: '#/components/schemas/UserId'
id:
$ref: '#/components/schemas/SpaceId'
invited_user_ids:
type: array
description: An array of user ids for people who were invited to a Space.
items:
$ref: '#/components/schemas/UserId'
is_ticketed:
type: boolean
description: Denotes if the Space is a ticketed Space.
example: 'false'
lang:
type: string
description: The language of the Space.
example: en
participant_count:
type: integer
description: The number of participants in a Space.
format: int32
example: 10
scheduled_start:
type: string
description: A date time stamp for when a Space is scheduled to begin.
format: date-time
example: '2021-07-06T18:40:40.000Z'
speaker_ids:
type: array
description: An array of user ids for people who were speakers in a Space.
items:
$ref: '#/components/schemas/UserId'
started_at:
type: string
description: When the Space was started as a date string.
format: date-time
example: '2021-7-14T04:35:55Z'
state:
type: string
description: The current state of the Space.
enum:
- live
- scheduled
- ended
example: live
subscriber_count:
type: integer
description: The number of people who have either purchased a ticket or set a reminder for this Space.
format: int32
example: 10
title:
type: string
description: The title of the Space.
example: Spaces are Awesome
topics:
type: array
description: The topics of a Space, as selected by its creator.
items:
type: object
description: The X Topic object.
required:
- id
- name
properties:
description:
type: string
description: The description of the given topic.
id:
type: string
description: An ID suitable for use in the REST API.
name:
type: string
description: The name of the given topic.
example:
description: All about technology
id: '848920371311001600'
name: Technology
updated_at:
type: string
description: When the Space was last updated.
format: date-time
example: '2021-7-14T04:35:55Z'
ResultCount:
type: integer
description: The number of results returned in this response.
format: int32
PreviousToken:
type: string
description: The previous token.
minLength: 1
Error:
type: object
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string
ContextAnnotationDomainFields:
type: object
description: Represents the data for the context annotation domain.
required:
- id
properties:
description:
type: string
description: Description of the context annotation domain.
id:
type: string
description: The unique id for a context annotation domain.
pattern: ^[0-9]{1,19}$
name:
type: string
description: Name of the context annotation domain.
MediaWidth:
type: integer
description: The width of the media in pixels.
minimum: 0
CommunityId:
type: string
description: The unique identifier of this Community.
pattern: ^[0-9]{1,19}$
example: '1146654567674912769'
ReplySettingsWithVerifiedUsers:
type: string
description: Shows who can reply a Tweet. Fields returned are everyone, mentioned_users, subscribers, verified and following.
pattern: ^[A-Za-z]{1,12}$
enum:
- everyone
- mentionedUsers
- following
- other
- subscribers
- verified
Geo:
type: object
required:
- type
- bbox
- properties
properties:
bbox:
type: array
minItems: 4
maxItems: 4
items:
type: number
minimum: -180
maximum: 180
format: double
example:
- -105.193475
- 39.60973
- -105.053164
- 39.761974
geometry:
$ref: '#/components/schemas/Point'
properties:
type: object
type:
type: string
enum:
- Feature
ContextAnnotationEntityFields:
type: object
description: Represents the data for the context annotation entity.
required:
- id
properties:
description:
type: string
description: Description of the context annotation entity.
id:
type: string
description: The unique id for a context annotation entity.
# --- truncated at 32 KB (65 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/twitter-x/refs/heads/main/openapi/twitter-x-spaces-api-openapi.yml