I am using the recent search end point in python (“/2/tweets/search/recent”) with the following query params:

query_params = {'query': '-happy lang:en -is:retweet',
                'tweet.fields': 'text,created_at',
                'start_time': '2021-11-27T00:00:00Z'
                }

But the result returns created_at as the current timestamp as opposed to when the tweet was created/start_time. What am I missing?

Result example below:

{
    "data": [
        {
            "created_at": "2021-12-03T20:00:20.000Z",
            "text": "<some tweet text>"
        }

the default end_time is from “30 seconds ago from now” and tweets are delivered in reverse chronological order.

Thank you @IgorBrigadir
I searched for sorting the result by created_at for this endpoint, no luck. I am now using end_time instead of start_time to filter for date in query params.

You can’t specify sorting order in the API unfortunately, it’s always reverse-chronological, and it’s best to specify both start_time and end_time explicitly - but if unspecified, start_time is “7 days ago” GET /2/tweets/search/recent | Docs | Twitter Developer Platform

1 Like

that actually doesn’t answer the question. If I understood well, and I bet I did since I have the same problem: why does the response in the field “created_at” doesn’t return the created_at date of the tweet but instead, returns the created_at of the query. The documentation specify that the tweet.fields created_at is supposed to return the date/time of the tweet.

Interesting! The created at date should be the tweet created at date, in UTC. Do you have an example of where the created at date is wrong?