[resolved] 403 Forbidden error message in logs

June 8th, 2022 / by api2pdf /

If you are seeing a 403 Forbidden error code in your logs when trying to make API calls with the any-to-pdf, merge pdf, password, bookmarks, extract-pages endpoints, this article will point you in the right direction.

When you make one of these API calls by passing in a URL to a location of a file, API2PDF automatically visits that URL. It will then download the file at that URL and begin to process the conversion.

However, in some cases, API2PDF fails to retrieve the file and is blocked. In a case of a 403 Forbidden, API2PDF is not authorized to access that URL and it logs the response it received.

In other words, API2PDF is not blocking you. You are blocking API2PDF, or rather the URL you provided is.

If the URL is something you have control over as a developer, make sure the file can be downloaded without any authentication requirements or being logged in. If so, then you should implement a method or some query string like ?token= to your url so api2pdf can bypass your authentication.

Other causes for this that we have seen are people using consumer based cloud storage platforms like Google Drive that may not play nicely with automated systems. For example, with Google Drive, they may block API2PDF since it knows it’s not a human being making these downloads. This often manifests itself by working sometimes and then failing randomly. It is not a best practice to use Google Drive. We recommend a proper file storage provider like AWS S3, Azure Storage, etc.

Hope that helps

Comments are closed.