This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Simultaneous API calls from a single IP are not allowed

dante2010 wrote on 2014-04-11:
Hi,

All of a sudden I am getting this error returned from the API.

Simultaneous API calls from a single IP are not allowed.

I haven't changed any code, and have only seen this error a few times in the past. Is there a way to ensure a call to the API is properly closed from my server IP?
dante2010 wrote on 2014-04-11:
This is using PHP
support wrote on 2014-04-12:
Hello,

I checked our logs and noticed that some of the web pages converted by your application take too long to load (more than 3 minutes). I don't know how your application is implement but it seems that this increases the probability that your application will send multiple requests at a time.

I would recommend the following steps to resolve the issue.

1/ Ensure that your web pages load in a timely fashion. Consider caching a web page first and then call the API with a warm cache.

2/ If the API returns the 503 error (Simultaneous API calls from a single IP are not allowed), it is perfectly OK to sleep for a few seconds and then resend the unsuccessful request.
$tries = 0;
$success = false;
    
while (!$success) {
    $tries += 1;
    try {
        // call the API
        $success = true;
    } catch(PdfcrowdException $why) {
        if ($why->getCode() != 503 || $tries == 5) {
            // log error and re-throw the exception
            throw $why;
        } else {
            sleep(1);
        }
    }
}