I was informed by a Twitter sales representative that if I upgraded from my Elevated access to Premium, nothing would need to change about my API call, and that upon upgrading I would have immediate access to 30-days of historical data. After purchasing my upgrade, a message informed me I would have immediate access to the data.

I’ve purchased the upgrade, and it shows the purchase has gone through, but am getting the following error message with my API calls:

BadRequest: 400 Bad Request
Invalid 'start_time':'2022-04-01T00:00Z'. 'start_time' must be on or after 2022-04-20T23:29Z
Invalid 'end_time':'2022-04-15T23:59Z'. 'end_time' must be on or after 2022-04-20T23:29Z

Can somebody please help me understand why that isn’t working and what I need to do?

thanks
Doug

This may be wrong if you were using v2 API beforehand. The Premium 30day API Premium search APIs | Docs | Twitter Developer Platform is a v1.1 API, and v2 API GET /2/tweets/search/recent | Docs | Twitter Developer Platform is a totally different API. You need different client libraries to make calls to them. There is no difference if you were using the 30day Sandbox Vs Paid Premium, except you can make calls with 500 max results per page, and more operators.

What exact library / implementation are you using to make the calls? It looks like you’re still trying to make a call to v2 Search API, which is restricted to last 7 days.

Thanks, Igor.

Yes, I’m using the v2 Search API. Is there any way to get 30-day history with that API?

If not, how difficult is it to convert that API call to the v1.1 API? I’ve just gotten familiar with v2, so not sure what v1.1 entails. Thanks for any input on this.

Below is the API call I’m making:

client = tweepy.Client(bearer_token, wait_on_rate_limit=True)

gathered_tweets = []
for response in tweepy.Paginator(client.search_recent_tweets,
                                 query = searchQ,
                                 user_fields = ['name', 'description', 'username', 'profile_image_url', 'url', 'pinned_tweet_id', 'verified', 'created_at', 'location', 'public_metrics', 'entities'],
                                 tweet_fields = ['public_metrics', 'created_at','lang', 'attachments', 'context_annotations', 'conversation_id', 'entities', 'geo', 'in_reply_to_user_id', 'possibly_sensitive', 'referenced_tweets', 'reply_settings', 'source'],
                                 media_fields = ['duration_ms', 'media_key', 'preview_image_url', 'type', 'url', 'height', 'width', 'public_metrics'],
                                 expansions = ['author_id', 'attachments.media_keys', 'entities.mentions.username', 'geo.place_id', 'in_reply_to_user_id', 'referenced_tweets.id', 'referenced_tweets.id.author_id'],
                                 start_time = start_tw,
                                 end_time = end_tw,
                              max_results=100):
    time.sleep(1)
    gathered_tweets.append(response)
1 Like

Unfortunately No. You need to be calling a totally different endpoint to make use of your 30day Premium subscription.

In tweepy, you can use API — tweepy 4.8.0 documentation (So using tweepy.API not tweepy.Client) the result format will be totally different, and won’t have the same fields, or parameters, or anything else the same as v2 API.

OK, thanks Igor. Bummed to hear that, but I’ll check it out. Appreciate you including the link.

1 Like