pdfRest Cloud API Reference Guide
REST API Tools for simple PDF processing with GET and POST HTTP requests


Getting Started
Welcome to the pdfRest Cloud API Reference Guide! Below you will find all the information you will need to get started using the
pdfRest API Tools with your dedicated API Key. If you don't have a key yet, generate one for free at pdfrest.com/getstarted

This guide is organized by API endpoints, which express the output file types that can be generated from input files supplied with
requests. For example, to convert a JPG file to a PDF, you would send the JPG file to the /pdf endpoint.

Additional Resources
  • API Lab - an intuitive interface to learn the tools and parameters, build code automatically, send API calls directly from the website, and download output files
  • GitHub Repository - functional code examples available for several popular languages
  • Postman Collection - preconfigured API calls ready to send using the Postman API Platform




API Endpoints
 GET  /resource/{id}

Summary
Retrieve a resource or its URL by ID. Resource IDs can be found in the JSON response of POST requests.

Examples


Path Parameters
NameDescriptionDefaultRequired
idAlphanumeric ID (UUID) of the resource to return

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneYes
formatSpecify whether to return the file directly, URL to the file, or information about the file

Accepts:
  • file - return the file itself
  • url - return JSON containing the URL of the resource file
  • info - return JSON containing detailed information about the file:
    • resource ID
    • file name
    • url
    • file type
    • file size (bytes)
    • last modified datetime
NoneYes


Responses
Response Status CodeDescriptionJSON Response Example
200OK
(format = url)
{
   "url": "https://api.pdfrest.com/resource/0950b9bdf-0465-4d3f-8ea3-d2894f1ae839?format=file"
}
200OK
(format = info)
{
   "id":"2e523af74-7de9-492a-b7c6-c96eacd18a3a",
   "name":"smallword.doc",
   "url":"https://api.pdfrest.com/resource/2e523af74-7de9-492a-b7c6-c96eacd18a3a?format=file",
   "type":"application/msword",
   "size":22528,
   "modified":"2023-05-19T16:22:56.780Z"
}
400Bad Request
{
   "error": "Invalid Request"
}
404Not Found
{
   "error": "That file does not exist"
}



 POST  /pdf-info

Summary

Return detailed information about a PDF document and its contents to assess the current state of the file and drive conditional processing.

NOTE: Some PDF conditions can prevent all queries from completing. For example, if the document is password-protected, corrupted, or not actually a PDF, all queries will not be able to be completed. The output response will always include an "allQueriesProcessed" field with a true or false value. When this is false, an additional "warning" field will also be included in the output response with a human-readable string explaining why all queries could not be processed.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
queriesComma separated list of information to request about the input PDF file and its contents.

Accepts:
  • tagged - Checks for presence of structure tags in the input document. Returns true or false
  • image_only - Checks if the document is 'image only' meaning that it will only feature a series of embedded graphical image files, one per page and does not have any text or other features common to PDF documents, except for some metadata. Returns true or false
  • title - The title of the PDF as listed in the metadata. Returns a string which may be empty if the document does not have a title
  • subject - The subject of the PDF as listed in the metadata. Returns a string which may be empty if the document does not have a subject
  • author - The author of the PDF as listed in the metadata. Returns a string which may be empty if the document does not have an author
  • producer - The producer of the PDF as listed in the metadata. Returns a string which may be empty if the document does not have a producer
  • creator - The creator of the PDF as listed in the metadata. Returns a string which may be empty if the document does not have a creator
  • creation_date - The creation date of the PDF as listed in the metadata. Returns a string which may be empty if the document does not have a creation date
  • modified_date - The most recent modification date of the PDF as listed in the metadata. Returns a string which may be empty if the document does not have a modification date
  • keywords - The keywords of the PDF as listed in the metadata. Returns a string which may be empty if the document does not have keywords
  • doc_language - The language that the file claims to be written in. Returns a string
  • page_count - The number of pages in the PDF document. Returns an integer
  • contains_annotations - Checks whether the document contains annotations, such as notes, highlighted text, file attachments, crossed out text, and text callout boxes. Returns true or false
  • contains_signature - Checks if the document contains any digital signatures. Returns true or false
  • pdf_version - Retrieves the version of the PDF standard that the document was created with. Returns a string of the form X.Y.Z where X, Y, and Z are the major, minor, and extension versions respectively
  • file_size - Retrieves the size of the input file in bytes. Returns an integer
  • filename - The name of the input file. Returns a string
  • restrict_permissions_set - Checks whether the document has restrict permissions set to prevent printing, copying, signing etc. Returns true or false
  • contains_xfa - Checks whether the document contains XFA forms. Returns true or false
  • contains_acroforms - Checks whether the document contains Acroforms. Returns true or false
  • contains_javascript - Checks whether the document contains javascript. Returns true or false
  • contains_transparency - Checks whether the document contains transparent objects. Returns true or false
  • contains_embedded_file - Checks whether the document contains one or more embedded files. Returns true or false
  • uses_embedded_fonts - Checks whether the document contains fully embedded fonts. Returns true or false
  • uses_nonembedded_fonts - Checks whether the document contains non-embedded fonts. Returns true or false
  • pdfa - Checks whether the document conforms to a PDF/A standard. Returns true or false
  • pdfua_claim - Checks whether the document claims to conform to a PDF/UA standard. Returns true or false
  • pdfe_claim - Checks whether the document claims to conform to a PDF/E standard. Returns true or false
  • pdfx_claim - Checks whether the document claims to conform to a PDF/X standard. Returns true or false
  • requires_password_to_open - Checks whether the document requires a password to open. Returns true or false. *Note* A document requiring a password cannot be opened by this route and will not be able to return much other information


  • Example:
    tagged,image_only,creation_date,modified_date,doc_language
NoneYes


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "title": "2015 Form W-4", "page_count":2, "doc_language":"English", "tagged":true, "image_only":false, "author":"US IRS", "creation_date":"2014-11-20T10:22:59", "modified_date":"2014-11-20T10:24:16", "producer":"Adobe LiveCycle Designer ES 9.0"
"allQueriesProcessed": "true"
}
400Bad Request
{
   "error": "This route will only accept a File or an ID, not both."
}
401Unauthorized
{
   "error": "An Api-Key header is required to send this request."
}



 POST  /extracted-text

Summary

Extract all text from a PDF, optionally including style and/or position information.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
full_textReturns all text from the document without metadata, optionally split by page

Accepts:
  • off
  • by_page
  • document
documentNo
word_styleAdds a JSON-formatted list of each word in the document with style information for each word, including font, size, color, and color-space.
NOTE: Turning on word_style and word_coordinates will add both types of metadata to the same word list

Accepts:
  • off
  • on
offNo
word_coordinatesAdds a JSON-formatted list of each word in the document, including page and coordinates of all 4 corners of each word's bounding box.
NOTE: Turning on word_style and word_coordinates will add both types of metadata to the same word list

Accepts:
  • off
  • on
offNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "words": [
      {
         "text": "Example",
         "page": 1,
         "coordinates": {
            "topLeft": {
               "x": 72,
               "y": 720.7918090820312
            },
            "topRight": {
               "x": 90.12725830078125,
               "y": 720.7918090820312
            },
            "bottomLeft": {
               "x": 72,
               "y": 704.72412109375
            },
            "bottomRight": {
               "x": 90.12725830078125,
               "y": 704.72412109375
            }
         },
         "style": {
            "color": {
               "space": "DeviceRGB",
               "values": [
                  0,
                  0,
                  0
               ]
            },
            "font": {
               "name": "Calibri",
               "size": 12
            }
         }
      },
      {
         "text": "Text",
         "page": 1,
         "coordinates": {
            "topLeft": {
               "x": 92.83438110351562,
               "y": 720.7918090820312
            },
            "topRight": {
               "x": 117.22337341308594,
               "y": 720.7918090820312
            },
            "bottomLeft": {
               "x": 92.83438110351562,
               "y": 704.72412109375
            },
            "bottomRight": {
               "x": 117.22337341308594,
               "y": 704.72412109375
            }
         },
         "style": {
            "color": {
               "space": "DeviceRGB",
               "values": [
                  0,
                  0,
                  0
               ]
            },
            "font": {
               "name": "Calibri",
               "size": 12
            }
         }
      },
   ],
   "fullText": "Example Text",
   "inputId": "12a381657-5b30-49ae-b76e-d5f1bdd58930"
}
400Bad Request
{
   "error": "Uploaded file is not valid input for this route. See documentation for valid file format(s)."
}
401Unauthorized
{
   "error": "An Api-Key header is required to send this request."
}



 POST  /pdf

Summary
Convert many types of files to PDF

Accepts all of the following input file types:
  • Microsoft Word (.doc, .docx)
  • Microsoft Excel (.xls, .xlsx)
  • Microsoft PowerPoint (.ppt, .pptx)
  • PostScript and Encapsulated PostScript (.ps, .eps)
  • JPEG (.jpg, .jpeg)
  • TIF (.tif, .tiff)
  • BMP (.bmp)
  • PNG (.png)
  • HTML (.html)
  • HTML (from URL)

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any file of supported type

Example:
@PATH_TO_FILE/example_file.html
NoneOne of:
  • file
  • id
  • url
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
  • url
urlURL of web page to process

Accepts:
Any valid URL

Example:
https://en.wikipedia.org/wiki/Datalogics
NoneOne of:
  • file
  • id
  • url
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_pdfNo
compressionImage compression for PostScript, Microsoft Office, HTML conversion

Accepts:
  • lossy
  • lossless
lossyNo
downsampleDownsample images during PostScript, Microsoft Office, HTML conversion or preserve original resolutions with the 'off' option

Accepts:
  • off
  • 75
  • 150
  • 300
  • 600
  • 1200
300No
tagged_pdfMicrosoft Office file conversion only: Create a tagged PDF document, required for accessibility compliance

Accepts:
  • on
  • off
offNo
localeMicrosoft Office file conversion only: Set the UTF-8 Locale used for correctly displaying regional numerical and monetary values, time and date formats, and other locale-specific standards.

Accepts:
  • US - applies en_US
  • Germany - applies de_DE


Example:
Germany
USNo
page_sizeHTML conversion only: Select a page size for the PDF file. Options correspond to standard paper sizes

Accepts:
  • letter
  • legal
  • ledger
  • A3
  • A4
  • A5
letterNo
page_marginHTML conversion only: Set margins for a PDF file in inches or millimeters

Accepts:
A number followed by either 'in' or 'mm'

Example:
  • 8mm
  • 2.5in
  • 10.25mm
  • 0in
1inNo
page_orientationHTML conversion only: Set the page orientation

Accepts:
  • portrait
  • landscape
portraitNo
web_layoutHTML conversion only: For web pages with responsive design, select the intended web layout

Accepts:
  • desktop
  • tablet
  • mobile
desktopNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
400Bad Request
{
   "error": "0 is not within the acceptable range for downsample."
}
401Unauthorized
{
   "error": "The provided key is not valid."
}



 POST  /pdfa

Summary
Converts PDF to any of the following PDF/A versions:
  • PDF/A-1b - Basic conformance with visual appearance.
  • PDF/A-2b - Basic conformance with archival standards but revised for later versions of the PDF format. PDF/A-2 includes options for OpenType fonts, layers, attachments (which must also be PDF/A compliant) and JPEG 2000 image compression.
  • PDF/A-2u - Matches PDF/A-2b but also requires that all text in the document have Unicode mappings.
  • PDF/A-3b - Matches PDF/A-2b, except that it is possible to embed any kind of file in the PDF document. For example, with PDF/A-3 a user can save a XML, CSV, CAD, spreadsheet, or other type of file in the PDF document and be compliant. The file embedded in the PDF/A-3 does not need to PDF/A compliant.
  • PDF/A-3u - Matches PDF/A-3b, but also requires that all text in the document have Unicode mapping.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
output_typeDesired PDF/A version for the output PDF

Accepts:
  • PDF/A-1b
  • PDF/A-2b
  • PDF/A-2u
  • PDF/A-3b
  • PDF/A-3u
NoneYes
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_pdfaNo
rasterize_if_errors_encounteredWhen set to ON, if the API finds errors when converting a PDF document, it will rasterize the page with the problem into a graphic image and continue to save the document as a PDF/A document. If set to OFF it will instead return an error in such cases.

Accepts:
  • on
  • off
offNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
400Bad Request
{
   "error": "PDF/A-2x is not within the acceptable range for output_type."
}
401Unauthorized
{
   "error": "The input file is password protected and cannot be processed."
}



 POST  /pdfx

Summary
Converts PDF to any of the following PDF/X versions:
  • PDF/X-1a
  • PDF/X-3
  • PDF/X-4
  • PDF/X-6

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
output_typeDesired PDF/X version for the output PDF

Accepts:
  • PDF/X-1a
  • PDF/X-3
  • PDF/X-4
  • PDF/X-6
NoneYes
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_pdfxNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
400Bad Request
{
   "error": "PDF/X-5 is not within the acceptable range for output_type."
}
401Unauthorized
{
   "error": "The input file is password protected and cannot be processed."
}



 POST  /word

Summary
Converts a PDF to a Microsoft Word document
Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_wordNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
400Bad Request
{
   "error": "This route will only accept a File or an ID, not both."
}
401Unauthorized
{
   "error": "The input file is password protected and cannot be processed."
}



 POST  /excel

Summary
Converts a PDF to a Microsoft Excel document
Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_excelNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
400Bad Request
{
   "error": "This route will only accept a File or an ID, not both."
}
401Unauthorized
{
   "error": "The input file is passexcel protected and cannot be processed."
}



 POST  /powerpoint

Summary
Converts a PDF to a Microsoft PowerPoint document
Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_powerpointNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
400Bad Request
{
   "error": "This route will only accept a File or an ID, not both."
}
401Unauthorized
{
   "error": "The input file is passpowerpoint protected and cannot be processed."
}



 POST  /compressed-pdf

Summary
Compresses a PDF to maximally reduce file size while maintaining usable content. Three preset compression levels are offered: low, medium, and high. These produce progressively smaller files with a tradeoff between fidelity and size reduction. Compression options may also be customized via a configurable JSON profile.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
compression_levelDegree of compression with a tradeoff between preserving fidelity (low) and maximizing file size reduction (high)
NOTE: When custom is selected, profile parameter is required

Accepts:
  • low
  • medium
  • high
  • custom
NoneYes
profileJSON profile to be uploaded with specifications for configurable compression settings

Create a JSON profile with custom settings

Accepts:
Any valid JSON profile

Example:
@PATH_TO_FILE/example_profile.json
NoneRequired when compression_level is set to custom
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_compressed-pdfNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
400Bad Request
{
   "error": "This route will only accept a File or an ID, not both."
}
401Unauthorized
{
   "error": "The input file is password protected and cannot be processed."
}
422Unprocessable Entity
{
   "error": "The 'profile' file provided is not a JSON file, please see documentation for sample profile."
}



 POST  /watermarked-pdf

Summary

Apply either a text-based or an image-based watermark to all pages of a PDF with customizable font, text size, color, opacity, scale, positioning, and rotation.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data


Body Parameters
NameDescriptionDefaultRequired
filePDF file to be uploaded and watermarked

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
watermark_textThe text to apply to the input document as a watermark

Accepts:
Any text string

Example:
Property of ABC Company
NoneOne of:
  • watermark_text
  • watermark_file
  • watermark_file_id
watermark_filePDF file to apply to the input document as a watermark

Accepts:
Any PDF file (NOTE: to apply another graphic image format as a watermark, first convert that format to PDF with the /pdf endpoint)

Example:
@PATH_TO_FILE/watermark_image.pdf
NoneOne of:
  • watermark_text
  • watermark_file
  • watermark_file_id
watermark_file_idAlphanumeric ID (UUID) of existing PDF file on server to be applied as a watermark

Accepts:
Any valid resource ID returned by a POST request

Example:
1f50b5bdf-0425-7d3f-1ea3-v2894f1ae833
NoneOne of:
  • watermark_text
  • watermark_file
  • watermark_file_id
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_watermarked-pdfNo
fontFont to use for a text watermark

Accepts:
See Font List for a complete list

Example:
CourierStd
ArialNo
text_sizeSize of text for a text watermark

Accepts:
5-100

Example:
20
72No
text_color_rgbComma separated Red, Green, Blue values for a text watermark
NOTE: cannot be used with text_color_cmyk

Accepts:
Each value must be between 0 and 255

Example:
255,0,0
0,0,0No
text_color_cmykComma separated Cyan, Magenta, Yellow, Key (Black) values for a text watermark
NOTE: cannot be used with text_color_rgb

Accepts:
Each value must be between 0 and 100

Example:
100,0,0,0
NoneNo
watermark_file_scaleScale applied to resize the content of a pdf watermark file

Accepts:
Any non-negative number

Example:
2.25
0.5No
opacityOpacity value for both text and file watermarks

Accepts:
Any decimal value from 0 to 1, where 0 is fully transparent and 1 is fully opaque

Example:
0.75
0.5No
xHorizontal offset in PDF units from the center of page for both text and file watermarks (72 units = 1 inch)

Accepts:
Any integer value

Example:
-72
0 (horizontal center of page)No
yVertical offset in PDF units from the center of page for both text and file watermarks (72 units = 1 inch)

Accepts:
Any integer value

Example:
150
0 (vertical center of page)No
rotationRotation in degrees to be applied to both text and file watermarks

Accepts:
Any integer value

Example:
45
0No


Responses
Response Status CodeDescriptionJSON Response Example
200OK

NOTE: inputId always returns the resource ID of the input PDF to be watermarked. When a file is used as a watermark, inputID returns an array with the resource ID of the input PDF that was watermarked first and the resource ID of the input file that was applied as a watermark second.
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": ["1e3c7fefe-45e0-48f2-bf8d-fe506e1d7838", "11e24955f-bbe9-4267-aac6-d1c7e531a426"]
}
400Bad Request
{
   "error": "The requested font was not found. Please see the documentation for a list of accepted fonts."
}
401Unauthorized
{
   "error": "The input file was corrupted, password-protected, or not a PDF."
}



 POST  /encrypted-pdf

Summary

Encrypt a PDF using 256-bit AES encryption with a 32-bit key. Encrypted PDFs cannot be viewed without first providing the open password.

Use "current_open_password" with "new_open_password" to change the open password on a document that was already encrypted. Use "current_permissions_password" if the input document has a permissions password.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
new_open_passwordNew open password

Accepts:
A string between 6 and 128 characters long

Example:
1234567890qwertyuiop
NoneYes
current_open_passwordExisting open password

Accepts:
A valid password

Example:
OpenUp
NoneNo
current_permissions_passwordExisting permissions password

Accepts:
A valid password

Example:
oahfoufdo99
NoneNo
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_encrypted-pdfNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
400Bad Request
{
   "error": "The given new password is too short."
}
401Unauthorized
{
   "error": "The input file was corrupted, password-protected, or not a PDF."
}



 POST  /decrypted-pdf

Summary

Remove encryption from a PDF. Use "current_permissions_password" if the input document has a permissions password.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
current_open_passwordExisting open password

Accepts:
A valid password

Example:
OpenUp
NoneYes
current_permissions_passwordExisting permissions password

Accepts:
A valid password

Example:
oahfoufdo99
NoneNo
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_decrypted-pdfNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
400Bad Request
{
   "error": "A password is required to process the document."
}
401Unauthorized
{
   "error": "The input file was corrupted, password-protected, or not a PDF."
}



 POST  /restricted-pdf

Summary

Apply one or more document security restrictions to PDF with a permissions password. At minimum, a permissions password prevents the security settings of a document from being modified. Use "restrictions[]" to add additional security restrictions.

Use "current_permissions_password" with "new_permissions_password" to change the permissions password on a document.

NOTE: Setting a new permissions password will normally overwrite existing security data, including the open password. Use "current_open_password" to keep encryption with an already applied open password.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
new_permissions_passwordNew permissions password

Accepts:
A string between 6 and 128 characters long

Example:
igy4e5ds7g87646fYFtfTFdh78g6DR
NoneYes
current_permissions_passwordExisting permissions password

Accepts:
A valid password

Example:
passwordpassword123
NoneNo
restrictions[]Document restrictions to be applied. Restricted operations are locked behind the permissions password when interacting with a restricted document.

Accepts:
  • print_low
  • print_high
  • edit_document_assembly
  • edit_fill_and_sign_form_fields
  • edit_annotations
  • edit_content
  • copy_content
  • accessibility_off


Example:
edit_content
NoneNo
current_open_passwordExisting open password

Accepts:
A valid password

Example:
openfileplease
NoneNo
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_restricted-pdfNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
400Bad Request
{
   "error": "This route will only accept a File or an ID, not both."
}
401Unauthorized
{
   "error": "The input file was corrupted, password-protected, or not a PDF."
}



 POST  /unrestricted-pdf

Summary

Remove all document security restrictions from a PDF.

NOTE: Removing the permissions password will normally remove all existing security data, including the open password. Use "current_open_password" to keep encryption with an already applied open password.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
current_permissions_passwordExisting permissions password

Accepts:
A valid password

Example:
kugdi9785gudw242FGdfdh
NoneYes
current_open_passwordExisting open password

Accepts:
A valid password

Example:
thisIsThePassword
NoneNo
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_unrestricted-pdfNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
400Bad Request
{
   "error": "This route will only accept a File or an ID, not both."
}
401Unauthorized
{
   "error": "Cannot process the given input file without the correct permissions password."
}



 POST  /merged-pdf

Summary
Merges multiple PDF documents or specified pages from PDF documents into a single PDF document. Any number of PDFs may be merged by specifying "file" and/or "id[]" paramaters multiple times. Files will be merged in the order they are specified.

NOTE: For each included "file" or "id[]" a corresponding "pages[]" and "type[]" must also be included to correspond to the type and desired page(s) for that input file.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and merged with other files. This parameter may be included multiple times to specify multiple files to be merged.

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne or more of:
  • file
  • id[]
id[]Alphanumeric ID (UUID) of existing file on server to be merged with other files. This parameter may be included multiple times to specify multiple files to be merged.

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne or more of:
  • file
  • id[]
pages[]Page or range of pages to include in merged file. This parameter must be specified for each "file" and "id[]" specified.

Accepts:
Any mix of individual pages and/or ranges seperated by commas. "last" can be used to represent the number of the last page of the document. Page order can be reversed using ranges with the higher number specified before the lower number.

Example:
  • 14-last
  • 9-2
  • 1,2,5-10,12-last
  • even
  • odd
NoneYes
type[]This parameter must be specified for each "file" and "id[]" specified and indicates whether a document is a new file to upload or an id for an existing file on the server. This is required to maintain the order of documents to merge.

Accepts:
  • file
  • id
NoneYes
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
pdfrest_merged-pdfNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": ["112f7ea0d-0e56-44bc-a3d2-42fdff96d993", "198f7ad08-9da2-44bc-52b3-a962d2f75114", "187d8cab2-1f53-ae13-b798-2c766db23098", "128db087e-990a-7e27-1c28-028585af8287"]
}
400Bad Request
{
   "error": "Too many 'file' or 'id' values."
}
401Unauthorized
{
   "error": "The provided key is not valid."
}



 POST  /split-pdf

Summary
Splits a single PDF document into one or more PDF documents with specified pages. Any number of PDFs may be split out from the original PDF by including "pages[]" multiple times. Output files will be returned in the order they are included.

NOTE: If "pages[]" is not specified, an output file will be created for each page of the input file containing only that page. A ten page PDF would be split into ten single-page PDFs.



Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and split into new files.

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be split into new files.

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
pages[]Page or range of pages to include in output file. This parameter may be specified multiple times to create multiple output files. If this paramater is not specified, an output file will be created for each page of the input file containing only that page.

Accepts:
Any mix of individual pages and/or ranges seperated by commas. "last" can be used to represent the number of the last page of the document. Page order can be reversed using ranges with the higher number specified before the lower number.

Example:
  • 14-last
  • 2-9
  • 1,2,10-5,12-last
  • even
  • odd
NoneNo
outputPrefix of the generated output file name(s), without extension. A sequentially incremented number will be appended to the end of this prefix for each output file name along with a .pdf extension.

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_split-pdfNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": ["https://api.pdfrest.com/resource/255b5217c-a7cd-447b-99b3-0cadc9dc3831?format=file", "https://api.pdfrest.com/resource/203090407-cb1e-4c68-b7e1-c5b21211c0cd?format=file", "https://api.pdfrest.com/resource/24dd24471-a8b7-4f7c-b82b-5fc7ed55f74c?format=file"],
"outputId": [ "255b5217c-a7cd-447b-99b3-0cadc9dc3831", "203090407-cb1e-4c68-b7e1-c5b21211c0cd", "24dd24471-a8b7-4f7c-b82b-5fc7ed55f74c"],
"inputId": "1cb17d88c-7096-4d37-8b38-b97b00f587ac"
}
400Bad Request
{
   "error": "This route will only accept a File or an ID, not both."
}
401Unauthorized
{
   "error": "The provided key is not valid."
}



 POST  /pdf-with-added-image

Summary
Inserts an image into one page of a PDF at a specified location.
Accepted image formats:
  • JPEG (.jpg, .jpeg)
  • TIF (.tif, .tiff)
  • PNG (.png)
  • GIF (.gif)
NOTE: The PDF coordinate system places the origin in the lower-left corner. Coordinates are in PDF units (1 in. = 72 PDF units). Please note that PDFs with offset origins may create an offset in the placement of the image.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
filePDF file to be uploaded for an image to be added.

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing PDF file on server for an image to be added.

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
image_fileImage file to be uploaded and added to the PDF.

Accepts:
Any image file of supported format (JPEG, TIFF, PNG, GIF).

Example:
@PATH_TO_FILE/add_this.jpg
NoneOne of:
  • image_file
  • image_id
image_idAlphanumeric ID (UUID) of existing image file on server to be added to the PDF.

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • image_file
  • image_id
xHorizontal position of the image (by its lower-left corner) in PDF units (72 PDF units = 1 inch)

Accepts:
Any integer value

Example:
72
NoneYes
yVertical position of the image (by its lower-left corner) in PDF units (72 PDF units = 1 inch)

Accepts:
Any integer value

Example:
144
NoneYes
pagePage of the PDF to add the image into

Accepts:
Any valid page number for the PDF file being processed

Example:
1
NoneYes
outputName of the generated output file, without extension.

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_pdf-with-added-imageNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK

NOTE: inputId is an array of 2 elements where the first element is the resource ID of the input PDF and the second element is the resource ID of the input image file.
{
   "outputUrl": "https://api.pdfrest.com/resource/2e7de20c3-0dcd-4bed-b446-3c9c0d3f8c8c?format=file"
"outputId": "2e7de20c3-0dcd-4bed-b446-3c9c0d3f8c8c"
"inputId": ["1e3c7fefe-45e0-48f2-bf8d-fe506e1d7838", "11e24955f-bbe9-4267-aac6-d1c7e531a426"]
}
400Bad Request
{
   "error": "There was a problem reading the input image. Verify fields and try again."
}
401Unauthorized
{
   "error": "The provided key is not valid."
}



 POST  /pdf-with-added-attachment

Summary
Attaches a file to a PDF document.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
filePDF file to be uploaded for an attachment to be added.

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing PDF file on server for an attachment to be added.

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
file_to_attachFile to be uploaded and attached to the PDF.

Accepts:
Any file that can be attached to a PDF

Example:
@PATH_TO_FILE/add_this.jpg
NoneOne of:
  • file_to_attach
  • id_to_attach
id_to_attachAlphanumeric ID (UUID) of existing file on server to be attached to the PDF.

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file_to_attach
  • id_to_attach
outputName of the generated output file, without extension.

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_pdf-with-added-attachmentNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK

NOTE: inputId is an array of 2 elements where the first element is the resource ID of the input PDF and the second element is the resource ID of the attached input file.
{
   "outputUrl": "https://api.pdfrest.com/resource/2e7de20c3-0dcd-4bed-b446-3c9c0d3f8c8c?format=file"
"outputId": "2e7de20c3-0dcd-4bed-b446-3c9c0d3f8c8c"
"inputId": ["1e3c7fefe-45e0-48f2-bf8d-fe506e1d7838", "11e24955f-bbe9-4267-aac6-d1c7e531a426"]
}
400Bad Request
{
   "error": "The input PDF file claims conformance to a version of PDF/A that prohibits file attachments."
}
401Unauthorized
{
   "error": "The provided key is not valid."
}



 POST  /bmp

Summary
Convert PDF to BMP image files, one per PDF page

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
outputPrefix of the generated output file name(s), without extension. A sequentially incremented number will be appended to the end of this prefix for each output file name along with a .bmp extension.

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_bmpNo
pagesPage or range of pages to process

Accepts:
Any mix of individual pages and/or ranges seperated by commas. "last" can be used to represent the number of the last page of the document.

Example:
  • 14-last
  • 2-9
  • 1,2,5-10,12-last
1-last
(all pages)
No
resolutionOutput image resolution in Dots Per Inch (DPI)

Accepts:
12 to 2400
300No
color_modelColor model of the output file

Accepts:
  • rgb
  • gray
rgbNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
400Bad Request
{
   "error": "0 is not within the acceptable range for resolution."
}
401Unauthorized
{
   "error": "The input file is password protected and cannot be processed."
}



 POST  /jpg

Summary
Convert PDF to JPEG image files, one per PDF page

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
outputPrefix of the generated output file name(s), without extension. A sequentially incremented number will be appended to the end of this prefix for each output file name along with a .jpg extension.

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_jpgNo
pagesPage or range of pages to process

Accepts:
Any mix of individual pages and/or ranges seperated by commas. "last" can be used to represent the number of the last page of the document.

Example:
  • 14-last
  • 2-9
  • 1,2,5-10,12-last
1-last
(all pages)
No
resolutionOutput image resolution in Dots Per Inch (DPI)

Accepts:
12 to 2400
300No
color_modelColor model of the output file

Accepts:
  • rgb
  • cmyk
  • gray
rgbNo
jpeg_qualityJPEG compression quality. Higher values produce a higher quality image but also a larger output file size.

Accepts:
1 to 100
75No


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
400Bad Request
{
   "error": "0 is not within the acceptable range for resolution."
}
401Unauthorized
{
   "error": "The input file is password protected and cannot be processed."
}



 POST  /png

Summary
Convert PDF to PNG image files, one per PDF page

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
outputPrefix of the generated output file name(s), without extension. A sequentially incremented number will be appended to the end of this prefix for each output file name along with a .png extension.

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_pngNo
pagesPage or range of pages to process

Accepts:
Any mix of individual pages and/or ranges seperated by commas. "last" can be used to represent the number of the last page of the document.

Example:
  • 14-last
  • 2-9
  • 1,2,5-10,12-last
1-last
(all pages)
No
resolutionOutput image resolution in Dots Per Inch (DPI)

Accepts:
12 to 2400
300No
color_modelColor model of the output file

Accepts:
  • rgb
  • rgba
  • gray
rgbNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
400Bad Request
{
   "error": "0 is not within the acceptable range for resolution."
}
401Unauthorized
{
   "error": "The input file is password protected and cannot be processed."
}



 POST  /gif

Summary
Convert PDF to GIF image files, one per PDF page

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
outputPrefix of the generated output file name(s), without extension. A sequentially incremented number will be appended to the end of this prefix for each output file name along with a .gif extension.

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_gifNo
pagesPage or range of pages to process

Accepts:
Any mix of individual pages and/or ranges seperated by commas. "last" can be used to represent the number of the last page of the document.

Example:
  • 14-last
  • 2-9
  • 1,2,5-10,12-last
1-last
(all pages)
No
resolutionOutput image resolution in Dots Per Inch (DPI)

Accepts:
12 to 2400
300No
color_modelColor model of the output file

Accepts:
  • rgb
  • gray
rgbNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
400Bad Request
{
   "error": "0 is not within the acceptable range for resolution."
}
401Unauthorized
{
   "error": "The input file is password protected and cannot be processed."
}



 POST  /tif

Summary
Convert PDF to TIFF image files, one per PDF page

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
outputPrefix of the generated output file name(s), without extension. A sequentially incremented number will be appended to the end of this prefix for each output file name along with a .tif extension.

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_tifNo
pagesPage or range of pages to process

Accepts:
Any mix of individual pages and/or ranges seperated by commas. "last" can be used to represent the number of the last page of the document.

Example:
  • 14-last
  • 2-9
  • 1,2,5-10,12-last
1-last
(all pages)
No
resolutionOutput image resolution in Dots Per Inch (DPI)

Accepts:
12 to 2400
300No
color_modelColor model of the output file

Accepts:
  • rgb
  • rgba
  • cmyk
  • lab
  • gray
rgbNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
400Bad Request
{
   "error": "0 is not within the acceptable range for resolution."
}
401Unauthorized
{
   "error": "The input file is password protected and cannot be processed."
}



 POST  /linearized-pdf

Summary
Linearize a PDF to optimize the document for fast web view. This restructures the document to be loaded one page at a time from web servers.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_linearized-pdfNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
400Bad Request
{
   "error": "This route will only accept a File or an ID, not both."
}
401Unauthorized
{
   "error": "The input file is password protected and cannot be processed."
}



 POST  /pdf-with-imported-form-data

Summary
Import data from a file into an Acroform or XFA-based PDF form. This will find matching form fields in the PDF and fill those fields with the corresponding data from the data file.

Accepted data file formats vary, depending on the form type in the input PDF:
  • Acroform: .fdf, .xfdf, .xml
  • XFA: .xdp, .xfd, .xml

If you are unsure which form type is being used, try processing the PDF with Query PDF to run the contains_acroforms and contains_xfa checks.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file containing forms with edit permissions active

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
data_fileData file to be uploaded in order to import its data to an input PDF file

Accepts:
Accepted data file formats vary, depending on the form type in the input PDF:
  • Acroform: .fdf, .xfdf, .xml
  • XFA: .xdp, .xfd, .xml


Example:
@PATH_TO_FILE/example_file.xml
NoneYes
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_pdf-with-imported-form-dataNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
400Bad Request
{
   "error": "A data file is required to import data into a form. Use 'data_file' to upload a file."
}
401Unauthorized
{
   "error": "An Api-Key header is required to send this request."
}



 POST  /exported-form-data

Summary
Export form field data from an Acroform or XFA-based PDF form to an external data file.

Supported data file formats vary, depending on the form type in the input PDF:
  • Acroform: .fdf, .xfdf, .xml
  • XFA: .xdp, .xfd, .xml

If you are unsure which form type is being used, try processing the PDF with Query PDF to run the contains_acroforms and contains_xfa checks.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file containing forms

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
data_formatData file format for the exported form data

Accepts:
Supported data file formats vary, depending on the form type in the input PDF:
  • Acroform: fdf, xfdf, xml
  • XFA: xdp, xfd, xml


Example:
xml
NoneYes
outputName of the generated output data file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_exported-form-dataNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
400Bad Request
{
   "error": "Input PDF contains XFA form fields. Valid options for data_format are: xfd, xdp, xml"
}
401Unauthorized
{
   "error": "An Api-Key header is required to send this request."
}



 POST  /flattened-forms-pdf

Summary
Flatten all forms in a PDF, including both static and dynamic XFA and AcroForms. This makes form fields no longer editable while preserving form field data. It also ensures that PDFs with forms are compatible with all standard PDF viewers and processing tools.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_flattened-forms-pdfNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
400Bad Request
{
   "error": "This route will only accept a File or an ID, not both."
}
401Unauthorized
{
   "error": "The input file is password protected and cannot be processed."
}



 POST  /flattened-transparencies-pdf

Summary
Flatten all transparent objects in a PDF to increase RIP speed in a prepress workflow and to enable compatibility for workflows in which transparency is not supported.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_flattened-transparencies-pdfNo
qualitySet the quality to define the resolution level to use when flattening transparent objects in your PDF.
  • low - ideal for proofs that will be printed on black-and-white desktop printers and for documents that will be published on the web
  • medium - best for desktop proofs and documents that will be printed on color printers
  • high - ideal for final press outputs when high quality separations-based color proofs are needed


Accepts:
  • low
  • medium
  • high
mediumNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
400Bad Request
{
   "error": "This route will only accept a File or an ID, not both."
}
401Unauthorized
{
   "error": "The input file is password protected and cannot be processed."
}



 POST  /flattened-annotations-pdf

Summary
Flatten all annotations in a PDF to collapse their appearances into page content and make them no longer editable.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_flattened-annotations-pdfNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
400Bad Request
{
   "error": "This route will only accept a File or an ID, not both."
}
401Unauthorized
{
   "error": "The input file is password protected and cannot be processed."
}



 POST  /flattened-layers-pdf

Summary
Flatten all layers in a PDF to collapse content from multiple layers onto a single layer.

Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and processed

Accepts:
Any PDF file

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne of:
  • file
  • id
idAlphanumeric ID (UUID) of existing file on server to be processed

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne of:
  • file
  • id
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
[INPUT_FILE_NAME]_pdfrest_flattened-layers-pdfNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
400Bad Request
{
   "error": "This route will only accept a File or an ID, not both."
}
401Unauthorized
{
   "error": "The input file is password protected and cannot be processed."
}



 POST  /upload

Summary
Upload any number of files from local storage or via public URL by specifying "file" or "url" paramaters one or more times.

Examples

Required Headers
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
To upload more than one file with a single call:
Accept: application/json
Content-Type: multipart/form-data
To upload one file with a binary payload (replace file.pdf with the file's actual name and extension):
Content-Type: application/octet-stream
Content-Filename: 'file.pdf'


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded. This parameter may be included multiple times to upload multiple files but may not be combined with 'url' parameter.

Accepts:
Any file of supported type

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne or more:    file
- OR -
One or more:    url
urlPublic URL address for a file. This parameter may be included multiple times to upload multiple files from different URLs but may not be combined with 'file' parameter.

Accepts:
Any valid file accessible via public URL

Example:
https://cms.example.com/path/to/file/input.pdf
NoneOne or more:    file
- OR -
One or more:    url


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
"files": [
   {
      "name": "filename1.doc",
      "id": "2cbf6f191-4184-4bd2-82e0-531e3e1d8ba6"
   },
   {
      "name": "filename2.pdf",
      "id": "259504d9c-38c8-41a6-82f3-3f97279c9522"
   }
]
}
400Bad Request
{
   "error": "Files and URLs cannot be uploaded together."
}
401Unauthorized
{
   "error": "The provided key is not valid."
}



 POST  /zip

Summary
Compress any number of files into a .zip by specifying "file" and/or "id[]" paramaters multiple times.



Examples

Required Headers
Accept: application/json
Content-Type: multipart/form-data
Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


Body Parameters
NameDescriptionDefaultRequired
fileFile to be uploaded and zipped with other files. This parameter may be included multiple times to compress multiple files to a .zip file.

Accepts:
Any file of supported type

Example:
@PATH_TO_FILE/example_file.pdf
NoneOne or more of:
  • file
  • id[]
id[]Alphanumeric ID (UUID) of existing file on server to be zipped with other files. This parameter may be included multiple times to compress multiple files to a .zip file.

Accepts:
Any valid resource ID returned by a POST request

Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839
NoneOne or more of:
  • file
  • id[]
outputName of the generated output file, without extension

Accepts:
Any valid file name

Example:
example_out
pdfrest_zipNo


Responses
Response Status CodeDescriptionJSON Response Example
200OK
{
   "outputUrl": "https://api.pdfrest.com/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": ["112f7ea0d-0e56-44bc-a3d2-42fdff96d993", "198f7ad08-9da2-44bc-52b3-a962d2f75114", "187d8cab2-1f53-ae13-b798-2c766db23098", "128db087e-990a-7e27-1c28-028585af8287"]
}
400Bad Request
{
   "error": "Found more than one output key, only one is allowed."
}
401Unauthorized
{
   "error": "The provided key is not valid."
}



© 2024 Datalogics, Inc. All rights reserved.