v1

latestOpenAPI 3.0.0Twitter Developer Agreement and Policy2026-07-1480235216.3 KB
Tweets

Full-archive search

Returns Tweets that match a search query.

get/2/tweets/search/all

Query parameters

querystring required
Example:(from:TwitterDev OR from:TwitterAPI) has:media -is:retweet

One query/rule/filter for matching Tweets. Refer to https://t.co/rulelength to identify the max query length.

start_timestring date-time

YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Tweets will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute).

end_timestring date-time

YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Tweets will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute).

since_idstring

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.

Example:1346889436626259968

Returns results with a Tweet ID greater than (that is, more recent than) the specified ID.

until_idstring

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.

Example:1346889436626259968

Returns results with a Tweet ID less than (that is, older than) the specified ID.

max_resultsinteger

The maximum number of search results to be returned by a request.

next_tokenstring

A base36 pagination token.

This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified.

pagination_tokenstring

A base36 pagination token.

This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified.

sort_order'recency' | 'relevancy'

This order in which to return results.

tweet.fieldsstring[]

The fields available for a Tweet object.

A comma separated list of Tweet fields to display.

[
  "attachments",
  "author_id",
  "context_annotations",
  "conversation_id",
  "created_at",
  "edit_controls",
  "edit_history_tweet_ids",
  "entities",
  "geo",
  "id",
  "in_reply_to_user_id",
  "lang",
  "non_public_metrics",
  "organic_metrics",
  "possibly_sensitive",
  "promoted_metrics",
  "public_metrics",
  "referenced_tweets",
  "reply_settings",
  "source",
  "text",
  "withheld"
]
expansionsstring[]

The list of fields you can expand for a Tweet object. If the field has an ID, it can be expanded into a full object.

A comma separated list of fields to expand.

[
  "attachments.media_keys",
  "attachments.poll_ids",
  "author_id",
  "edit_history_tweet_ids",
  "entities.mentions.username",
  "geo.place_id",
  "in_reply_to_user_id",
  "referenced_tweets.id",
  "referenced_tweets.id.author_id"
]
media.fieldsstring[]

The fields available for a Media object.

A comma separated list of Media fields to display.

[
  "alt_text",
  "duration_ms",
  "height",
  "media_key",
  "non_public_metrics",
  "organic_metrics",
  "preview_image_url",
  "promoted_metrics",
  "public_metrics",
  "type",
  "url",
  "variants",
  "width"
]
poll.fieldsstring[]

The fields available for a Poll object.

A comma separated list of Poll fields to display.

[
  "duration_minutes",
  "end_datetime",
  "id",
  "options",
  "voting_status"
]
user.fieldsstring[]

The fields available for a User object.

A comma separated list of User fields to display.

[
  "created_at",
  "description",
  "entities",
  "id",
  "location",
  "name",
  "pinned_tweet_id",
  "profile_image_url",
  "protected",
  "public_metrics",
  "url",
  "username",
  "verified",
  "verified_type",
  "withheld"
]
place.fieldsstring[]

The fields available for a Place object.

A comma separated list of Place fields to display.

[
  "contained_within",
  "country",
  "country_code",
  "full_name",
  "geo",
  "id",
  "name",
  "place_type"
]

Response

The request has succeeded.

Example response

{
  "data": [
    {
      "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 Twitter API v2 to explore Tweet\\u2026 https:\\/\\/t.co\\/56a0vZUx7i"
    }
  ],
  "includes": {
    "places": [
      {
        "contained_within": [
          "f7eb2fa2fea288b1"
        ],
        "country": "United States",
        "country_code": "US",
        "full_name": "Lakewood, CO",
        "geo": {
          "bbox": [
            -105.193475,
            39.60973,
            -105.053164,
            39.761974
          ],
          "geometry": {
            "coordinates": [
              -105.18816086351444,
              40.247749999999996
            ],
            "type": "Point"
          }
        },
        "id": "f7eb2fa2fea288b1",
        "name": "Lakewood",
        "place_type": "city"
      }
    ],
    "polls": [
      {
        "id": "1365059861688410112"
      }
    ],
    "topics": [
      {
        "description": "All about technology",
        "name": "Technology"
      }
    ],
    "tweets": [
      {
        "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 Twitter API v2 to explore Tweet\\u2026 https:\\/\\/t.co\\/56a0vZUx7i"
      }
    ],
    "users": [
      {
        "created_at": "2013-12-14T04:35:55Z",
        "id": "2244994945",
        "name": "Twitter Dev",
        "protected": false,
        "username": "TwitterDev"
      }
    ]
  }
}