How to Modify pdfRest Cloud API Code for Compatibility with Self-Hosted API

Share this page

Converting from Cloud to Self-Hosted

Transitioning from the pdfRest Cloud API to the Self-Hosted API offers enhanced control and security for your document processing workflows. While both APIs share a common foundation, a few code adjustments are necessary for seamless migration. Follow this guide to make the switch efficiently.

API Reference Documentation

Browsing both the Cloud API Reference Guide and the PDF Toolkit Self-Hosted API Reference Guide, you will notice that most of the API documentation is the same across both services, and the differences may be hard to spot. Let's step through those differences to highlight what you will need to modify from your Cloud API code to make it compatible with the Self-Hosted API.

Endpoint Updates

You will need to update API calls to reflect Self-Hosted API endpoints. This involves substituting the domain component of the endpoint, https://api.pdfrest.com, with the custom URL configured for your Self-Hosted API backend.

The endpoint route names for each tool remain the same. For example, /compressed-pdf would be the same route name appended to the end of the Cloud API or your own Self-Hosted API domain, as in:

  • Cloud API: https://api.pdfrest.com/compressed-pdf
  • Self-Hosted API: https://your-domain-example.com/compressed-pdf


Authentication Changes

Each API Call to the Cloud API service requires your API Key to be included as a header parameter. The Self-Hosted API service does not require API Keys, as this service provides you with full control to set and configure security measures within AWS. You can simply remove the API Key header parameter from all calls sent to Self-Hosted API.

Code Examples

Cloud API request example:

curl -X POST "https://api.pdfrest.com/compressed-pdf" \
  -H "Accept: application/json" \
  -H "Content-Type: multipart/form-data" \
  -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
  -F "file=@/path/to/file" \
  -F "output=example_out" \
  -F "compression_level=high"

Self-Hosted API request example:

curl -X POST "YOUR_DOMAIN_HERE/compressed-pdf" \
   -H "accept: application/json" \
   -H "Content-Type: multipart/form-data" \
   -F "file=@/path/to/file" \
   -F "output=example_output" \
   -F "compression_level=high"



Self-Hosted Pro Tools

Tools that are designated as Pro Tools in the Cloud API service can be accessed via separate Self-Hosted products in AWS and separate documentation pages. The same changes described above apply to these tools for converting Cloud API code to Self-Hosted API code.

PDF Forms Pro

PDF to Office Pro

  • Self-Hosted Product coming soon to AWS


By following these steps, you'll successfully adapt your code for the Self-Hosted API and enjoy the benefits of enhanced control and security over your document processing workflows. If you encounter any challenges, please reach out to the pdfRest support team for assistance.

Generate a self-service API Key now!
Create your FREE API Key to start processing PDFs in seconds, only possible with pdfRest.