Skip to main content
With expansions, developers can expand objects referenced in the payload. Objects available for expansion are referenced by ID. For example, the referenced_tweets.id and author_id fields returned in the Posts lookup payload can be expanded into complete objects. If you would like to request fields related to the user that posted that Post, or the media, poll, or place that was included in that Post, you will need to pass the related expansion query parameter in your request to receive that data in your response. Currently, v2 endpoints that return Posts, Users, Lists, Spaces, and Direct Message event objects all support expansions (see examples below). When including an expansion in your request, we will include that expanded object’s default fields within the same response. It helps return additional data in the same response without the need for separate requests. If you would like to request additional fields related to the expanded object, you can include the field parameter associated with that expanded object, along with a comma-separated list of fields that you would like to receive in your response. Please note fields are not always returned in the same order they were requested in the query. The Post payload below contains reference IDs for complementary objects we can expand on, including the author_id of who posted the Post, the id of a referenced Post, and a media_key for a media attachment.

Available Expansions for Post Payloads

Available Expansion for User Payloads

Available Expansions for Direct Message Event Payloads

Available Expansions for Spaces Payloads

Available Expansion for Lists Payloads

Expanding the Media Object

In the following request, we are requesting the geo.place_id expansion to include alongside the default Post fields: Sample Request
Sample Response

Expanding the Poll Object

In the following request, we are requesting the attachments.poll_ids expansion to include alongside the default Post fields: Sample Request Sample Response

Expanding the Place Object

In the following request, we are requesting the geo.place_id expansion to include alongside the default Post fields: Sample Request Sample Response