Recent search
Returns Tweets from the last 7 days that match a search query.
Query parameters
-
One query/rule/filter for matching Tweets. Refer to https:\/\/t.co\/rulelength to identify the max query length
-
YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) 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).
-
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).
-
Returns results with a Tweet ID greater than (that is, more recent than) the specified ID.
-
Returns results with a Tweet ID less than (that is, older than) the specified ID.
-
The maximum number of search results to be returned by a request.
Minimum value is
10
, maximum value is100
. Default value is10
. -
This order in which to return results.
Values are
recency
orrelevancy
. -
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.
-
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.
-
A comma separated list of fields to expand.
-
A comma separated list of Tweet fields to display.
-
A comma separated list of User fields to display.
-
A comma separated list of Media fields to display.
-
A comma separated list of Place fields to display.
-
A comma separated list of Poll fields to display.
curl \
-X GET https://api.twitter.com/2/tweets/search/recent?query=%28from%3ATwitterDev+OR+from%3ATwitterAPI%29+has%3Amedia+-is%3Aretweet \
-H "Authorization: Bearer $ACCESS_TOKEN"
{
"data": [
{
"id": "1346889436626259968",
"created_at": "Wed Jan 06 18:40:40 +0000 2021",
"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",
"author_id": "2244994945"
}
],
"includes": {
"users": [
{
"id": "2244994945",
"created_at": "2013-12-14T04:35:55Z",
"name": "Twitter Dev",
"username": "TwitterDev",
"protected": false
}
],
"tweets": [
{
"id": "1346889436626259968",
"created_at": "Wed Jan 06 18:40:40 +0000 2021",
"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",
"author_id": "2244994945"
}
],
"places": [
{
"id": "f7eb2fa2fea288b1",
"name": "Lakewood",
"country_code": "US",
"place_type": "city",
"full_name": "Lakewood, CO",
"country": "United States",
"contained_within": [
"f7eb2fa2fea288b1"
],
"geo": {
"type": "Feature",
"bbox": [
-105.193475,
39.60973,
-105.053164,
39.761974
],
"geometry": {
"type": "Point",
"coordinates": [
"-105.18816086351444",
"40.247749999999996"
]
},
"properties": {}
}
}
],
"media": [
{
"type": "string",
"media_key": "string",
"height": 42,
"width": 42
}
],
"polls": [
{
"id": "1365059861688410112",
"options": [
{
"position": 42,
"label": "string",
"votes": 42
}
],
"voting_status": "open",
"end_datetime": "2023-05-04T09:42:00+00:00",
"duration_minutes": 42
}
]
},
"errors": [
{
"type": "string",
"title": "string",
"detail": "string",
"status": 42
}
],
"meta": {
"newest_id": "string",
"oldest_id": "string",
"next_token": "string",
"result_count": 42
}
}
{
"data": [
{
"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",
"author_id": "2244994945",
"created_at": "Wed Jan 06 18:40:40 +0000 2021"
}
],
"includes": {
"users": [
{
"id": "2244994945",
"name": "Twitter Dev",
"username": "TwitterDev",
"protected": false,
"created_at": "2013-12-14T04:35:55Z"
}
],
"tweets": [
{
"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",
"author_id": "2244994945",
"created_at": "Wed Jan 06 18:40:40 +0000 2021"
}
],
"places": [
{
"id": "f7eb2fa2fea288b1",
"name": "Lakewood",
"country_code": "US",
"place_type": "city",
"full_name": "Lakewood, CO",
"country": "United States",
"contained_within": [
"f7eb2fa2fea288b1"
],
"geo": {
"type": "Feature",
"bbox": [
-105.193475,
39.60973,
-105.053164,
39.761974
],
"geometry": {
"type": "Point",
"coordinates": [
"-105.18816086351444",
"40.247749999999996"
]
},
"properties": {}
}
}
],
"media": [
{
"type": "string",
"media_key": "string",
"height": 42,
"width": 42
}
],
"polls": [
{
"id": "1365059861688410112",
"options": [
{
"position": 42,
"label": "string",
"votes": 42
}
],
"voting_status": "open",
"end_datetime": "2025-05-04T09:42:00Z",
"duration_minutes": 42
}
]
},
"errors": [
{
"type": "string",
"title": "string",
"detail": "string",
"status": 42
}
],
"meta": {
"newest_id": "string",
"oldest_id": "string",
"next_token": "string",
"result_count": 42
}
}
{
"code": 42,
"message": "string"
}
{
"code": 42,
"message": "string"
}