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

pdfcrowd Error: [503] Simultaneous API calls from a single IP are not allowed

kalyanrajiv wrote on 2015-10-29:
I am using paid version of PDF crowd API. So, why I am getting this error "pdfcrowd Error: [503] Simultaneous API calls from a single IP are not allowed". I can send lot of requests at same time from same API off course. When I am using Paid API, this should not happen. It is per call based.

Please let me know how can this be fixed.
support wrote on 2015-10-30:
If your application sends multiple API requests at a time, the service returns the 503 error. We rate limit the API to ensure fair distribution of capacity among users. You can learn more about the limitations here: <https://pdfcrowd.com/api/html-to-pdf-api/#api-ref-limitations>

If the API returns the 503 error, it is perfectly ok to sleep() for a few seconds and then resend the unsuccessful request. Here is an outline:
tries = 0
  success = False
  while not success:
     tries += 1
     try:
        call the API
        success = True
     catch (pdfcrowd.Error why):
         if tries == 5:
            some serious error, log or re-throw the exception
         else:
            sleep(1 or 2 seconds)


The effectiveness of this solution depends on how many users will request a PDF at the same time but in our experience this works reasonably well in most cases.
whyknott wrote on 2015-11-25:
Can someone outline actually HOW to implement this into the generate-pdf.php file? I'm not tech savvy and cannot afford an expensive developer. Can someone outline how and where to implement the update so I stop getting the 503 error.

Thanks!
RichAnderson wrote on 2016-04-06:
whyknott Wrote:
-------------------------------------------------------
> Can someone outline actually HOW to implement this
> into the generate-pdf.php file? I'm not tech savvy
> and cannot afford an expensive developer. Can
> someone outline how and where to implement the
> update so I stop getting the 503 error.
>
> Thanks!