Self-Hosted API Reference Guide
pdfRest API Toolkit - Self-Hosted API Reference Guide
PDF processing REST APIs via GET/POST HTTP requests for AWS & Container deployment
Getting Started
Welcome to the pdfRest API Toolkit reference guide for self-hosted deployment! Below you will find all the information you need to use any of the pdfRest API Tools. 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.
Note that the examples throughout are presented using cURL, but the APIs support any standard method for sending GET and POST HTTP requests.
Additional Resources
- Setup Instructions for AWS Self-Hosted Backend - Learn how to launch and configure an EC2 and create a scalable stack
- Setup Instructions for Docker Container - Learn how to set up and configure a containerized backend solution
- API Lab - Validate solutions quickly with an intuitive interface to send calls and download results right from the website
- GitHub Repository - Find functional code examples available for popular languages and frameworks, including:
- cURL
- JavaScript
- Python
- PHP
- .NET
- Java
- Postman Collection - Try 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
curl -X GET "YOUR_DOMAIN_HERE/resource/0950b9bdf-0465-4d3f-8ea3-d2894f1ae839?format=file" --output "@PATH_TO_FILE/output_file.pdf"
curl -X GET "YOUR_DOMAIN_HERE/resource/112f7ea0d-0e56-44bc-a3d2-42fdff96d993?format=url"
Path Parameters
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneAccepts:
file- return the file itselfurl- return JSON containing the URL of the resource fileinfo- return JSON containing detailed information about the file (resource ID,file name,url,file type,file size(bytes),last modified datetime)
Default:
Noneendpoint: GET /resource/{id}
endpoint_parameters:
path:
- name: "id"
location: "path"
type: "uuid"
required: true
description: "Alphanumeric ID (UUID) of the resource to return"
accepts: "Any valid resource ID returned by a POST request"
example: "0950b9bdf-0465-4d3f-8ea3-d2894f1ae839"
default: "None"
- name: "format"
location: "path"
type: "string"
required: true
description: "Specify 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:"
info_response_fields:
- "resource ID"
- "file name"
- "url"
- "file type"
- "file size (bytes)"
- "last modified datetime"
default: "None"
Responses
{
"url": "YOUR_DOMAIN_HERE/resource/0950b9bdf-0465-4d3f-8ea3-d2894f1ae839?format=file"
}
{
"id":"2e523af74-7de9-492a-b7c6-c96eacd18a3a",
"name":"smallword.doc",
"url":"YOUR_DOMAIN_HERE/resource/2e523af74-7de9-492a-b7c6-c96eacd18a3a?format=file",
"type":"application/msword",
"size":22528,
"modified":"2023-05-19T16:22:56.780Z"
}
{
"error": "Invalid Request"
}
{
"error": "That file does not exist"
}
DELETE /resource/{id}
Summary
Delete a resource file by ID. Resource IDs can be found in the JSON response of POST requests. Note that the file must have been uploaded or generated using the same API Key provided with the call to delete it.
Examples
curl --request DELETE "YOUR_DOMAIN_HERE/resource/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
Path Parameters
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
Noneendpoint: DELETE /resource/{id}
endpoint_parameters:
path:
- name: "id"
location: "path"
type: "uuid"
required: true
description: "Alphanumeric ID (UUID) of the resource to delete"
accepts: "Any valid resource ID returned by a POST request"
example: "0950b9bdf-0465-4d3f-8ea3-d2894f1ae839"
default: "None"
Responses
{
"error": "Resource ID 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
curl -X POST "YOUR_DOMAIN_HERE/pdf-info" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "queries=title,filename"
curl -X POST "YOUR_DOMAIN_HERE/pdf-info" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "queries=tagged,image_only,creation_date,modified_date,doc_language"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts:
tagged- Checks for presence of structure tags in the input document. Returns true or falseimage_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 falsetitle- The title of the PDF as listed in the metadata. Returns a string which may be empty if the document does not have a titlesubject- The subject of the PDF as listed in the metadata. Returns a string which may be empty if the document does not have a subjectauthor- The author of the PDF as listed in the metadata. Returns a string which may be empty if the document does not have an authorproducer- The producer of the PDF as listed in the metadata. Returns a string which may be empty if the document does not have a producercreator- The creator of the PDF as listed in the metadata. Returns a string which may be empty if the document does not have a creatorcreation_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 datemodified_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 datekeywords- The keywords of the PDF as listed in the metadata. Returns a string which may be empty if the document does not have keywordscustom_metadata- Retrieves custom metadata from the PDF and presents it as a JSON list of key:value pairs, where each pair represents a custom property and its value.doc_language- The language that the file claims to be written in. Returns a stringpage_count- The number of pages in the PDF document. Returns an integercontains_annotations- Checks whether the document contains annotations, such as notes, highlighted text, file attachments, crossed out text, and text callout boxes. Returns true or falsecontains_signature- Checks if the document contains any digital signatures. Returns true or falsepdf_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 respectivelyfile_size- Retrieves the size of the input file in bytes. Returns an integerfilename- The name of the input file. Returns a stringrestrict_permissions_set- Checks whether the document has restrict permissions set to prevent printing, copying, signing etc. Returns true or falsecontains_xfa- Checks whether the document contains XFA forms. Returns true or falsecontains_acroforms- Checks whether the document contains Acroforms. Returns true or falsecontains_javascript- Checks whether the document contains javascript. Returns true or falsecontains_transparency- Checks whether the document contains transparent objects. Returns true or falsecontains_embedded_file- Checks whether the document contains one or more embedded files. Returns true or falseuses_embedded_fonts- Checks whether the document contains fully embedded fonts. Returns true or falseuses_nonembedded_fonts- Checks whether the document contains non-embedded fonts. Returns true or falsepdfa- Checks whether the document claims and conforms to a PDF/A standard. Returns true or falsepdfua_claim- Checks whether the document claims to conform to a PDF/UA standard. Returns true or falsepdfe_claim- Checks whether the document claims to conform to a PDF/E standard. Returns true or falsepdfx_claim- Checks whether the document claims to conform to a PDF/X standard. Returns true or falserequires_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_languageDefault:
Noneendpoint: POST /pdf-info
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "queries"
location: "body"
type: "string"
required: true
description: "Comma 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"
- "`custom_metadata` - Retrieves custom metadata from the PDF and presents it as a JSON list of key:value pairs, where each pair represents a custom property and its value."
- "`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 claims and 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"
default: "None"
Responses
{
"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"
}
{
"error": "This route will only accept a File or an ID, not both."
}
{
"error": "The input file is password protected and cannot be processed."
}
POST /extracted-images
Summary
Extract all embedded images from a PDF file, or from a specified range of pages, and save them as separate image files. Each image will be saved in its original format (JPG, PNG, or TIFF), preserving its original compression and properties.
Examples
curl -X POST "YOUR_DOMAIN_HERE/extracted-images" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf"
curl -X POST "YOUR_DOMAIN_HERE/extracted-images" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "pages=14-last"
Required Headers
Body Parameters
Accepts: PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_extracted-imagesAccepts: 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-last2-91,2,5-10,12-last
Default:
1-last
(all pages)endpoint: POST /extracted-images
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "output"
location: "body"
type: "string"
required: false
description: "Prefix of the generated output file name(s), without extension. The suffix \"-img###-page###\" will always be appended to the file name, where \"img###\" represents the incremental number of the extracted image file, and \"page###\" indicates the page number where the image first appeared."
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_extracted-images"
- name: "pages"
location: "body"
type: "string"
required: false
description: "Page 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"
default:
- "1-last"
- "(all pages)"
Responses
{
"outputUrl": ["YOUR_DOMAIN_HERE/resource/255b5217c-a7cd-447b-99b3-0cadc9dc3831?format=file", "YOUR_DOMAIN_HERE/resource/203090407-cb1e-4c68-b7e1-c5b21211c0cd?format=file", "YOUR_DOMAIN_HERE/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"
}
{
"outputUrl": [],
"outputId": [],
"inputId": "1cb17d88c-7096-4d37-8b38-b97b00f587ac"
"warning": "No files of the specified type were found."
}
{
"error": "Uploaded file is not valid input for this route. See documentation for valid file format(s)."
}
{
"error": "The input file is password protected and cannot be processed."
}
POST /extracted-text
Summary
Extract all text from a PDF, optionally including style and/or position information.
Examples
curl -X POST "YOUR_DOMAIN_HERE/extracted-text" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf"
curl -X POST "YOUR_DOMAIN_HERE/extracted-text" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "full_text=document" -F "word_style=on" -F "word_coordinates=on"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts:
offby_pagedocument
Default:
documentAccepts:
offon
Default:
offAccepts:
offon
Default:
offAccepts:
offon
Default:
offAccepts:
jsonfile
Default:
jsonAccepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_extracted-textendpoint: POST /extracted-text
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "full_text"
location: "body"
type: "string"
required: false
description: "Returns all text from the document without metadata, optionally split by page"
accepts:
- "off"
- "by_page"
- "document"
default: "document"
- name: "preserve_line_breaks"
location: "body"
type: "boolean"
required: false
description: "When enabled, this feature identifies and maintains the original line breaks within the text, inserting a newline character (\"\\n\") at each break point for full_text output."
accepts:
- "off"
- "on"
default: "off"
- name: "word_style"
location: "body"
type: "boolean"
required: false
description: "Adds a JSON-formatted list of each word in the document with style information for each word, including font, size, color, and color-space."
accepts:
- "off"
- "on"
default: "off"
- name: "word_coordinates"
location: "body"
type: "boolean"
required: false
description: "Adds a JSON-formatted list of each word in the document, including page and coordinates of all 4 corners of each word's bounding box."
accepts:
- "off"
- "on"
default: "off"
- name: "output_type"
location: "body"
type: "string"
required: false
description: "Specify whether to save output as a file with .json extension or return output directly in the JSON response"
accepts:
- "json"
- "file"
default: "json"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file (when output_type is set to file), without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_extracted-text"
Responses
{
"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"
}
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
{
"error": "Uploaded file is not valid input for this route. See documentation for valid file format(s)."
}
POST /markdown
Summary
Convert PDF documents into clean, structured Markdown format, facilitating content repurposing, easy text manipulation, and LLM training.
Examples
curl -X POST "YOUR_DOMAIN_HERE/markdown" \
-H "Accept: application/json" \
-H "Content-Type: multipart/form-data" \
-F "file=@/path/to/file"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
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-last2-91,2,5-10,12-last
Default:
1-last
(all pages)Accepts:
onoff
Example:
onDefault:
offAccepts:
jsonfile
Default:
jsonAccepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_markdownendpoint: POST /markdown
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "pages"
location: "body"
type: "string"
required: false
description: "Page or range of pages to include"
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"
default:
- "1-last"
- "(all pages)"
- name: "page_break_comments"
location: "body"
type: "boolean"
required: false
description: "Applies page breaks in the Markdown as HTML comments in the format <!--Page 1-->. This can provide useful contextual information for LLMs and other machine processing, as these comments are not rendered in the final visible output. However, be aware that these comments might conceptually break up the flow of the document in the raw Markdown file."
accepts:
- "on"
- "off"
example: "on"
default: "off"
- name: "output_type"
location: "body"
type: "string"
required: false
description: "Specify whether to save output as a file with .md extension or return output directly in the JSON response"
accepts:
- "json"
- "file"
default: "json"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file (when output_type is set to file), without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_markdown"
Responses
{ "markdown": "**Some header text**\n\nSome text in a paragraph. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quasi corporis quidem enim maxime dolor porro repellat. At quidem cupiditate voluptatem sequi neque. Aliquam qui excepturi dolor, voluptate iste in veritatis!",
"inputId": "1fc278f79-e431-4ac3-afa6-e14206500769"
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
{
"error": "Uploaded file is not valid input for this route. See documentation for valid file format(s)."
}
{
"error": "The input file is password protected and cannot be processed."
}
POST /pdf-with-ocr-text
Summary
Uses Optical Character Recognition (OCR) technology to identify text within images embedded in PDFs. The detected text is then strategically placed behind the image within the PDF document.
This process results in a PDF with searchable and extractable text. Also works well as a pre-processing step before passing the PDF to the /extracted-text endpoint to extract PDF image text along with other document text.
Examples
curl -X POST "YOUR_DOMAIN_HERE/pdf-with-ocr-text" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_out"
curl -X POST "YOUR_DOMAIN_HERE/pdf-with-ocr-text" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=pdf_out"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts:
ChineseSimplifiedChineseTraditionalDutchEnglishFrenchGermanItalianJapaneseKoreanPortugueseSpanish
Example:
English,German,FrenchDefault:
EnglishAccepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_pdf-with-ocr-textendpoint: POST /pdf-with-ocr-text
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "languages"
location: "body"
type: "string"
required: false
description: "Comma-separated list specifying the languages the OCR engine should recognize within the document"
accepts:
- "ChineseSimplified"
- "ChineseTraditional"
- "Dutch"
- "English"
- "French"
- "German"
- "Italian"
- "Japanese"
- "Korean"
- "Portuguese"
- "Spanish"
example: "English,German,French"
default: "English"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_pdf-with-ocr-text"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
{
"error": "This route will only accept a File or an ID, not both."
}
{
"error": "The input file is password protected and cannot be processed."
}
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)
- Email (.eml)
- JPEG (.jpg, .jpeg)
- TIF (.tif, .tiff)
- BMP (.bmp)
- PNG (.png)
- HTML (.html)
- HTML (from URL)
Examples
curl -X POST "YOUR_DOMAIN_HERE/pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.jpg" -F "output=example_out"
curl -X POST "YOUR_DOMAIN_HERE/pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/index.html" -F "output=pdf_out" -F "compression=lossless" -F "downsample=600" -F "page_size=A5" -F "page_margin=15mm" -F "page_orientation=landscape" -F "web_layout=mobile"
curl -X POST "YOUR_DOMAIN_HERE/pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=pdf_out" -F "tagged_pdf=on"
Required Headers
Body Parameters
Accepts: Any file of supported type
Example:
@PATH_TO_FILE/example_file.htmlDefault:
NoneRequirement: One of:
fileidurl
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileidurl
Accepts: Any valid URL
Example:
https://en.wikipedia.org/wiki/DatalogicsDefault:
NoneRequirement: One of:
fileidurl
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_pdfAccepts:
lossylossless
Default:
lossyAccepts:
off751503006001200
Default:
300Accepts:
onoff
Default:
offAccepts:
US- applies en_USGermany- applies de_DE
Example:
GermanyDefault:
USAccepts:
letterlegalledgerA3A4A5
Default:
letterAccepts: A number followed by either 'in' or 'mm'
Example:
8mm2.5in10.25mm0in
Default:
1inAccepts:
portraitlandscape
Default:
portraitAccepts:
desktoptabletmobile
Default:
desktopendpoint: POST /pdf
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any file of supported type"
example: "@PATH_TO_FILE/example_file.html"
default: "None"
requirement:
- "file"
- "id"
- "url"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- "url"
- name: "url"
location: "body"
type: "url"
required: conditional
description: "URL of web page to process"
accepts: "Any valid URL"
example: "https://en.wikipedia.org/wiki/Datalogics"
default: "None"
requirement:
- "file"
- "id"
- "url"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_pdf"
- name: "compression"
location: "body"
type: "string"
required: false
description: "Image compression for PostScript, Microsoft Office, HTML conversion"
accepts:
- "lossy"
- "lossless"
default: "lossy"
- name: "downsample"
location: "body"
type: "string"
required: false
description: "Downsample images during PostScript, Microsoft Office, HTML conversion or preserve original resolutions with the 'off' option"
accepts:
- "off"
- "75"
- "150"
- "300"
- "600"
- "1200"
default: "300"
- name: "tagged_pdf"
location: "body"
type: "boolean"
required: false
description: "Microsoft Office file conversion only: Create a tagged PDF document, required for accessibility compliance"
accepts:
- "on"
- "off"
default: "off"
- name: "locale"
location: "body"
type: "string"
required: false
description: "Microsoft Excel 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"
default: "US"
- name: "page_size"
location: "body"
type: "string"
required: false
description: "HTML conversion only: Select a page size for the PDF file. Options correspond to standard paper sizes"
accepts:
- "letter"
- "legal"
- "ledger"
- "A3"
- "A4"
- "A5"
default: "letter"
- name: "page_margin"
location: "body"
type: "string"
required: false
description: "HTML 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"
default: "1in"
- name: "page_orientation"
location: "body"
type: "string"
required: false
description: "HTML conversion only: Set the page orientation"
accepts:
- "portrait"
- "landscape"
default: "portrait"
- name: "web_layout"
location: "body"
type: "string"
required: false
description: "HTML conversion only: For web pages with responsive design, select the intended web layout"
accepts:
- "desktop"
- "tablet"
- "mobile"
default: "desktop"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
{
"error": "0 is not within the acceptable range for downsample."
}
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
curl -X POST "YOUR_DOMAIN_HERE/pdfa" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_out" -F "output_type=PDF/A-2u"
curl -X POST "YOUR_DOMAIN_HERE/pdfa" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=file_out" -F "output_type=PDF/A-2u" -F "rasterize_if_errors_encountered=on"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts:
PDF/A-1bPDF/A-2bPDF/A-2uPDF/A-3bPDF/A-3u
Default:
NoneAccepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_pdfaAccepts:
onoff
Default:
offendpoint: POST /pdfa
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "output_type"
location: "body"
type: "string"
required: true
description: "Desired PDF/A version for the output PDF"
accepts:
- "PDF/A-1b"
- "PDF/A-2b"
- "PDF/A-2u"
- "PDF/A-3b"
- "PDF/A-3u"
default: "None"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_pdfa"
- name: "rasterize_if_errors_encountered"
location: "body"
type: "boolean"
required: false
description: "When 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"
default: "off"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
{
"error": "PDF/A-2x is not within the acceptable range for output_type."
}
{
"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-1aPDF/X-3PDF/X-4PDF/X-6
Examples
curl -X POST "YOUR_DOMAIN_HERE/pdfx" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_out" -F "output_type=PDF/X-4"
curl -X POST "YOUR_DOMAIN_HERE/pdfx" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=file_out" -F "output_type=PDF/X-1a"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts:
PDF/X-1aPDF/X-3PDF/X-4PDF/X-6
Default:
NoneAccepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_pdfxendpoint: POST /pdfx
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "output_type"
location: "body"
type: "string"
required: true
description: "Desired PDF/X version for the output PDF"
accepts:
- "PDF/X-1a"
- "PDF/X-3"
- "PDF/X-4"
- "PDF/X-6"
default: "None"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_pdfx"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
{
"error": "PDF/X-5 is not within the acceptable range for output_type."
}
{
"error": "The input file is password protected and cannot be processed."
}
POST /word
Summary
Converts a PDF to a Microsoft Word document
Examples
curl -X POST "YOUR_DOMAIN_HERE/word" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@/path/to/file"
curl -X POST "YOUR_DOMAIN_HERE/word" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=example_output"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_wordendpoint: POST /word
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_word"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
{
"error": "This route will only accept a File or an ID, not both."
}
POST /excel
Summary
Converts a PDF to a Microsoft Excel document
Examples
curl -X POST "YOUR_DOMAIN_HERE/excel" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@/path/to/file"
curl -X POST "YOUR_DOMAIN_HERE/excel" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=example_output"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_excelendpoint: POST /excel
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_excel"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
{
"error": "This route will only accept a File or an ID, not both."
}
POST /powerpoint
Summary
Converts a PDF to a Microsoft PowerPoint document
Examples
curl -X POST "YOUR_DOMAIN_HERE/powerpoint" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@/path/to/file"
curl -X POST "YOUR_DOMAIN_HERE/powerpoint" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=example_output"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_powerpointendpoint: POST /powerpoint
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_powerpoint"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
{
"error": "This route will only accept a File or an ID, not both."
}
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
# Example of using a preset compression_level
curl -X POST "YOUR_DOMAIN_HERE/compressed-pdf" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_output" -F "compression_level=high"
# Example of a using a custom json profile with compression_level
curl -X POST "YOUR_DOMAIN_HERE/compressed-pdf" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_output" -F "compression_level=custom" -F "profile=@PATH_TO_FILE/example_profile.json"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts:
lowmediumhighcustom
Default:
NoneAccepts: Any valid JSON profile
Example:
@PATH_TO_FILE/example_profile.jsonDefault:
NoneRequirement: When compression_level is set to custom, one of:
profileprofile_id
Accepts: Any valid resource ID returned by a POST request
Example:
138aadb71-ee34-4621-9098-9686441e84e2Default:
NoneRequirement: When compression_level is set to custom, one of:
profileprofile_id
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_compressed-pdfendpoint: POST /compressed-pdf
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "compression_level"
location: "body"
type: "string"
required: true
description: "Degree of compression with a tradeoff between preserving fidelity (low) and maximizing file size reduction (high)"
accepts:
- "low"
- "medium"
- "high"
- "custom"
default: "None"
- name: "profile"
location: "body"
type: "uuid"
required: conditional
description: "JSON profile to be uploaded with specifications for configurable compression settings"
accepts: "Any valid JSON profile"
example: "@PATH_TO_FILE/example_profile.json"
default: "None"
requirement:
- "When compression_level is set to custom, one of:"
- "profile"
- "profile_id"
- name: "profile_id"
location: "body"
type: "uuid"
required: conditional
description: "Submit a resource ID for JSON profile to be uploaded with specifications for configurable compression settings"
accepts: "Any valid resource ID returned by a POST request"
example: "138aadb71-ee34-4621-9098-9686441e84e2"
default: "None"
requirement:
- "When compression_level is set to custom, one of:"
- "profile"
- "profile_id"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_compressed-pdf"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
{
"error": "This route will only accept a File or an ID, not both."
}
{
"error": "The input file is password protected and cannot be processed."
}
{
"error": "The 'profile' file provided is not a JSON file, please see documentation for sample profile."
}
POST /signed-pdf
Summary
Digitally sign PDF documents programmatically, ensuring authenticity and integrity. This tool allows for the application of digital signatures with various configurations, including visual representations.
Examples
SIGNATURE_CONFIG='{"type": "new","name": "esignature","logo_opacity": "0.25","location": {"bottom_left": { "x": "0", "y": "0" },"top_right": { "x": "216", "y": "72" },"page": 1},"display": {"include_distinguished_name": "true","include_datetime": "true","contact": "My contact info","location": "My location","name": "John Doe","reason": "My reason for signing"}}'
curl -X POST "YOUR_DOMAIN_HERE/signed-pdf" \
-H "Accept: application/json" \
-H "Content-Type: multipart/form-data" \
-F "file=@/path/to/file" \
-F "pfx_credential_file=@/path/to/file" \
-F "pfx_passphrase_file=@/path/to/file" \
-F "logo_file=@/path/to/file" \
-F "signature_configuration=$SIGNATURE_CONFIG" \
-F "output=example_out"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: A JSON object with the following properties:
- type (string, required): Type of signature, e.g., "new".
- name (string, optional): Name of the signature, e.g., "esignature".
- logo_opacity (number, optional): Opacity of the signature logo (0.0 to 1.0).
- location (object, optional): Defines the signature's bounding box and page, including
bottom_left(x,y),top_right(x,y), andpage. - display (object, optional): Defines what information to display in the signature, including
include_distinguished_name,include_datetime,contact,location,name, andreason.
Example:
{"type": "new", "name": "esignature", "logo_opacity": "0.5", "location": {"bottom_left": {"x": "0", "y": "0"}, "top_right": {"x": "216", "y": "72"}, "page": "1"}, "display": {"include_distinguished_name": "true", "include_datetime": "true", "contact": "My contact information", "location": "My signing location", "name": "John Doe", "reason": "My reason for signing"}}Default:
NoneAccepts: A PKCS#12 (.pfx or .p12) file
Example:
@PATH_TO_FILE/credentials.pfxDefault:
NoneRequirement: One of:
pfx_credential_filepfx_credential_id(if using PFX credentials)
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
pfx_credential_filepfx_credential_id(if using PFX credentials)
Accepts: A text file containing the passphrase
Example:
@PATH_TO_FILE/passphrase.txtDefault:
NoneRequirement: One of:
pfx_passphrase_filepfx_passphrase_id(if using PFX credentials)
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
pfx_passphrase_filepfx_passphrase_id(if using PFX credentials)
Accepts: A .der or .pem certificate file
Example:
@PATH_TO_FILE/certificate.pemDefault:
NoneRequirement: One of:
certificate_filecertificate_id(if using non-PFX credentials)
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
certificate_filecertificate_id(if using non-PFX credentials)
Accepts: A .der or .pem private key file
Example:
@PATH_TO_FILE/private_key.pemDefault:
NoneRequirement: One of:
private_key_fileprivate_key_id(if using non-PFX credentials)
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
private_key_fileprivate_key_id(if using non-PFX credentials)
Accepts: Any JPG, PNG, TIFF, or BMP image file
Example:
@PATH_TO_FILE/logo.pngDefault:
NoneRequirement: One of:
logo_filelogo_id(Optional)
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
logo_filelogo_id(Optional)
Accepts: Any valid file name
Example:
example_signed_docDefault:
[INPUT_FILE_NAME]_pdfrest_signed_pdfendpoint: POST /signed-pdf
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "signature_configuration"
location: "body"
type: "string"
required: true
description: "JSON string defining the signature properties, including type, name, logo opacity, location, and display settings."
accepts:
- "A JSON object with the following properties:"
- "type (string, required): Type of signature, e.g., \"new\"."
- "name (string, optional): Name of the signature, e.g., \"esignature\"."
- "logo_opacity (number, optional): Opacity of the signature logo (0.0 to 1.0)."
- "location (object, optional): Defines the signature's bounding box and page, including `bottom_left` (`x`, `y`), `top_right` (`x`, `y`), and `page`."
- "display (object, optional): Defines what information to display in the signature, including `include_distinguished_name`, `include_datetime`, `contact`, `location`, `name`, and `reason`."
schema:
type: "object"
properties:
type:
type: "string"
required: true
description: "Type of signature, e.g., \"new\"."
name:
type: "string"
required: false
description: "Name of the signature, e.g., \"esignature\"."
logo_opacity:
type: "number"
required: false
description: "Opacity of the signature logo (0.0 to 1.0)."
location:
type: "object"
required: false
description: "Defines the signature bounding box and page."
properties:
bottom_left:
type: "object"
required: true
properties:
x:
type: "string"
required: true
y:
type: "string"
required: true
top_right:
type: "object"
required: true
properties:
x:
type: "string"
required: true
y:
type: "string"
required: true
page:
type: "string"
required: true
display:
type: "object"
required: false
description: "Defines what information to display in the signature."
properties:
include_distinguished_name:
type: "string"
required: false
accepts:
- "true"
- "false"
include_datetime:
type: "string"
required: false
accepts:
- "true"
- "false"
contact:
type: "string"
required: false
location:
type: "string"
required: false
name:
type: "string"
required: false
reason:
type: "string"
required: false
example: "{\"type\": \"new\", \"name\": \"esignature\", \"logo_opacity\": \"0.5\", \"location\": {\"bottom_left\": {\"x\": \"0\", \"y\": \"0\"}, \"top_right\": {\"x\": \"216\", \"y\": \"72\"}, \"page\": \"1\"}, \"display\": {\"include_distinguished_name\": \"true\", \"include_datetime\": \"true\", \"contact\": \"My contact information\", \"location\": \"My signing location\", \"name\": \"John Doe\", \"reason\": \"My reason for signing\"}}"
default: "None"
- name: "pfx_credential_file"
location: "body"
type: "file"
required: conditional
description: "A .pfx or .p12 formatted file containing the digital certificate and private key for PFX credentials."
accepts: "A PKCS#12 (.pfx or .p12) file"
example: "@PATH_TO_FILE/credentials.pfx"
default: "None"
requirement:
- "pfx_credential_file"
- "pfx_credential_id"
- "(if using PFX credentials)"
- name: "pfx_credential_id"
location: "body"
type: "uuid"
required: conditional
description: "Resource ID of a .pfx or .p12 formatted file containing the digital certificate and private key for PFX credentials."
accepts: "Any valid resource ID returned by a POST request"
example: "0950b9bdf-0465-4d3f-8ea3-d2894f1ae839"
default: "None"
requirement:
- "pfx_credential_file"
- "pfx_credential_id"
- "(if using PFX credentials)"
- name: "pfx_passphrase_file"
location: "body"
type: "file"
required: conditional
description: "A .txt file with a passphrase for the PFX credential file."
accepts: "A text file containing the passphrase"
example: "@PATH_TO_FILE/passphrase.txt"
default: "None"
requirement:
- "pfx_passphrase_file"
- "pfx_passphrase_id"
- "(if using PFX credentials)"
- name: "pfx_passphrase_id"
location: "body"
type: "uuid"
required: conditional
description: "Resource ID of a .txt file with a passphrase for the PFX credential file."
accepts: "Any valid resource ID returned by a POST request"
example: "0950b9bdf-0465-4d3f-8ea3-d2894f1ae839"
default: "None"
requirement:
- "pfx_passphrase_file"
- "pfx_passphrase_id"
- "(if using PFX credentials)"
- name: "certificate_file"
location: "body"
type: "file"
required: conditional
description: "A .der or .pem formatted certificate file for non-PFX credentials."
accepts: "A .der or .pem certificate file"
example: "@PATH_TO_FILE/certificate.pem"
default: "None"
requirement:
- "certificate_file"
- "certificate_id"
- "(if using non-PFX credentials)"
- name: "certificate_id"
location: "body"
type: "uuid"
required: conditional
description: "Resource ID of a .der or .pem formatted certificate file for non-PFX credentials."
accepts: "Any valid resource ID returned by a POST request"
example: "0950b9bdf-0465-4d3f-8ea3-d2894f1ae839"
default: "None"
requirement:
- "certificate_file"
- "certificate_id"
- "(if using non-PFX credentials)"
- name: "private_key_file"
location: "body"
type: "file"
required: conditional
description: "A .der or .pem formatted private key file for non-PFX credentials."
accepts: "A .der or .pem private key file"
example: "@PATH_TO_FILE/private_key.pem"
default: "None"
requirement:
- "private_key_file"
- "private_key_id"
- "(if using non-PFX credentials)"
- name: "private_key_id"
location: "body"
type: "uuid"
required: conditional
description: "Resource ID of a .der or .pem formatted private key file for non-PFX credentials."
accepts: "Any valid resource ID returned by a POST request"
example: "0950b9bdf-0465-4d3f-8ea3-d2894f1ae839"
default: "None"
requirement:
- "private_key_file"
- "private_key_id"
- "(if using non-PFX credentials)"
- name: "logo_file"
location: "body"
type: "file"
required: conditional
description: "An image file (JPG, PNG, TIFF, BMP) to be used as a visual logo for the signature."
accepts: "Any JPG, PNG, TIFF, or BMP image file"
example: "@PATH_TO_FILE/logo.png"
default: "None"
requirement:
- "logo_file"
- "logo_id"
- "(Optional)"
- name: "logo_id"
location: "body"
type: "uuid"
required: conditional
description: "Resource ID of an image file (JPG, PNG, TIFF, BMP) to be displayed on the signature as a logo."
accepts: "Any valid resource ID returned by a POST request"
example: "0950b9bdf-0465-4d3f-8ea3-d2894f1ae839"
default: "None"
requirement:
- "logo_file"
- "logo_id"
- "(Optional)"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_signed_doc"
default: "[INPUT_FILE_NAME]_pdfrest_signed_pdf"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/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"]
}
{
"error": "Uploaded file is not valid input for this route. See documentation for valid file format(s)."
}
{
"error": "The input file is password protected and cannot be processed."
}
POST /pdf-with-redacted-text-preview
Summary
Generates a visual preview of redactions to be applied to a PDF document, highlighting the areas to be redacted with red rectangles based on the specified JSON redaction parameters. This step is required before applying the final redactions, allowing users to review and verify the redactions for accuracy and completeness. To apply redactions, send the output from this endpoint to the /pdf-with-redacted-text-applied endpoint.
Example
REDACTIONS='{"type":"preset","value":"email"},{"type":"regex","value":"(\+\d{1,2}\s)?\(?\d{3}\)?\s.-\d{3}\s.-\d{4}"},{"type":"literal","value":"word"}'
curl -X POST "YOUR_DOMAIN_HERE/pdf-with-redacted-text-preview"
-H "Accept: application/json"
-H "Content-Type: multipart/form-data"
-F "file=@/path/to/file"
-F "redactions=$REDACTIONS"
-F "output=example_out"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Types of Redactions:
literal- The value is the exact string to search for and redact. This type is useful for removing specific names, words, or phrases.regex- The value is a regular expression used to search for pattern matches and redact them. This type is ideal for identifying and removing patterns such as sequences of numbers or specific text formats.preset- The value can be set to one of the following predefined types to automatically redact common patterns using a predefined regex:email- Email addressesphone_number- Phone numbersdate- Datesus_ssn- US Social Security numbersurl- URLscredit_card- Credit card numberscredit_debit_pin- Credit/Debit PIN numbersbank_routing_number- Bank routing numbersinternational_bank_account_number- International bank account numbersswift_bic_number- SWIFT/BIC numbersipv4- IPv4 addressesipv6- IPv6 addresses
Example:
[
{
"type": "literal",
"value": "John Doe"
},
{
"type": "regex",
"value": "(\$|USD)\s*\d{1,3}(,\d{3})*(\.\d{2})?"
},
{
"type": "preset",
"value": "credit_card"
},
{
"type": "preset",
"value": "email"
}
]Default:
NoneAccepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_pdf-with-redacted-text-previewendpoint: POST /pdf-with-redacted-text-preview
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "PDF file to be uploaded for redaction."
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric ID (UUID) of existing PDF file on server for redaction."
accepts: "Any valid resource ID returned by a POST request"
example: "0950b9bdf-0465-4d3f-8ea3-d2894f1ae839"
default: "None"
requirement:
- "file"
- "id"
- name: "redactions"
location: "body"
type: "string"
required: true
description: "Specifies the redactions to be applied to a PDF document. Each redaction entry in the array defines the type of redaction and the value to search for and redact."
accepts:
- "Types of Redactions:"
- "`literal` - The value is the exact string to search for and redact. This type is useful for removing specific names, words, or phrases."
- "`regex` - The value is a regular expression used to search for pattern matches and redact them. This type is ideal for identifying and removing patterns such as sequences of numbers or specific text formats."
- "`preset` - The value can be set to one of the following predefined types to automatically redact common patterns using a predefined regex:"
- "`email` - Email addresses"
- "`phone_number` - Phone numbers"
- "`date` - Dates"
- "`us_ssn` - US Social Security numbers"
- "`url` - URLs"
- "`credit_card` - Credit card numbers"
- "`credit_debit_pin` - Credit/Debit PIN numbers"
- "`bank_routing_number` - Bank routing numbers"
- "`international_bank_account_number` - International bank account numbers"
- "`swift_bic_number` - SWIFT/BIC numbers"
- "`ipv4` - IPv4 addresses"
- "`ipv6` - IPv6 addresses"
example:
- "["
- "{"
- "\"type\": \"literal\","
- "\"value\": \"John Doe\""
- "},"
- "{"
- "\"type\": \"regex\","
- "\"value\": \"(\\\\$|USD)\\\\s*\\\\d{1,3}(,\\\\d{3})*(\\\\.\\\\d{2})?\""
- "},"
- "{"
- "\"type\": \"preset\","
- "\"value\": \"credit_card\""
- "},"
- "{"
- "\"type\": \"preset\","
- "\"value\": \"email\""
- "}"
- "]"
default: "None"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension."
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_pdf-with-redacted-text-preview"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/2e7de20c3-0dcd-4bed-b446-3c9c0d3f8c8c?format=file"
"outputId": "2e7de20c3-0dcd-4bed-b446-3c9c0d3f8c8c"
"inputId": "1e3c7fefe-45e0-48f2-bf8d-fe506e1d7838"
}
{
"error": "This route will only accept a File or an ID, not both."
}
{
"error": "The input file was corrupted, password-protected, or not a PDF."
}
POST /pdf-with-redacted-text-applied
Summary
Finalizes the redaction process by applying the specified redactions to a PDF document. This endpoint takes the redaction preview generated by /pdf-with-redacted-text-preview and permanently removes the identified sensitive information from the document. Users can automate this step following a manual review or execute it in succession with the preview step for a fully automated redaction workflow. This ensures that all sensitive data is securely and irreversibly redacted, safeguarding against unauthorized access and ensuring compliance with data protection regulations.
Examples
curl -X POST "YOUR_DOMAIN_HERE/pdf-with-redacted-text-applied" \
-H "Accept: application/json" \
-H "Content-Type: multipart/form-data" \
-F "file=@/path/to/file" \
-F "rgb_color=255,255,255" \
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: 3 comma-separated integers from 0 to 255
Example:
255, 255, 255Default:
0, 0, 0 (black)Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_pdf-with-redacted-text-appliedendpoint: POST /pdf-with-redacted-text-applied
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "PDF file to be uploaded for redaction."
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric ID (UUID) of existing PDF file on server for redaction."
accepts: "Any valid resource ID returned by a POST request"
example: "0950b9bdf-0465-4d3f-8ea3-d2894f1ae839"
default: "None"
requirement:
- "file"
- "id"
- name: "rgb_color"
location: "body"
type: "string"
required: false
description: "Set the RGB color for the redaction blocks when they are applied."
accepts: "3 comma-separated integers from 0 to 255"
example: "255, 255, 255"
default: "0, 0, 0 (black)"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension."
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_pdf-with-redacted-text-applied"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/2e7de20c3-0dcd-4bed-b446-3c9c0d3f8c8c?format=file"
"outputId": "2e7de20c3-0dcd-4bed-b446-3c9c0d3f8c8c"
"inputId": "1e3c7fefe-45e0-48f2-bf8d-fe506e1d7838"
}
{
"error": "This route will only accept a File or an ID, not both."
}
{
"error": "The input file was corrupted, password-protected, or not a PDF."
}
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
# Example of adding a text watermark
curl -X POST "YOUR_DOMAIN_HERE/watermarked-pdf" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "watermark_text=This is a Watermark" -F "output=watermarked_output" -F "font=arialbold" -F "text_size=82" -F "text_color_rgb=20,26,215" -F "opacity=0.75" -F "x=72" -F "y=-72" -F "rotation=45"
# Example of adding an image watermark from file
curl -X POST "YOUR_DOMAIN_HERE/watermarked-pdf" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "watermark_file=@PATH_TO_FILE/output_watermarked.pdf" -F "output=watermarked_output" -F "watermark_file_scale=2.5" -F "opacity=0.5" -F "x=0" -F "y=144" -F "rotation=30"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any text string
Example:
Property of ABC CompanyDefault:
NoneRequirement: One of:
watermark_textwatermark_filewatermark_file_id
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.pdfDefault:
NoneRequirement: One of:
watermark_textwatermark_filewatermark_file_id
Accepts: Any valid resource ID returned by a POST request
Example:
1f50b5bdf-0425-7d3f-1ea3-v2894f1ae833Default:
NoneRequirement: One of:
watermark_textwatermark_filewatermark_file_id
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_watermarked-pdfAccepts: See Font List for a complete list
Example:
CourierStdDefault:
ArialAccepts: 5-100
Example:
20Default:
72Accepts: Each value must be between 0 and 255
Example:
255,0,0Default:
0,0,0Accepts: Each value must be between 0 and 100
Example:
100,0,0,0Default:
NoneAccepts: Any non-negative number
Example:
2.25Default:
0.5Accepts: Any decimal value from 0 to 1, where 0 is fully transparent and 1 is fully opaque
Example:
0.75Default:
0.5Accepts: Any integer value
Example:
-72Default:
0 (horizontal center of page)Accepts: Any integer value
Example:
150Default:
0 (vertical center of page)Accepts: Any integer value
Example:
45Default:
0Accepts: 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-last2-91,2,5-10,12-last
Default:
1-last
(all pages)Accepts:
truefalse
Default:
falseendpoint: POST /watermarked-pdf
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "PDF file to be uploaded and watermarked"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "watermark_text"
location: "body"
type: "string"
required: conditional
description: "The text to apply to the input document as a watermark"
accepts: "Any text string"
example: "Property of ABC Company"
default: "None"
requirement:
- "watermark_text"
- "watermark_file"
- "watermark_file_id"
- name: "watermark_file"
location: "body"
type: "file"
required: conditional
description: "PDF 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"
default: "None"
requirement:
- "watermark_text"
- "watermark_file"
- "watermark_file_id"
- name: "watermark_file_id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "watermark_text"
- "watermark_file"
- "watermark_file_id"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_watermarked-pdf"
- name: "font"
location: "body"
type: "string"
required: false
description: "Font to use for a text watermark"
accepts: "See [Font List](https://pdfrest.com/documentation/fontlist) for a complete list"
example: "CourierStd"
default: "Arial"
- name: "text_size"
location: "body"
type: "integer"
required: false
description: "Size of text for a text watermark"
accepts: "5-100"
example: "20"
default: "72"
- name: "text_color_rgb"
location: "body"
type: "string"
required: false
description: "Comma separated Red, Green, Blue values for a text watermark"
accepts: "Each value must be between 0 and 255"
example: "255,0,0"
default: "0,0,0"
- name: "text_color_cmyk"
location: "body"
type: "string"
required: false
description: "Comma separated Cyan, Magenta, Yellow, Key (Black) values for a text watermark"
accepts: "Each value must be between 0 and 100"
example: "100,0,0,0"
default: "None"
- name: "watermark_file_scale"
location: "body"
type: "number"
required: false
description: "Scale applied to resize the content of a pdf watermark file"
accepts: "Any non-negative number"
example: "2.25"
default: "0.5"
- name: "opacity"
location: "body"
type: "number"
required: false
description: "Opacity 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"
default: "0.5"
- name: "x"
location: "body"
type: "integer"
required: false
description: "Horizontal 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"
default: "0 (horizontal center of page)"
- name: "y"
location: "body"
type: "integer"
required: false
description: "Vertical 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"
default: "0 (vertical center of page)"
- name: "rotation"
location: "body"
type: "number"
required: false
description: "Rotation in degrees to be applied to both text and file watermarks"
accepts: "Any integer value"
example: "45"
default: "0"
- name: "pages"
location: "body"
type: "string"
required: false
description: "Page or range of pages on which to apply watermark"
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"
default:
- "1-last"
- "(all pages)"
- name: "behind_page"
location: "body"
type: "string"
required: false
description: "When true, places watermark behind all page content instead of on top of all page content."
accepts:
- "true"
- "false"
default: "false"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/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"]
}
{
"error": "The requested font was not found. Please see the documentation for a list of accepted fonts."
}
{
"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
curl -X POST "YOUR_DOMAIN_HERE/encrypted-pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_out" -F "new_open_password=password"
curl -X POST "YOUR_DOMAIN_HERE/encrypted-pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=encrypted_out" -F "current_open_password=oldpassword" -F "new_open_password=newpassword"
curl -X POST "YOUR_DOMAIN_HERE/encrypted-pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=example_out" -F "new_open_password=openpassword" -F "current_permissions_password=permspassword"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: A string between 6 and 128 characters long
Example:
1234567890qwertyuiopDefault:
NoneAccepts: A valid password
Example:
OpenUpDefault:
NoneAccepts: A valid password
Example:
oahfoufdo99Default:
NoneAccepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_encrypted-pdfendpoint: POST /encrypted-pdf
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "new_open_password"
location: "body"
type: "string"
required: true
description: "New open password"
accepts: "A string between 6 and 128 characters long"
example: "1234567890qwertyuiop"
default: "None"
- name: "current_open_password"
location: "body"
type: "string"
required: false
description: "Existing open password"
accepts: "A valid password"
example: "OpenUp"
default: "None"
- name: "current_permissions_password"
location: "body"
type: "string"
required: false
description: "Existing permissions password"
accepts: "A valid password"
example: "oahfoufdo99"
default: "None"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_encrypted-pdf"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
{
"error": "The given new password is too short."
}
{
"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
curl -X POST "YOUR_DOMAIN_HERE/decrypted-pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_out" -F "current_open_password=password"
curl -X POST "YOUR_DOMAIN_HERE/decrypted-pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=example_out" -F "current_open_password=openpassword" -F "current_permissions_password=permspassword"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: A valid password
Example:
OpenUpDefault:
NoneAccepts: A valid password
Example:
oahfoufdo99Default:
NoneAccepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_decrypted-pdfendpoint: POST /decrypted-pdf
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "current_open_password"
location: "body"
type: "string"
required: true
description: "Existing open password"
accepts: "A valid password"
example: "OpenUp"
default: "None"
- name: "current_permissions_password"
location: "body"
type: "string"
required: false
description: "Existing permissions password"
accepts: "A valid password"
example: "oahfoufdo99"
default: "None"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_decrypted-pdf"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
{
"error": "A password is required to process the document."
}
{
"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
curl -X POST "YOUR_DOMAIN_HERE/restricted-pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_out" -F "new_permissions_password=password"
curl -X POST "YOUR_DOMAIN_HERE/restricted-pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=restricted_out" -F "new_permissions_password=password" -F "restrictions[]=print_low" -F "restrictions[]=edit_content"
curl -X POST "YOUR_DOMAIN_HERE/restricted-pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=example_out" -F "new_permissions_password=mypermspassword" -F "current_open_password=myopenpassword" -F "restrictions[]=accessibility_off"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: A string between 6 and 128 characters long
Example:
igy4e5ds7g87646fYFtfTFdh78g6DRDefault:
NoneAccepts: A valid password
Example:
passwordpassword123Default:
NoneAccepts:
print_lowprint_highedit_document_assemblyedit_fill_and_sign_form_fieldsedit_annotationsedit_contentcopy_contentaccessibility_off
Example:
edit_contentDefault:
NoneAccepts: A valid password
Example:
openfilepleaseDefault:
NoneAccepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_restricted-pdfendpoint: POST /restricted-pdf
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "new_permissions_password"
location: "body"
type: "string"
required: true
description: "New permissions password"
accepts: "A string between 6 and 128 characters long"
example: "igy4e5ds7g87646fYFtfTFdh78g6DR"
default: "None"
- name: "current_permissions_password"
location: "body"
type: "string"
required: false
description: "Existing permissions password"
accepts: "A valid password"
example: "passwordpassword123"
default: "None"
- name: "restrictions[]"
location: "body"
type: "array"
required: false
description: "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"
default: "None"
- name: "current_open_password"
location: "body"
type: "string"
required: false
description: "Existing open password"
accepts: "A valid password"
example: "openfileplease"
default: "None"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_restricted-pdf"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
{
"error": "This route will only accept a File or an ID, not both."
}
{
"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
curl -X POST "YOUR_DOMAIN_HERE/unrestricted-pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_out" -F "current_permissions_password=password"
curl -X POST "YOUR_DOMAIN_HERE/unrestricted-pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=example_out" -F "current_permissions_password=password"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: A valid password
Example:
kugdi9785gudw242FGdfdhDefault:
NoneAccepts: A valid password
Example:
thisIsThePasswordDefault:
NoneAccepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_unrestricted-pdfendpoint: POST /unrestricted-pdf
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "current_permissions_password"
location: "body"
type: "string"
required: true
description: "Existing permissions password"
accepts: "A valid password"
example: "kugdi9785gudw242FGdfdh"
default: "None"
- name: "current_open_password"
location: "body"
type: "string"
required: false
description: "Existing open password"
accepts: "A valid password"
example: "thisIsThePassword"
default: "None"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_unrestricted-pdf"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
{
"error": "This route will only accept a File or an ID, not both."
}
{
"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
curl -X POST "YOUR_DOMAIN_HERE/merged-pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file1.pdf" -F "pages[]=1-7" -F "type[]=file" -F "file=@PATH_TO_FILE/example_file.pdf2" -F "pages[]=2-last" -F "type[]=file" -F "file=@PATH_TO_FILE/example_file3.pdf" -F "pages[]=2,4,6,8" -F "type[]=file" -F "output=example_out"
curl -X POST "YOUR_DOMAIN_HERE/merged-pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "id[]=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "pages[]=1,5-8" -F "type[]=id" -F "id[]=0kd720sdh-3756-s92j-lg0s-0z9m31js68c9" -F "pages[]=last-1" -F "type[]=id" -F "output=file_out"
curl -X POST "YOUR_DOMAIN_HERE/merged-pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file1.pdf" -F "pages[]=1-7" -F "type[]=file" -F "id[]=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "pages[]=1,5-8" -F "type[]=id" -F "id[]=0kd720sdh-3756-s92j-lg0s-0z9m31js68c9" -F "pages[]=last-1" -F "type[]=id" "file=@PATH_TO_FILE/example_file.pdf2" -F "pages[]=2-last" -F "type[]=file" -F "output=file_out"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One or more of:
fileid[]
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One or more of:
fileid[]
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-last9-21,2,5-10,12-lastevenodd
Default:
NoneAccepts:
fileid
Default:
NoneAccepts: Any valid file name
Example:
example_outDefault:
pdfrest_merged-pdfendpoint: POST /merged-pdf
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File 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"
default: "None"
requirement:
- "One or more of:"
- "file"
- "id[]"
- name: "id[]"
location: "body"
type: "uuid[]"
required: conditional
description: "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"
default: "None"
requirement:
- "One or more of:"
- "file"
- "id[]"
- name: "pages[]"
location: "body"
type: "array"
required: true
description: "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"
default: "None"
- name: "type[]"
location: "body"
type: "array"
required: true
description: "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"
default: "None"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "pdfrest_merged-pdf"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/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"]
}
{
"error": "Too many 'file' or 'id' values."
}
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
curl -X POST "YOUR_DOMAIN_HERE/split-pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf"
curl -X POST "YOUR_DOMAIN_HERE/split-pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "pages[]=3-last" -F "pages[]=2,4,6,9" -F "output=file_out"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
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-last2-91,2,10-5,12-lastevenodd
Default:
NoneAccepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_split-pdfendpoint: POST /split-pdf
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and split into new files."
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "pages[]"
location: "body"
type: "array"
required: false
description: "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"
default: "None"
- name: "output"
location: "body"
type: "string"
required: false
description: "Prefix 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"
default: "[INPUT_FILE_NAME]_pdfrest_split-pdf"
Responses
{
"outputUrl": ["YOUR_DOMAIN_HERE/resource/255b5217c-a7cd-447b-99b3-0cadc9dc3831?format=file", "YOUR_DOMAIN_HERE/resource/203090407-cb1e-4c68-b7e1-c5b21211c0cd?format=file", "YOUR_DOMAIN_HERE/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"
}
{
"error": "This route will only accept a File or an ID, not both."
}
POST /blank-pdf
Summary
Creates a new, blank PDF document with precisely defined page size, page count, and orientation. This tool is the foundational first step for programmatic PDF generation.
Examples
curl -X POST "YOUR_DOMAIN_HERE/blank-pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "page_size=letter" -F "page_count=5" -F "page_orientation=portrait" -F "output=new_document"
curl -X POST "YOUR_DOMAIN_HERE/blank-pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "page_size=custom" -F "custom_height=792" -F "custom_width=612" -F "page_count=12"
Required Headers
Body Parameters
Accepts: Choose from: letter, legal, ledger, A3, A4, A5, custom
Example:
letterDefault:
NoneAccepts: Integer between 1 and 1000
Example:
5Default:
NoneAccepts: Choose from: portrait, landscape
Example:
landscapeDefault:
NoneAccepts: Any positive number
Example:
792Default:
NoneAccepts: Any positive number
Example:
612Default:
NoneAccepts: Any valid file name
Example:
new_custom_documentDefault:
pdfrest_blank-pdfendpoint: POST /blank-pdf
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "page_size"
location: "body"
type: "string"
required: true
description: "Standard or custom size for the pages in the new document."
accepts: "Choose from: letter, legal, ledger, A3, A4, A5, custom"
example: "letter"
default: "None"
- name: "page_count"
location: "body"
type: "integer"
required: true
description: "Number of pages within the output document (max: 1000)."
accepts: "Integer between 1 and 1000"
example: "5"
default: "None"
- name: "page_orientation"
location: "body"
type: "string"
required: false
description: "Page orientation for standard sizes. Required only if page_size is not custom."
accepts: "Choose from: portrait, landscape"
example: "landscape"
default: "None"
- name: "custom_height"
location: "body"
type: "number"
required: false
description: "Document page height in PDF units (72 PDF units = 1 inch). Required only if page_size is custom."
accepts: "Any positive number"
example: "792"
default: "None"
- name: "custom_width"
location: "body"
type: "number"
required: false
description: "Document page width in PDF units (72 PDF units = 1 inch). Required only if page_size is custom."
accepts: "Any positive number"
example: "612"
default: "None"
- name: "output"
location: "body"
type: "string"
required: false
description: "Output name of the new file, without extension."
accepts: "Any valid file name"
example: "new_custom_document"
default: "pdfrest_blank-pdf"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/2e7de20c3-0dcd-4bed-b446-3c9c0d3f8c8c?format=file"
"outputId": "2e7de20c3-0dcd-4bed-b446-3c9c0d3f8c8c"
"inputId": "1e3c7fefe-45e0-48f2-bf8d-fe506e1d7838"
}
{
"error": "Missing custom_height and/or custom_width for custom page size."
}
{
"error": "The provided key is not valid."
}
POST /pdf-with-added-text
Summary
Inserts text blocks into a PDF at specified locations with custom settings for font and styling. 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 text.
Examples
TEXT_OPTIONS='[{"font":"Times New Roman","max_width":"175","opacity":"1","page":"1","rotation":"0","text":"sample text in PDF","text_color_rgb":"0,0,0","text_size":"30","x":"72","y":"144"}]'
curl -X POST "YOUR_DOMAIN_HERE/pdf-with-added-text" \
-H "Accept: application/json" \
-H "Content-Type: multipart/form-data" \
-F "file=@/path/to/file" \
-F "text_objects=$TEXT_OPTIONS" \
-F "output=example_out"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts:
font- String | Required | Specify the font of the given string. See Font List for a complete list.max_width- String | Required | The maximum width of the text column in PDF Units (72 PDF Units = 1 inch). The text will wrap to conform to this width.opacity- String | Required | Text opacity (0.0 - 1.0)page- String | Required | Page number on which to add text. You can provide a page number, or you can use "all" to add the text to every page at the same X/Y position.rotation- String | Required | Rotation in degrees of the text blocktext- String | Required | String of text to addtext_color_cmykortext_color_rgb- String | Required | Comma-delineated string of color values (RGB example - "53,5,102", CMYK example - "0,100,100,0"). Use one of these to set the text color.text_size- String | Required | Font size of the text (5 - 100)x- String | Required | Horizontal starting position of the text in PDF Units (72 PDF Units = 1 inch)y- String | Required | Vertical starting position of the text in PDF Units (72 PDF Units = 1 inch)is_rtl- String | Optional | Set to "true" to insert right-to-left (RTL) language text
Example:
[
{
"font":"Arial",
"max_width":"100",
"opacity":"1",
"page":"all",
"rotation":"80",
"text":"Hello, PDF world!",
"text_color_rgb":"0,0,0",
"text_size":"12",
"x":"144",
"y":"144"
},
{
"font":"Times New Roman",
"max_width":"100",
"opacity":"1",
"page":"all",
"rotation":"0",
"text":"שלום עולם",
"text_color_rgb":"128,0,2",
"text_size":"72",
"x":"144",
"y":"720",
"is_rtl":"true"
}
]Default:
NoneAccepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_pdf-with-added-textendpoint: POST /pdf-with-added-text
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "PDF file to be uploaded for text to be added."
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric ID (UUID) of existing PDF file on server for text to be added."
accepts: "Any valid resource ID returned by a POST request"
example: "0950b9bdf-0465-4d3f-8ea3-d2894f1ae839"
default: "None"
requirement:
- "file"
- "id"
- name: "text_objects"
location: "body"
type: "string"
required: true
description: "JSON-formatted string consisting of an array of one or more objects containing options to add and format text."
accepts:
- "`font` - String | Required | Specify the font of the given string. See [Font List](https://pdfrest.com/documentation/fontlist/) for a complete list."
- "`max_width` - String | Required | The maximum width of the text column in PDF Units (72 PDF Units = 1 inch). The text will wrap to conform to this width."
- "`opacity` - String | Required | Text opacity (0.0 - 1.0)"
- "`page` - String | Required | Page number on which to add text. You can provide a page number, or you can use \"all\" to add the text to every page at the same X/Y position."
- "`rotation` - String | Required | Rotation in degrees of the text block"
- "`text` - String | Required | String of text to add"
- "`text_color_cmyk` or `text_color_rgb` - String | Required | Comma-delineated string of color values (RGB example - \"53,5,102\", CMYK example - \"0,100,100,0\"). Use one of these to set the text color."
- "`text_size` - String | Required | Font size of the text (5 - 100)"
- "`x` - String | Required | Horizontal starting position of the text in PDF Units (72 PDF Units = 1 inch)"
- "`y` - String | Required | Vertical starting position of the text in PDF Units (72 PDF Units = 1 inch)"
- "`is_rtl` - String | Optional | Set to \"true\" to insert right-to-left (RTL) language text"
example:
- "["
- "{"
- "\"font\":\"Arial\","
- "\"max_width\":\"100\","
- "\"opacity\":\"1\","
- "\"page\":\"all\","
- "\"rotation\":\"80\","
- "\"text\":\"Hello, PDF world!\","
- "\"text_color_rgb\":\"0,0,0\","
- "\"text_size\":\"12\","
- "\"x\":\"144\","
- "\"y\":\"144\""
- "},"
- "{"
- "\"font\":\"Times New Roman\","
- "\"max_width\":\"100\","
- "\"opacity\":\"1\","
- "\"page\":\"all\","
- "\"rotation\":\"0\","
- "\"text\":\"שלום עולם\","
- "\"text_color_rgb\":\"128,0,2\","
- "\"text_size\":\"72\","
- "\"x\":\"144\","
- "\"y\":\"720\","
- "\"is_rtl\":\"true\""
- "}"
- "]"
default: "None"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension."
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_pdf-with-added-text"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/2e7de20c3-0dcd-4bed-b446-3c9c0d3f8c8c?format=file"
"outputId": "2e7de20c3-0dcd-4bed-b446-3c9c0d3f8c8c"
"inputId": "1e3c7fefe-45e0-48f2-bf8d-fe506e1d7838"
}
{
"error": "The requested font was not found. Please see the documentation for a list of accepted fonts."
}
{
"error": "The input file is password protected and cannot be processed."
}
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
curl -X POST "YOUR_DOMAIN_HERE/pdf-with-added-image" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "image_file=@PATH_TO_FILE/example_file.jpg" -F "output=example_output" -F "page=1" -F "x=72" -F "y=72"
curl -X POST "YOUR_DOMAIN_HERE/pdf-with-added-image" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "image_id=01983abb7-ef44-ffaa-01ee-0b892f14a456" -F "output=example_output" -F "page=3" -F "x=144" -F "y=36"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any image file of supported format (JPEG, TIFF, PNG, GIF).
Example:
@PATH_TO_FILE/add_this.jpgDefault:
NoneRequirement: One of:
image_fileimage_id
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
image_fileimage_id
Accepts: Any integer value
Example:
72Default:
NoneAccepts: Any integer value
Example:
144Default:
NoneAccepts: Any valid page number for the PDF file being processed
Example:
1Default:
NoneAccepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_pdf-with-added-imageendpoint: POST /pdf-with-added-image
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "PDF file to be uploaded for an image to be added."
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "image_file"
location: "body"
type: "file"
required: conditional
description: "Image 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"
default: "None"
requirement:
- "image_file"
- "image_id"
- name: "image_id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "image_file"
- "image_id"
- name: "x"
location: "body"
type: "integer"
required: true
description: "Horizontal position of the image (by its lower-left corner) in PDF units (72 PDF units = 1 inch)"
accepts: "Any integer value"
example: "72"
default: "None"
- name: "y"
location: "body"
type: "integer"
required: true
description: "Vertical position of the image (by its lower-left corner) in PDF units (72 PDF units = 1 inch)"
accepts: "Any integer value"
example: "144"
default: "None"
- name: "page"
location: "body"
type: "integer"
required: true
description: "Page of the PDF to add the image into"
accepts: "Any valid page number for the PDF file being processed"
example: "1"
default: "None"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension."
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_pdf-with-added-image"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/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"]
}
{
"error": "There was a problem reading the input image. Verify fields and try again."
}
{
"error": "The input file is password protected and cannot be processed."
}
POST /pdf-with-added-attachment
Summary
Attaches a file to a PDF document.
Examples
curl -X POST "YOUR_DOMAIN_HERE/pdf-with-added-attachment" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "file_to_attach=@PATH_TO_FILE/example_file.jpg" -F "output=example_output"
curl -X POST "YOUR_DOMAIN_HERE/pdf-with-added-attachment" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "file_to_attach=01983abb7-ef44-ffaa-01ee-0b892f14a456" -F "output=example_output"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any file that can be attached to a PDF
Example:
@PATH_TO_FILE/add_this.jpgDefault:
NoneRequirement: One of:
file_to_attachid_to_attach
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
file_to_attachid_to_attach
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_pdf-with-added-attachmentendpoint: POST /pdf-with-added-attachment
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "PDF file to be uploaded for an attachment to be added."
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "file_to_attach"
location: "body"
type: "file"
required: conditional
description: "File 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"
default: "None"
requirement:
- "file_to_attach"
- "id_to_attach"
- name: "id_to_attach"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file_to_attach"
- "id_to_attach"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension."
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_pdf-with-added-attachment"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/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"]
}
{
"error": "The input PDF file claims conformance to a version of PDF/A that prohibits file attachments."
}
POST /bmp
Summary
Convert PDF to BMP image files, one per PDF page
Examples
curl -X POST "YOUR_DOMAIN_HERE/bmp" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_out"
curl -X POST "YOUR_DOMAIN_HERE/bmp" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=bmp_out" -F "pages=2-9" -F "resolution=900" -F "color_model=gray"
curl -X POST "YOUR_DOMAIN_HERE/bmp" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=bmp_out" -F "pages=2-9" -F "resolution=900" -F "color_model=gray"
Required Headers
Body Parameters
Accepts: Any PDF File
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_bmpAccepts: 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-last2-91,2,5-10,12-last
Default:
1-last
(all pages)Accepts: 12 to 2400
Default:
300Accepts:
rgbgray
Default:
rgbendpoint: POST /bmp
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF File"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "output"
location: "body"
type: "string"
required: false
description: "Prefix 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"
default: "[INPUT_FILE_NAME]_pdfrest_bmp"
- name: "pages"
location: "body"
type: "string"
required: false
description: "Page 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"
default:
- "1-last"
- "(all pages)"
- name: "resolution"
location: "body"
type: "integer"
required: false
description: "Output image resolution in Dots Per Inch (DPI)"
accepts: "12 to 2400"
default: "300"
- name: "color_model"
location: "body"
type: "string"
required: false
description: "Color model of the output file"
accepts:
- "rgb"
- "gray"
default: "rgb"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
{
"error": "0 is not within the acceptable range for resolution."
}
{
"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
curl -X POST "YOUR_DOMAIN_HERE/jpg" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_out"
curl -X POST "YOUR_DOMAIN_HERE/jpg" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=jpg_out" -F "pages=2-9" -F "resolution=900" -F "color_model=gray" -F "jpeg_quality=100"
curl -X POST "YOUR_DOMAIN_HERE/jpg" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=example_out" -F "pages=1,3-last" -F "jpeg_quality=25" -F "color_model=cmyk"
Required Headers
Body Parameters
Accepts: Any PDF File
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_jpgAccepts: 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-last2-91,2,5-10,12-last
Default:
1-last
(all pages)Accepts: 12 to 2400
Default:
300Accepts:
rgbcmykgray
Default:
rgbAccepts: 1 to 100
Default:
75endpoint: POST /jpg
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF File"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "output"
location: "body"
type: "string"
required: false
description: "Prefix 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"
default: "[INPUT_FILE_NAME]_pdfrest_jpg"
- name: "pages"
location: "body"
type: "string"
required: false
description: "Page 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"
default:
- "1-last"
- "(all pages)"
- name: "resolution"
location: "body"
type: "integer"
required: false
description: "Output image resolution in Dots Per Inch (DPI)"
accepts: "12 to 2400"
default: "300"
- name: "color_model"
location: "body"
type: "string"
required: false
description: "Color model of the output file"
accepts:
- "rgb"
- "cmyk"
- "gray"
default: "rgb"
- name: "jpeg_quality"
location: "body"
type: "integer"
required: false
description: "JPEG compression quality. Higher values produce a higher quality image but also a larger output file size."
accepts: "1 to 100"
default: "75"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
{
"error": "0 is not within the acceptable range for resolution."
}
{
"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
curl -X POST "YOUR_DOMAIN_HERE/png" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_out"
curl -X POST "YOUR_DOMAIN_HERE/png" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=png_out" -F "pages=2-9" -F "resolution=900" -F "color_model=gray"
curl -X POST "YOUR_DOMAIN_HERE/png" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=example_out" -F "pages=2-last" -F "color_model=rgba"
Required Headers
Body Parameters
Accepts: Any PDF File
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_pngAccepts: 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-last2-91,2,5-10,12-last
Default:
1-last
(all pages)Accepts: 12 to 2400
Default:
300Accepts:
rgbrgbagray
Default:
rgbendpoint: POST /png
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF File"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "output"
location: "body"
type: "string"
required: false
description: "Prefix 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"
default: "[INPUT_FILE_NAME]_pdfrest_png"
- name: "pages"
location: "body"
type: "string"
required: false
description: "Page 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"
default:
- "1-last"
- "(all pages)"
- name: "resolution"
location: "body"
type: "integer"
required: false
description: "Output image resolution in Dots Per Inch (DPI)"
accepts: "12 to 2400"
default: "300"
- name: "color_model"
location: "body"
type: "string"
required: false
description: "Color model of the output file"
accepts:
- "rgb"
- "rgba"
- "gray"
default: "rgb"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
{
"error": "0 is not within the acceptable range for resolution."
}
{
"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
curl -X POST "YOUR_DOMAIN_HERE/gif" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_out"
curl -X POST "YOUR_DOMAIN_HERE/gif" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=gif_out" -F "pages=2-9,20" -F "resolution=1200" -F "color_model=rgb"
curl -X POST "YOUR_DOMAIN_HERE/gif" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=example_out" -F "pages=2-last" -F "color_model=gray"
Required Headers
Body Parameters
Accepts: Any PDF File
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_gifAccepts: 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-last2-91,2,5-10,12-last
Default:
1-last
(all pages)Accepts: 12 to 2400
Default:
300Accepts:
rgbgray
Default:
rgbendpoint: POST /gif
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF File"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "output"
location: "body"
type: "string"
required: false
description: "Prefix 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"
default: "[INPUT_FILE_NAME]_pdfrest_gif"
- name: "pages"
location: "body"
type: "string"
required: false
description: "Page 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"
default:
- "1-last"
- "(all pages)"
- name: "resolution"
location: "body"
type: "integer"
required: false
description: "Output image resolution in Dots Per Inch (DPI)"
accepts: "12 to 2400"
default: "300"
- name: "color_model"
location: "body"
type: "string"
required: false
description: "Color model of the output file"
accepts:
- "rgb"
- "gray"
default: "rgb"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
{
"error": "0 is not within the acceptable range for resolution."
}
{
"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
curl -X POST "YOUR_DOMAIN_HERE/tif" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_out"
curl -X POST "YOUR_DOMAIN_HERE/tif" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=tif_out" -F "pages=3,5,7" -F "resolution=2400" -F "color_model=cmyk"
curl -X POST "YOUR_DOMAIN_HERE/tif" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=example_out" -F "pages=1,9-last" -F "color_model=lab"
Required Headers
Body Parameters
Accepts: Any PDF File
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_tifAccepts: 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-last2-91,2,5-10,12-last
Default:
1-last
(all pages)Accepts: 12 to 2400
Default:
300Accepts:
rgbrgbacmyklabgray
Default:
rgbendpoint: POST /tif
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF File"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "output"
location: "body"
type: "string"
required: false
description: "Prefix 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"
default: "[INPUT_FILE_NAME]_pdfrest_tif"
- name: "pages"
location: "body"
type: "string"
required: false
description: "Page 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"
default:
- "1-last"
- "(all pages)"
- name: "resolution"
location: "body"
type: "integer"
required: false
description: "Output image resolution in Dots Per Inch (DPI)"
accepts: "12 to 2400"
default: "300"
- name: "color_model"
location: "body"
type: "string"
required: false
description: "Color model of the output file"
accepts:
- "rgb"
- "rgba"
- "cmyk"
- "lab"
- "gray"
default: "rgb"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "112f7ea0d-0e56-44bc-a3d2-42fdff96d993"
}
{
"error": "0 is not within the acceptable range for resolution."
}
{
"error": "The input file is password protected and cannot be processed."
}
POST /pdf-with-page-boxes-set
Summary
Set one or more PDF page boundary boxes, including the MediaBox (page size), CropBox (visible content area for cropping PDF and removing white space), BleedBox (extra margin for professional printing with bleed), TrimBox (final printed page dimensions), and ArtBox (boundary of the artwork or content).
Example
BOXES='{"boxes":{"box":"media","pages":{"range":"1","left":100,"top":100,"bottom":100,"right":100}}}'
curl -X POST "YOUR_DOMAIN_HERE/pdf-with-page-boxes-set"
-H "Accept: application/json"
-H "Content-Type: multipart/form-data"
-F "file=@/path/to/file"
-F "boxes=$BOXES"
-F "output=example_out.pdf"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts:
Example:
{
"boxes":
{
"box": "crop",
"pages": [
{
"range": "1-10",
"left": 72,
"top": 36,
"bottom": 36,
"right": 72
},
{
"range": "11-last",
"left": 72,
"top": 72,
"bottom": 72,
"right": 72
}
]
},
{
"box": "bleed",
"pages": [
{
"range": "1-last",
"left": 144,
"top": 144,
"bottom": 144,
"right": 144
}
]
}
}Default:
NoneAccepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_pdf-with-page-boxes-setendpoint: POST /pdf-with-page-boxes-set
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "boxes"
location: "body"
type: "string"
required: true
description: "JSON string structured to define the page boundary boxes to be set."
accepts:
- "-"
- "**boxes** - String | Required | A JSON string containing an array of box definition objects. Each object defines a specific page boundary box to modify."
- "-"
- "**boxes[].box** - String | Required | Specifies the type of page boundary box to modify. Accepted values are \"media\", \"crop\", \"bleed\", \"trim\", and \"art\"."
- "-"
- "**boxes[].pages** - String | Required | An array of page specification objects. Each object defines the page range and the corresponding margin adjustments for the specified box type."
- "-"
- "**boxes[].pages[].range** - String | Required | Specifies the page or range of pages to which the margin adjustments will be applied. Accepts a single page number (\"1\"), a page range (\"1-3\"), \"all\" to apply to every page, \"even\" for even-numbered pages, \"odd\" for odd-numbered pages, or ranges including \"last\" (e.g., \"2-last\")."
- "-"
- "**boxes[].pages[].top** - Number | Required | The top margin adjustment to apply, in positive PDF Units (72 PDF Units = 1 inch) relative to the current MediaBox. For MediaBox only, negative values can be used to increase the page size."
- "-"
- "**boxes[].pages[].bottom** - Number | Required | The bottom margin adjustment to apply, in positive PDF Units (72 PDF Units = 1 inch) relative to the current MediaBox. For MediaBox only, negative values can be used to increase the page size."
- "-"
- "**boxes[].pages[].left** - Number | Required | The left margin adjustment to apply, in positive PDF Units (72 PDF Units = 1 inch) relative to the current MediaBox. For MediaBox only, negative values can be used to increase the page size."
- "-"
- "**boxes[].pages[].right** - Number | Required | The right margin adjustment to apply, in positive PDF Units (72 PDF Units = 1 inch) relative to the current MediaBox. For MediaBox only, negative values can be used to increase the page size."
example:
- "{"
- "\"boxes\": ["
- "{"
- "\"box\": \"crop\","
- "\"pages\": ["
- "{"
- "\"range\": \"1-10\","
- "\"left\": 72,"
- "\"top\": 36,"
- "\"bottom\": 36,"
- "\"right\": 72"
- "},"
- "{"
- "\"range\": \"11-last\","
- "\"left\": 72,"
- "\"top\": 72,"
- "\"bottom\": 72,"
- "\"right\": 72"
- "}"
- "]"
- "},"
- "{"
- "\"box\": \"bleed\","
- "\"pages\": ["
- "{"
- "\"range\": \"1-last\","
- "\"left\": 144,"
- "\"top\": 144,"
- "\"bottom\": 144,"
- "\"right\": 144"
- "}"
- "]"
- "}"
- "]"
- "}"
default: "None"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_pdf-with-page-boxes-set"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
{
"error": "This route will only accept a File or an ID, not both."
}
{
"error": "The input file is password protected and cannot be processed."
}
POST /pdf-with-converted-colors
Summary
Convert PDF colors with precise document color control through custom ICC profiles and a library of print, screen, web, and grayscale presets.
Examples
curl -X POST "YOUR_DOMAIN_HERE/pdf-with-converted-colors" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=bw_out" -F "color_profile=dot-gain-10"
curl -X POST "YOUR_DOMAIN_HERE/pdf-with-converted-colors" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=cmyk_out" -F "color_profile=acrobat5-cmyk"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts:
- lab-d50 - Lab color specification with a D50 white point. The Lab color space is based on the CIE XYZ color space, but it includes a dimension L, for lightness, along with a and b coordinates, to define the color. This is Adobe Systems’ standard Lab profile.
- srgb - Standard RGB, the default profile for Windows monitors.
- apple-rgb - Apple RGB, the default profile for Mac monitors
- color-match-rgb - Color Match RGB. This is a simpler version of the Radius ColorMatch RGB space, without the non-zero black point.
- gamma-18 - Gray Gamma 1.8, grayscale display profile, used for content viewed on a monitor
- gamma-22 - Gray Gamma 2.2
- dot-gain-10 - Grayscale printer profile, with dot gain 10%. Dot gain is commonly used in offset printing to define the increase in size in halftone dots in the printing process, making a printed document look darker than intended.
- dot-gain-15 - Dot gain 15%
- dot-gain-20 - Dot gain 20%
- dot-gain-25 - Dot gain 25%
- dot-gain-30 - Dot gain 30%
- monitor-rgb - RGB Monitor, referring to a monitor that requires separate signals for the three primary colors.
- acrobat5-cmyk - Adobe Reader 5 CMYK
- acrobat9-cmyk - Adobe Reader 9 CMYK
- custom - supply a custom ICC color profile with either the profile or profile_id parameter
Example:
acrobat9-cmykDefault:
NoneAccepts: Any valid ICC color profile
Example:
@PATH_TO_FILE/example_profile.iccDefault:
NoneRequirement: When color_profile is set to custom, one of:
profileprofile_id
Accepts: Any valid resource ID returned by a POST request
Example:
138aadb71-ee34-4621-9098-9686441e84e2Default:
NoneRequirement: When color_profile is set to custom, one of:
profileprofile_id
Accepts:
falsetrue
Default:
falseAccepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_pdf-with-converted-colorsendpoint: POST /pdf-with-converted-colors
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "color_profile"
location: "body"
type: "string"
required: true
description: "Choose from any of the preset color profiles, or select custom to supply an ICC color profile"
accepts:
- "lab-d50 - L*a*b color specification with a D50 white point. The Lab color space is based on the CIE XYZ color space, but it includes a dimension L, for lightness, along with a and b coordinates, to define the color. This is Adobe Systems’ standard Lab profile."
- "srgb - Standard RGB, the default profile for Windows monitors."
- "apple-rgb - Apple RGB, the default profile for Mac monitors"
- "color-match-rgb - Color Match RGB. This is a simpler version of the Radius ColorMatch RGB space, without the non-zero black point."
- "gamma-18 - Gray Gamma 1.8, grayscale display profile, used for content viewed on a monitor"
- "gamma-22 - Gray Gamma 2.2"
- "dot-gain-10 - Grayscale printer profile, with dot gain 10%. Dot gain is commonly used in offset printing to define the increase in size in halftone dots in the printing process, making a printed document look darker than intended."
- "dot-gain-15 - Dot gain 15%"
- "dot-gain-20 - Dot gain 20%"
- "dot-gain-25 - Dot gain 25%"
- "dot-gain-30 - Dot gain 30%"
- "monitor-rgb - RGB Monitor, referring to a monitor that requires separate signals for the three primary colors."
- "acrobat5-cmyk - Adobe Reader 5 CMYK"
- "acrobat9-cmyk - Adobe Reader 9 CMYK"
- "custom - supply a custom ICC color profile with either the profile or profile_id parameter"
example: "acrobat9-cmyk"
default: "None"
- name: "profile"
location: "body"
type: "string"
required: conditional
description: "Select a local ICC color profile document to upload for processing."
accepts: "Any valid ICC color profile"
example: "@PATH_TO_FILE/example_profile.icc"
default: "None"
requirement:
- "When color_profile is set to custom, one of:"
- "profile"
- "profile_id"
- name: "profile_id"
location: "body"
type: "uuid"
required: conditional
description: "Submit a resource ID for an ICC color profile document that already exists on the processing server."
accepts: "Any valid resource ID returned by a POST request"
example: "138aadb71-ee34-4621-9098-9686441e84e2"
default: "None"
requirement:
- "When color_profile is set to custom, one of:"
- "profile"
- "profile_id"
- name: "preserve_black"
location: "body"
type: "boolean"
required: false
description: "To keep black elements consistent during color conversion, this option maintains their original definition (CMYK, RGB, or grayscale). Particularly useful for preventing RGB black text from inadvertently becoming a rich black in CMYK."
accepts:
- "false"
- "true"
default: "false"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_pdf-with-converted-colors"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
{
"error": "This route will only accept a File or an ID, not both."
}
{
"error": "The input file is password protected and cannot be processed."
}
POST /rasterized-pdf
Summary
Rasterize each page of a PDF to a flattened image, removing dependencies on fonts or other vector elements to support consistent rendering and printing. The output file is a single PDF in which all pages of the input PDF have been rasterized.
Examples
curl -X POST "YOUR_DOMAIN_HERE/rasterized-pdf" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_output"
curl -X POST "YOUR_DOMAIN_HERE/rasterized-pdf" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=example_output"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_rasterized-pdfendpoint: POST /rasterized-pdf
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_rasterized-pdf"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
{
"error": "This route will only accept a File or an ID, not both."
}
{
"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
curl -X POST "YOUR_DOMAIN_HERE/linearized-pdf" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_output"
curl -X POST "YOUR_DOMAIN_HERE/linearized-pdf" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=example_output"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_linearized-pdfendpoint: POST /linearized-pdf
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_linearized-pdf"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
{
"error": "This route will only accept a File or an ID, not both."
}
{
"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, .xmlXFA: .xdp, .xfd, .xml
Examples
curl -X POST "YOUR_DOMAIN_HERE/pdf-with-imported-form-data" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@/path/to/file" -F "output=example_out" -F "data_file=@/path/to/datafile"
Required Headers
Body Parameters
Accepts: Any PDF file containing forms with edit permissions active
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Accepted data file formats vary, depending on the form type in the input PDF:
Acroform: .fdf, .xfdf, .xmlXFA: .xdp, .xfd, .xml
Example:
@PATH_TO_FILE/example_file.xmlDefault:
NoneAccepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_pdf-with-imported-form-dataendpoint: POST /pdf-with-imported-form-data
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file containing forms with edit permissions active"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "data_file"
location: "body"
type: "file"
required: true
description: "Data 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"
default: "None"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_pdf-with-imported-form-data"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
{
"error": "A data file is required to import data into a form. Use 'data_file' to upload a file."
}
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, .xmlXFA: .xdp, .xfd, .xml
Examples
curl -X POST "YOUR_DOMAIN_HERE/exported-form-data" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@/path/to/file" -F "data_format=xml" -F "output=example_out"
Required Headers
Body Parameters
Accepts: Any PDF file containing forms
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Supported data file formats vary, depending on the form type in the input PDF:
Acroform: fdf, xfdf, xmlXFA: xdp, xfd, xml
Example:
xmlDefault:
NoneAccepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_exported-form-dataendpoint: POST /exported-form-data
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file containing forms"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "data_format"
location: "body"
type: "string"
required: true
description: "Data 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"
default: "None"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output data file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_exported-form-data"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
{
"error": "Input PDF contains XFA form fields. Valid options for data_format are: xfd, xdp, xml"
}
POST /pdf-with-acroforms
Summary
Convert XFA forms to Acroforms. This significantly improves compatibility, allowing forms to be accessed and edited across a wide range of PDF readers and applications.
Examples
curl -X POST "YOUR_DOMAIN_HERE/pdf-with-acroforms" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@/path/to/file" -F "output=example_out"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_pdf-with-acroformsendpoint: POST /pdf-with-acroforms
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_pdf-with-acroforms"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
{
"warning": "No XFA forms were detected in the input PDF. No output was produced."
}
{
"error": "This route will only accept a File or an ID, not both."
}
{
"error": "The input file was corrupted, password-protected, or not a PDF."
}
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
curl -X POST "YOUR_DOMAIN_HERE/flattened-forms-pdf" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@/path/to/file" -F "output=example_out"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_flattened-forms-pdfendpoint: POST /flattened-forms-pdf
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_flattened-forms-pdf"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
{
"error": "This route will only accept a File or an ID, not both."
}
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
curl -X POST "YOUR_DOMAIN_HERE/flattened-transparencies-pdf" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_output"
curl -X POST "YOUR_DOMAIN_HERE/flattened-transparencies-pdf" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=example_output" -F "quality=high"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_flattened-transparencies-pdflow- ideal for proofs that will be printed on black-and-white desktop printers and for documents that will be published on the webmedium- best for desktop proofs and documents that will be printed on color printershigh- ideal for final press outputs when high quality separations-based color proofs are needed
Accepts:
lowmediumhigh
Default:
mediumendpoint: POST /flattened-transparencies-pdf
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_flattened-transparencies-pdf"
- name: "quality"
location: "body"
type: "string"
required: false
description: "Set the quality to define the resolution level to use when flattening transparent objects in your PDF."
accepts:
- "low"
- "medium"
- "high"
default: "medium"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
{
"error": "This route will only accept a File or an ID, not both."
}
{
"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
curl -X POST "YOUR_DOMAIN_HERE/flattened-annotations-pdf" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_output"
curl -X POST "YOUR_DOMAIN_HERE/flattened-annotations-pdf" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=example_output"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_flattened-annotations-pdfendpoint: POST /flattened-annotations-pdf
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_flattened-annotations-pdf"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
{
"error": "This route will only accept a File or an ID, not both."
}
{
"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
curl -X POST "YOUR_DOMAIN_HERE/flattened-layers-pdf" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_output"
curl -X POST "YOUR_DOMAIN_HERE/flattened-layers-pdf" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "output=example_output"
Required Headers
Body Parameters
Accepts: Any PDF file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any valid file name
Example:
example_outDefault:
[INPUT_FILE_NAME]_pdfrest_flattened-layers-pdfendpoint: POST /flattened-layers-pdf
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and processed"
accepts: "Any PDF file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric 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"
default: "None"
requirement:
- "file"
- "id"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "[INPUT_FILE_NAME]_pdfrest_flattened-layers-pdf"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/resource/01240b25a-8936-4437-8652-8410130f1199?format=file"
"outputId": "01240b25a-8936-4437-8652-8410130f1199"
"inputId": "138aadb71-ee34-4621-9098-9686441e84e2"
}
{
"error": "This route will only accept a File or an ID, not both."
}
{
"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
curl -X POST "YOUR_DOMAIN_HERE/upload" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file1.pdf" -F "file=@PATH_TO_FILE/example_file2.png"
curl -X POST "YOUR_DOMAIN_HERE/upload" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "url=https://cms.example.com/path/to/file/input1.pdf" -F "url=https://cms.example.com/path/to/file/input2.jpg"
Required Headers
Body Parameters
Accepts: Any file of supported type
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One or more: file
- OR - One or more: url
Accepts: Any valid file accessible via public URL
Example:
https://cms.example.com/path/to/file/input.pdfDefault:
NoneRequirement: One or more: file
- OR - One or more: url
endpoint: POST /upload
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File 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"
default: "None"
requirement:
- "One or more: **file**"
- "OR -"
- "One or more: **url**"
- name: "url"
location: "body"
type: "url"
required: conditional
description: "Public 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"
default: "None"
requirement:
- "One or more: **file**"
- "OR -"
- "One or more: **url**"
Responses
{
"files": [
{
"name": "filename1.doc",
"id": "2cbf6f191-4184-4bd2-82e0-531e3e1d8ba6"
},
{
"name": "filename2.pdf",
"id": "259504d9c-38c8-41a6-82f3-3f97279c9522"
}
]
}
{
"error": "Files and URLs cannot be uploaded together."
}
POST /zip
Summary
Compress any number of files into a .zip by specifying "file" and/or "id" paramaters multiple times.
Examples
curl -X POST "YOUR_DOMAIN_HERE/zip" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "output=example_out"
curl -X POST "YOUR_DOMAIN_HERE/zip" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf" -F "file=@PATH_TO_FILE/example_file_2.pdf" "id[]=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" "output=example_out"
Required Headers
Body Parameters
Accepts: Any file of supported type
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One or more of:
fileid[]
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One or more of:
fileid[]
Accepts: Any valid file name
Example:
example_outDefault:
pdfrest_zipendpoint: POST /zip
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File 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"
default: "None"
requirement:
- "One or more of:"
- "file"
- "id[]"
- name: "id[]"
location: "body"
type: "uuid[]"
required: conditional
description: "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"
default: "None"
requirement:
- "One or more of:"
- "file"
- "id[]"
- name: "output"
location: "body"
type: "string"
required: false
description: "Name of the generated output file, without extension"
accepts: "Any valid file name"
example: "example_out"
default: "pdfrest_zip"
Responses
{
"outputUrl": "YOUR_DOMAIN_HERE/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"]
}
{
"error": "Found more than one output key, only one is allowed."
}
POST /unzip
Summary
Extract files from a compressed .zip archive, providing resource IDs for each unzipped file, which can then be processed or downloaded individually. Optionally accepts a password to support unzipping password-protected .zip archives.
Examples
curl -X POST "YOUR_DOMAIN_HERE/unzip" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@PATH_TO_FILE/example_file.pdf"
curl -X POST "YOUR_DOMAIN_HERE/unzip" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "id=0950b9bdf-0465-4d3f-8ea3-d2894f1ae839" -F "password=example-pw"
Required Headers
Body Parameters
Accepts: Any .zip file
Example:
@PATH_TO_FILE/example_file.pdfDefault:
NoneRequirement: One of:
fileid
Accepts: Any valid resource ID returned by a POST request
Example:
0950b9bdf-0465-4d3f-8ea3-d2894f1ae839Default:
NoneRequirement: One of:
fileid
Accepts: Any valid password
Example:
Password123Default:
Noneendpoint: POST /unzip
endpoint_parameters:
headers:
- name: "Accept"
location: "header"
type: "header"
required: true
value: "application/json"
- name: "Content-Type"
location: "header"
type: "header"
required: true
value: "multipart/form-data"
body:
- name: "file"
location: "body"
type: "file"
required: conditional
description: "File to be uploaded and unzipped."
accepts: "Any .zip file"
example: "@PATH_TO_FILE/example_file.pdf"
default: "None"
requirement:
- "file"
- "id"
- name: "id"
location: "body"
type: "uuid"
required: conditional
description: "Alphanumeric ID (UUID) of existing file on server to be unzipped."
accepts: "Any valid resource ID returned by a POST request"
example: "0950b9bdf-0465-4d3f-8ea3-d2894f1ae839"
default: "None"
requirement:
- "file"
- "id"
- name: "password"
location: "body"
type: "string"
required: false
description: "Optional password to unlock protected .zip archives"
accepts: "Any valid password"
example: "Password123"
default: "None"
Responses
{
"files": [
{
"name": "file1.pdf",
"id": "2211de73f-33ce-4d62-9c7f-94aa6d82270d",
"outputUrl": "YOUR_DOMAIN_HERE/2211de73f-33ce-4d62-9c7f-94aa6d82270d?format=file"
},
{
"name": "file2.ppt",
"id": "2443dv2a2-d8e7-40a3-b569-9f793f7h7a63",
"outputUrl": "YOUR_DOMAIN_HERE/resource/2443dv2a2-d8e7-40a3-b569-9f793f7h7a63?format=file"
}
],
"inputId": "11j0a6498-a510-4f93-a790-c3843678cc4c"
}
{
"error": "The provided zip may be corrupt or require a password."
}