instagrapi

please_wait_a_few_minutes: instagrapi rate limit and how to recover

Maintained by the instagrapi contributors · Library on GitHub

Updated

A worker that was happily walking through a hashtag suddenly stops. Python prints instagrapi.exceptions.PleaseWaitFewMinutes: please_wait_a_few_minutes and the loop dies in the middle of page seven. Nothing about your code changed; the previous six pages came back fine. What just happened is not a ban and not an authentication failure — it is Instagram’s soft rate limit, the politest signal in the platform’s anti-abuse stack. The server is telling your client, in so many words, to slow down and try again shortly. Most teams misread this as a session problem and panic-rotate proxies or re-login, both of which make the situation worse, because the limit is account-bound and re-authentication looks even more suspicious to the risk model than the original burst that triggered the wait in the first place.

This page is specifically about recovering from PleaseWaitFewMinutes mid-job, not about avoiding rate limits altogether (that is a request-budget design problem covered in the proxy-setup and scraper guides). We will look at what the symptoms actually look like, the exact frame in instagrapi that raises the exception, the three things Instagram’s risk model is reacting to when it fires, and a three-step recovery pattern — sleep, pace, and (only if needed) move IP. The Deep dive at the end explains why hashtag and follower endpoints are the canaries that hit this limit first, and how it relates to the harder feedback_required block one tier above it.

Symptoms

PleaseWaitFewMinutes is raised mid-loop on a previously-good action. The script has been running for minutes or hours, returns a few hundred or thousand items successfully, and then a single call into one of the heavy endpoints — usually hashtag_medias_recent, hashtag_medias_top, user_followers, or user_following — bounces with the soft-limit envelope. The HTTP layer underneath occasionally surfaces a 429 Too Many Requests, but more often the response is a 200 with a structured error body, which is why naive HTTP-status retry logic does not catch it.

  • The exception fires on a feature call that was previously succeeding in the same process.
  • cl.last_response.status_code is typically 200 with an embedded error envelope, sometimes 429.
  • cl.last_response.json()['message'] contains a phrase like Please wait a few minutes before you try again.
  • Sleeping ten to thirty minutes and retrying the same call usually succeeds without any other intervention.
  • Hashtag and follower walks trigger it fastest; profile lookups and single-media fetches are noticeably more permissive.

Real-world traceback

Traceback (most recent call last):
  File "scraper.py", line 35, in <module>
    for page in cl.hashtag_medias_recent_chunk("python"):
  File ".../instagrapi/mixins/hashtag.py", line 89, in hashtag_medias_recent_chunk
    self._call_api(...)
  File ".../instagrapi/mixins/private.py", line 285, in handle_response_status
    raise PleaseWaitFewMinutes(message="Please wait a few minutes...")
instagrapi.exceptions.PleaseWaitFewMinutes: please_wait_a_few_minutes

The frame that matters here is instagrapi.mixins.private.handle_response_status, which is the chokepoint that inspects every response body for soft-limit envelopes before the payload is allowed to bubble up to the user-facing method. When handle_response_status sees the soft-limit marker it raises PleaseWaitFewMinutes directly rather than retrying — the library deliberately does not paper over rate limits with internal retries because that would silently mask the back-pressure signal you actually need to see in your worker logs.

Why it happens

The triggers are not random. Instagram’s soft-limit decision is driven by a small handful of signals, and the three below cover almost every production hit. Knowing which one you are seeing tells you whether to wait, slow down, or move IP — three different fixes for what looks like one error.

1. Volume burst on a hot endpoint

The single biggest cause is hitting an endpoint that has a tighter per-account budget than the rest. Hashtag recent feeds and follower/following enumerations are the canaries — empirically these endpoints will start raising PleaseWaitFewMinutes after roughly a few hundred calls in a short window, while profile-info and media-info calls can run an order of magnitude longer before tripping the same trigger. Mixing call types matters: a worker that does 80% hashtag scraping and 20% profile lookups burns its hashtag budget far faster than a worker that interleaves at 20/80, even though the total request count is identical. The risk model weighs the kind of call, not just the rate.

2. Datacenter IP fingerprint

Even with conservative pacing, requests from AWS, GCP, Hetzner, or DigitalOcean IP ranges trigger the limit several times faster than residential or mobile IPs do. Instagram fingerprints ASN ranges and applies a stricter budget to the ones it tags as datacenter. This is invisible from the client side — you will not see a different status code or a different envelope — but the practical effect is that the same workload that runs for an hour on a residential proxy starts hitting PleaseWaitFewMinutes after fifteen minutes when the proxy is swapped to a cloud IP.

3. Stale session age triggering re-auth churn

The third trigger is more subtle. A long-lived session that has not been re-dumped recently will sometimes trigger background re-authentication mid-loop — instagrapi refreshes a CSRF token, the cookie jar shifts, and the very next call is treated as a brand-new session for risk-scoring purposes. Brand-new sessions get tighter budgets for the first few minutes of their life, so a worker that was below the limit a moment ago is suddenly above it. This is why “everything was fine, then PleaseWaitFewMinutes started firing every few minutes” is often a session-freshness problem, not a rate problem.

Fix in instagrapi

The recovery sequence is a three-layer cake: catch and sleep first, add pacing once you know the burst pattern, pin a residential proxy if you are still hitting the limit. Do them in that order — adding a proxy before adding pacing usually just relocates the problem rather than fixing it.

  1. Catch the exception, sleep, and retry once. This is the minimum viable recovery. The single retry after a long sleep usually succeeds; if it fails again, raise — repeated immediate retries within a short window escalate to feedback_required, which is a much harder block to recover from.

    import time
    from instagrapi.exceptions import PleaseWaitFewMinutes
    
    def safe_call(method, *args, **kwargs):
        try:
            return method(*args, **kwargs)
        except PleaseWaitFewMinutes:
            print("soft rate limit; sleeping 600s")
            time.sleep(600)
            return method(*args, **kwargs)
  2. Add request pacing across the loop. A single retry handles the symptom; pacing prevents the next hit. The cheapest effective pacing is a short jittered sleep between calls — on the order of one to three seconds for hashtag walks, less for cheaper endpoints. Constant intervals look automated to the risk model, so always jitter.

    import random, time
    
    def paced(method, *args, base=2.0, jitter=1.0, **kwargs):
        result = method(*args, **kwargs)
        time.sleep(base + random.uniform(0, jitter))
        return result
  3. Pin a residential proxy. If you have already added pacing and a single retry and the limit is still hitting inside half an hour, the IP fingerprint is the next lever. Move the worker to a residential or mobile proxy and rotate at session granularity, not per-request — flipping IPs every call is itself a flag. The dump-and-load mechanics of the session matter here too; see the proxy setup guide for the exact cl.set_proxy() placement relative to load_settings().

Deep dive

The reason hashtag and follower endpoints trip PleaseWaitFewMinutes first is not that they are inherently noisier — it is that Instagram’s risk model treats them as enumeration-pattern endpoints and applies tighter budgets accordingly. Reading a single user’s profile is what a real human does; pulling the entire follower list of an account with a million followers is not. The model is not literally counting your calls and comparing against a fixed quota; it is scoring the shape of your traffic and reacting when the shape looks too much like a scraper. This is why pacing helps even when you are well under any plausible numeric quota — you are not fitting a budget, you are reshaping the curve of your call pattern.

The relationship between please_wait_a_few_minutes and feedback_required is escalation: the soft limit is the first warning, and ignoring it (by retrying immediately, or by hitting the same endpoint again from another IP without rest) is what tips the risk score over the threshold for the harder block. Three soft limits in an hour is roughly where the escalation happens in practice. If you find your worker getting feedback_required after two or three PleaseWaitFewMinutes cycles, the fix is not to add more retry logic — it is to lengthen the sleep, add jitter, and slow down the loop so the soft limit fires less often. The block that matters is the one you do not get, because you waited long enough that the score never crossed the line.

Related errors

Related guides

Frequently asked

How long is 'a few minutes' really?

When please_wait_a_few_minutes fires, Instagram's soft rate limits typically lift in 5–15 minutes for low-severity hits, but can stretch to hours under load. Plan for at least 10 minutes of backoff before retry.

Will please_wait_a_few_minutes escalate to a hard ban?

Repeated hits within an hour escalate. After 3+ please_wait_a_few_minutes events on the same account, Instagram tends to apply feedback_required (longer block) and eventually a multi-day cooldown.

Can I bypass please_wait_a_few_minutes by rotating proxies?

Partially — a fresh residential IP can sometimes recover faster, but the limit is account-bound, not just IP-bound. Proxy rotation reduces but does not eliminate the wait.

Does please_wait_a_few_minutes affect all endpoints equally?

No. Hashtag scraping and follower walks trigger it fastest. Profile lookups and media downloads are more permissive. Tune your endpoint mix to slow the heavy hitters.

Skip the infra?

Managed Instagram API — same endpoints, sessions and proxies handled.

Try HikerAPI → Full comparison
More from the team