Link Search Menu Expand Document

Upload Files

Files Storage

You can upload files as temporary files into PDF.co. Temporary files are stored for 1 hour by default and then auto removed.

To store files permanently (pdf templates, images you want to reuse) please use PDF.co built-in files storage at https://app.pdf.co/files instead.

You can also use 3rd party cloud services:

  • Dropbox: you can use public link to a file from Dropbox
  • Google Drive: you can use link to a file that was shared as anyone with a link
  • Google Docs/Sheets/Slides: you can use a link to a document in Google Docs that was shared as anyone with a link
  • Any other cloud service that can store a file and provide a link to uploaded file.

IMPORTANT NOTE FOR GOOGLE DRIVE/DOCS users: free Google Drive/Docs limits the number of requests to their files. If you use a link to file or document from Google Drive or Google Drive then make sure you have no more than 5-10 requests per minute. Otherwise Google Drive returns no file or error page.

Temporary Files Upload

You can upload temporary files up to 2GB in size. Please note that to process these files you should use async=true mode with data extraction and tools endpoints along with /job/check to check status of background jobs you create.

Steps to Upload File:

1) First, call /file/upload/get-presigned-url. It will generate link for uploading (presignedUrl) and final link (url) 2) Now send your file to the presignedUrl link using the PUT method within the next 30 minutes. 3) Once finished, use url to access the file you have just uploaded.

Note: all uploaded files are considered to be temporary files and are automatically permanently removed after 1 hour.

Status Errors

CodeDescription
200The request has succeeded
400bad input parameters
401unauthorized
403not enough credits
405Timeout error. To process large documents or files please use asynchronous mode ( set async parameter to true) and then check the status using /job/check endpoint. If a file contains many pages then specify a page range using pages parameter. The number of pages of the document can be obtained using the endpoint /pdf/info

Example: Uploading a Temporary File

Sample Request:

! Don’t forget to set x-api-key url param or http header param (preferred) to API key, get yours here

GET
https://api.pdf.co/v1/file/upload/get-presigned-url?name=test.pdf&encrypt=true

200
{
    "presignedUrl": "https://pdf-temp-files.s3-us-west-2.amazonaws.com/28e191b14f3a4f43b16fcef1d53d191e/test.pdf?X-Amz-Expires=900&....",
    "url": "https://pdf-temp-files.s3-us-west-2.amazonaws.com/28e191b14f3a4f43b16fcef1d53d191e/test.pdf?X-Amz-Expires=....",
    "error": false,
    "status": 200,
    "name": "test.pdf",
    "remainingCredits": 93574
}

PUT
https://pdf-temp-files.s3-us-west-2.amazonaws.com/28e191b14f3a4f43b16fcef1d53d191e/test.pdf?X-Amz-Expires=900&....
--form 'file=@/path/to/file'

200
{
}

Now you can access your file using link from "url" param to from the first step.

Available Methods

[GET] /file/upload/get-presigned-url (GET generate secure URL for upload)

Description: This method generates links to upload your local file to. Use this presignedUrl from the response to upload your file. Once you upload your file to this presignedUrl using PUT, you can use the url link to access the uploaded file.

With this method you can upload files up to 2GB in size. Please note that to process these files you should use async=true mode with data extraction and tools endpoints along with /job/check to check status of background jobs you create.

Parameters

  • name optional. File name for generated output. Must be a String.

Steps to Upload File:

  • First, call /file/upload/get-presigned-url. It will generate link for uploading (presignedUrl) and final link (url)
  • Now send your file to the presignedUrl link using the PUT method within the next 30 minutes.
  • Once finished, use url to access the file you have just uploaded.

Notes

  • use contentType parameter to set Content-Type header for uploaded file. It can be application/pdf for PDF files or application/octet-stream for non-PDF documents or images.
  • url output param indicates temporary url to uploaded file. But for uploading a file you need to use presignedUrl with PUT upload via http method.
  • If you want to re-use temp url to the uploaded pdf for a preview or similar purposes then make sure to set contentType parameter to application/pdf so it will indicate proper file content type when accessed by a preview or a browser.

Important: uploaded files are treated as temporary files and auto removed permanently after 1 hour by default. You can remove it earlier using file/delete function.

Status Errors

CodeDescription
200The request has succeeded
400bad input parameters
401unauthorized
403not enough credits
405Timeout error. To process large documents or files please use asynchronous mode ( set async parameter to true) and then check the status using /job/check endpoint. If a file contains many pages then specify a page range using pages parameter. The number of pages of the document can be obtained using the endpoint /pdf/info

Example

Sample Request:

! Don’t forget to set x-api-key url param or http header param (preferred) to API key, get yours here

Workflow

Sample Request:

! Don’t forget to set x-api-key url param or http header param (preferred) to API key, get yours here

Generate secure link where you will upload your file:

curl --location --request GET https://api.pdf.co/v1/file/upload/get-presigned-url?name=test.pdf&encrypt=true
--header 'x-api-key: YOUR_API_KEY'

200
{
    "presignedUrl": "https://pdf-temp-files.s3-us-west-2.amazonaws.com/28e191b14f3a4f43b16fcef1d53d191e/test.pdf?X-Amz-Expires=900&....",
    "url": "https://pdf-temp-files.s3-us-west-2.amazonaws.com/28e191b14f3a4f43b16fcef1d53d191e/test.pdf?X-Amz-Expires=....",
}

// Now use PUT to upload file to "presignedUrl" link:

curl --location --request PUT '<insert presignedUrl here>' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/octet-stream' \
--data-binary '@./sample.pdf'

200
{ 
  // 200 means all was uploaded OK
}

Now your file is available via the link from url param from the first step

  • Method: GET
  • URL: /v1/file/upload/get-presigned-url

Query parameters

  • name: test.pdf ,* name: test.pdf
  • encrypt: true ,* name: test.pdf
  • encrypt: true
  • contentType: application/pdf

Body payload

keyvaluedescriptiondisabled
x-api-key Optional. Please use http headers instead when possible because passing your API key as parameter for POST or GET is not secure and is for legacy app compatibility only. 
true   

Example responses

/file/upload/get-presigned-url (GET generate secure URL for upload)
{
    "presignedUrl": "https://pdf-temp-files.s3.us-west-2.amazonaws.com/A1VGV42YE0NWXMKEB4BUIWNYGKXEWTND/test.pdf?X-Amz-Expires=900&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIZJDPLX6D7EHVCKA/20220913/us-west-2/s3/aws4_request&X-Amz-Date=20220913T074159Z&X-Amz-SignedHeaders=content-type;host&X-Amz-Signature=53f326afde5bcfb3b2714ee8cb5322795bf10a03feb7dab3764e6ca63c017f43",
    "url": "https://pdf-temp-files.s3.us-west-2.amazonaws.com/A1VGV42YE0NWXMKEB4BUIWNYGKXEWTND/test.pdf?X-Amz-Expires=3600&X-Amz-Security-Token=FwoGZXIvYXdzEBgaDLZTUxFLOwF9iiGk%2FyKCATiLp%2FRn9nPmt%2Fey9PcilcRMXtLl0TS6IFNOpk%2BKtSF%2B%2BEVcbNFThw4c1KVx21RQxT5zf7csSEESGov1Xd4uDhF0xGoVkXff9saXGVUtgKrYgPKhUfv5KEO7gz3E0t%2FqCPZJn2KGs1yMbUkohzeIrEd0NH8EVvqfxrfCcW0ZANiG2iMoh8eAmQYyKLjRMfg02ZJPTgoFPQmfMyYt0FacTg4RhkP3PeD9mrWLefDXCwcYkkI%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA4NRRSZPHFHQYL4OV/20220913/us-west-2/s3/aws4_request&X-Amz-Date=20220913T074159Z&X-Amz-SignedHeaders=host&X-Amz-Signature=9b1a90f36635459bb40f09b0fc6fe3eba185ba3cfdb0a8ef1096ac9efa9b6299",
    "error": false,
    "status": 200,
    "name": "test.pdf",
    "credits": 7,
    "duration": 0,
    "remainingCredits": 98191146
}
PUT presignedUrl –data-binary file=..

Code Snippet

CURL
curl --location --request GET 'https://api.pdf.co/v1/file/upload/get-presigned-url?name=test.pdf&encrypt=true&contentType=application/pdf' \
--header 'x-api-key: '

[PUT] PUT presignedUrl –data-binary ‘sample.pdf’

With this method you can upload files up to 100mb in size. Please note that to process these files you should use async=true mode with data extraction and tools endpoints along with /job/check to check status of background jobs you create.

Steps to Upload File:

  1. First, call /file/upload/get-presigned-url. It will generate link for uploading (presignedUrl) and final link (url)
  2. Now send your file to the presignedUrl link using the PUT method within the next 30 minutes.
  3. Once finished, use url from the step 1 to access the file you have just uploaded.

IMPORTANT

When sending PUT request don’t forget to add Content-Type header with proper value based on input file type.

Few examples of content-types applicable:

File ExtensionContent-Type Value
.txt,.csv, .xml, .jsontext/plain
.txt,.csv, .xmltext/plain
.pdfapplication/pdf
.msg and .emlapplication/vnd.ms-outlook
.docapplication/msword

Not sure? Just use Content-Type : application/octet-stream header. It works for the most of file types.

Incorrect

function uploadFile(file){
...

    const formData = new FormData();
    formData.append("file", file);

       await axios({
            method: 'PUT',
            url,
            data: formData,
            headers: {'Content-Type': 'multipart/form-data'}
          })
...
}

Correct

function uploadFile(file){
...
        // upload file data directly
        // https://github.com/axios/axios#axiospatchurl-data-config
        await axios({
            method: 'PUT',
            url: url,
            data: file,
            headers: {'Content-Type': 'application/octet-stream'}
        })
...
}

IMPORTANT 2: all uploaded files are treated as temporary files and are automatically permanently removed after 1 hour. If you have a file that you want to reuse over and over, please upload it to PDF.co File Storage and get its filetoken:// link that you may reuse inside PDF.co API.

Status Errors

CodeDescription
200The request has succeeded
400bad input parameters
401unauthorized
403not enough credits
405Timeout error. To process large documents or files please use asynchronous mode ( set async parameter to true) and then check the status using /job/check endpoint. If a file contains many pages then specify a page range using pages parameter. The number of pages of the document can be obtained using the endpoint /pdf/info

Workflow

Sample Request:

! Don’t forget to set x-api-key url param or http header param (preferred) to API key, get yours here

Generate secure link where you will upload your file:

curl --location --request GET https://api.pdf.co/v1/file/upload/get-presigned-url?name=test.pdf&encrypt=true
--header 'x-api-key: YOUR_API_KEY'

200
{
    "presignedUrl": "https://pdf-temp-files.s3-us-west-2.amazonaws.com/28e191b14f3a4f43b16fcef1d53d191e/test.pdf?X-Amz-Expires=900&....",
    "url": "https://pdf-temp-files.s3-us-west-2.amazonaws.com/28e191b14f3a4f43b16fcef1d53d191e/test.pdf?X-Amz-Expires=....",
}

// Now use PUT to upload file to "presignedUrl" link:

curl --location --request PUT '<insert presignedUrl here>' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/octet-stream' \
--data-binary '@./sample.pdf'

200
{ 
  // 200 means all was uploaded OK
}

Now your file is available via the link from url param from the first step

  • Method: PUT
  • URL: %3CTo%20upload%20insert%20presignedUrl%20generated%20by%20https://api.pdf.co/v1/file/upload/get-presigned-url%20%3E

Query parameters

No query parameters accepted.

Body payload

{
    "src": "./sample.pdf"
}

Example responses

/file/upload/get-presigned-url
{
    "presignedUrl": "https://pdf-temp-files.s3-us-west-2.amazonaws.com/0c72bf56341142ba83c8f98b47f14d62/test.pdf?X-Amz-Expires=900&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIZJDPLX6D7EHVCKA/20200302/us-west-2/s3/aws4_request&X-Amz-Date=20200302T143951Z&X-Amz-SignedHeaders=host&X-Amz-Signature=8650913644b6425ba8d52b78634698e5fc8970157d971a96f0279a64f4ba87fc",
    "url": "https://pdf-temp-files.s3-us-west-2.amazonaws.com/0c72bf56341142ba83c8f98b47f14d62/test.pdf?X-Amz-Expires=3600&x-amz-security-token=FwoGZXIvYXdzEGgaDA9KaTOXRjkCdCqSTCKBAW9tReCLk1fVTZBH9exl9VIbP8Gfp1pE9hg6et94IBpNamOaBJ6%2B9Vsa5zxfiddlgA%2BxQ4tpd9gprFAxMzjN7UtjU%2B2gf%2FKbUKc2lfV18D2wXKd1FEhC6kkGJVL5UaoFONG%2Fw2jXfLxe3nCfquMEDo12XzcqIQtNFWXjKPWBkQEvmii4tfTyBTIot4Na%2BAUqkLshH0R7HVKlEBV8btqa0ctBjwzwpWkoU%2BF%2BCtnm8Lm4Eg%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA4NRRSZPHEGHTOA4W/20200302/us-west-2/s3/aws4_request&X-Amz-Date=20200302T143951Z&X-Amz-SignedHeaders=host;x-amz-security-token&X-Amz-Signature=243419ac4a9a315eebc2db72df0817de6a261a684482bbc897f0e7bb5d202bb9",
    "error": false,
    "status": 200,
    "name": "test.pdf",
    "remainingCredits": 98145
}
PUT presignedUrl –data-binary file=..

Code Snippet

CURL
curl --location --request PUT '<To upload insert presignedUrl generated by https://api.pdf.co/v1/file/upload/get-presigned-url >' \
--header 'Content-Disposition: inline' \
--data-binary '@./sample.pdf'

[POST] /file/upload (Uploading small file)

Description: Uploads a small (up to 100KB) local file as a temporary file in PDF.co storage. Note: temporary files are automatically permanently removed after 1 hour.

Status Errors

CodeDescription
200The request has succeeded
400bad input parameters
401unauthorized
403not enough credits
405Timeout error. To upload large documents or files please use /file/upload/get-presigned-url instead to get url that you should upload into (see source code samples

Example

Sample Request:

! Don’t forget to set x-api-key url param or http header param (preferred) to API key, get yours here

  • Method: POST
  • URL: /v1/file/upload

Query parameters

No query parameters accepted.

Body payload

keyvaluedescriptiondisabled 
x-api-key Optional. Please use http headers instead when possible because passing your API key as parameter for POST or GET is not secure and is for legacy app compatibility only.  
true    
name optional. The name the file will be stored with. Must be a String.texttrue
filerequired. Local file should be selectedfile  

Example responses

POST Upload small file: /file/upload
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/28b6041bcfe34c469ed44f15f0594d5f/logo.dat",
    "error": false,
    "status": 200,
    "name": "logo",
    "remainingCredits": 77772
}
/file/upload/url
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/1a4a92ac805c41c28ef75a24e0f35ba5/sample.pdf",
    "error": false,
    "status": 200,
    "name": "sample.pdf",
    "remainingCredits": 98145
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/file/upload' \
--header 'x-api-key: ' \
--form 'file=@"/path/to/file"'

[POST] /file/upload/base64 (Upload small file as Base64)

Description: Creates a temporary file using base64 source data. You may use this temporary file URL with other API methods. Temporary files are automatically permanently removed after 1 hour. GET or POST request.

Status Errors

CodeDescription
200The request has succeeded
400bad input parameters
401unauthorized
403not enough credits
405Timeout error. To process large documents or files please use asynchronous mode ( set async parameter to true) and then check the status using /job/check endpoint. If a file contains many pages then specify a page range using pages parameter. The number of pages of the document can be obtained using the endpoint /pdf/info

Example

Sample Request:

! Don’t forget to set x-api-key url param or http header param (preferred) to API key, get yours here

POST

{
	"file" : "data:image/gif;base64,R0lGODlhEAAQAPUtACIiIScnJigoJywsLDIyMjMzMzU1NTc3Nzg4ODk5OTs7Ozw8PEJCQlBQUFRUVFVVVVhYWG1tbXt7fInDRYvESYzFSo/HT5LJVJPJVJTKV5XKWJbKWZbLWpfLW5jLXJrMYaLRbaTScKXScKXScafTdIGBgYODg6alprLYhbvekr3elr3el9Dotf///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAAIf8LSW1hZ2VNYWdpY2sNZ2FtbWE9MC40NTQ1NQAsAAAAABAAEAAABpJAFGgkKhpFIRHpw2qBLJiLdCrNTFKt0wjD2Xi/G09l1ZIwRJeNZs3uUFQtEwCCVrM1bnhJYHDU73ktJQELBH5pbW+CAQoIhn94ioMKB46HaoGTB5WPaZmMm5wOIRcekqChliIZFXqoqYYkE2SaoZuWH1gmAgsIvr8ICQUPTRIABgTJyskFAw1ZDBAO09TUDw0RQQA7"
}
  • Method: POST
  • URL: /v1/file/upload/base64

Query parameters

No query parameters accepted.

Body payload

keyvaluedescriptiondisabled 
x-api-key Optional. Please use http headers instead when possible because passing your API key as parameter for POST or GET is not secure and is for legacy app compatibility only.  
true    
namecustom nameoptional. The name the file will be stored with. Must be a String.texttrue
filedata:image/gif;base64,R0lGODlhEAAQAPUtACIiIScnJigoJywsLDIyMjMzMzU1NTc3Nzg4ODk5OTs7Ozw8PEJCQlBQUFRUVFVVVVhYWG1tbXt7fInDRYvESYzFSo/HT5LJVJPJVJTKV5XKWJbKWZbLWpfLW5jLXJrMYaLRbaTScKXScKXScafTdIGBgYODg6alprLYhbvekr3elr3el9Dotf///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAAIf8LSW1hZ2VNYWdpY2sNZ2FtbWE9MC40NTQ1NQAsAAAAABAAEAAABpJAFGgkKhpFIRHpw2qBLJiLdCrNTFKt0wjD2Xi/G09l1ZIwRJeNZs3uUFQtEwCCVrM1bnhJYHDU73ktJQELBH5pbW+CAQoIhn94ioMKB46HaoGTB5WPaZmMm5wOIRcekqChliIZFXqoqYYkE2SaoZuWH1gmAgsIvr8ICQUPTRIABgTJyskFAw1ZDBAO09TUDw0RQQA7required. Base64-encoded file bytes. Must be a String.text 

Example responses

https://api.pdf.co/v1/file/upload/base64
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/a8ac8a3cec3344f08f556bfd2d678b2f/uploadfile.txt",
    "error": false,
    "status": 200,
    "remainingCredits": 98145
}
POST Upload small file as Base64: /file/upload/base64
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/7588d614c9ad41eb98ec317a02abda63/uploadfile.txt",
    "error": false,
    "status": 200,
    "remainingCredits": 77769
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/file/upload/base64' \
--header 'x-api-key: ' \
--form 'file="data:image/gif;base64,R0lGODlhEAAQAPUtACIiIScnJigoJywsLDIyMjMzMzU1NTc3Nzg4ODk5OTs7Ozw8PEJCQlBQUFRUVFVVVVhYWG1tbXt7fInDRYvESYzFSo/HT5LJVJPJVJTKV5XKWJbKWZbLWpfLW5jLXJrMYaLRbaTScKXScKXScafTdIGBgYODg6alprLYhbvekr3elr3el9Dotf///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAAIf8LSW1hZ2VNYWdpY2sNZ2FtbWE9MC40NTQ1NQAsAAAAABAAEAAABpJAFGgkKhpFIRHpw2qBLJiLdCrNTFKt0wjD2Xi/G09l1ZIwRJeNZs3uUFQtEwCCVrM1bnhJYHDU73ktJQELBH5pbW+CAQoIhn94ioMKB46HaoGTB5WPaZmMm5wOIRcekqChliIZFXqoqYYkE2SaoZuWH1gmAgsIvr8ICQUPTRIABgTJyskFAw1ZDBAO09TUDw0RQQA7"'

[POST] /file/upload/url (Upload file from URL)

Description: Downloads file from a source url and uploads it as a temporary file. Temporary files are automatically permanently removed after 1 hour.

Status Errors

CodeDescription
200The request has succeeded
400bad input parameters
401unauthorized
403not enough credits
405Timeout error. To process large documents or files please use asynchronous mode ( set async parameter to true) and then check the status using /job/check endpoint. If a file contains many pages then specify a page range using pages parameter. The number of pages of the document can be obtained using the endpoint /pdf/info

Example

Sample Request:

! Don’t forget to set x-api-key url param or http header param (preferred) to API key, get yours here

POST

{
"url" : "https://bytescout-com.s3.amazonaws.com/files/demo-files/cloud-api/pdf-split/sample.pdf"
}
  • Method: POST
  • URL: /v1/file/upload/url

Query parameters

No query parameters accepted.

Body payload

keyvaluedescriptiondisabled
x-api-key Optional. Please use http headers instead when possible because passing your API key as parameter for POST or GET is not secure and is for legacy app compatibility only. 
true   
namesample.pdfoptional. The name the file will be stored with. Must be a String.text
urlhttps://bytescout-com.s3.amazonaws.com/files/demo-files/cloud-api/pdf-split/sample.pdfrequired. URL of the file to upload. Must be a String.text

Example responses

POST Upload from URL: /file/upload/url
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/4e36f2962b7f4248b7167f4389d534d5/sample.pdf",
    "error": false,
    "status": 200,
    "name": "sample.pdf",
    "remainingCredits": 77767
}
/file/upload/url
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/1a4a92ac805c41c28ef75a24e0f35ba5/sample.pdf",
    "error": false,
    "status": 200,
    "name": "sample.pdf",
    "remainingCredits": 98145
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/file/upload/url' \
--header 'x-api-key: ' \
--form 'name="sample.pdf"' \
--form 'url="https://bytescout-com.s3.amazonaws.com/files/demo-files/cloud-api/pdf-split/sample.pdf"'

[GET] /file/upload/url (Upload from URL)

Description: Downloads file from a source url and uploads it as a temporary file. Temporary files are automatically permanently removed after 1 hour.

Status Errors

CodeDescription
200The request has succeeded
400bad input parameters
401unauthorized
403not enough credits
405Timeout error. To process large documents or files please use asynchronous mode ( set async parameter to true) and then check the status using /job/check endpoint. If a file contains many pages then specify a page range using pages parameter. The number of pages of the document can be obtained using the endpoint /pdf/info

Example

Sample Request:

! Don’t forget to set x-api-key url param or http header param (preferred) to API key, get yours here

POST

{
"url" : "https://bytescout-com.s3.amazonaws.com/files/demo-files/cloud-api/pdf-split/sample.pdf"
}
  • Method: GET
  • URL: /v1/file/upload/url

Query parameters

  • url: https://bytescout-com.s3.amazonaws.com/files/demo-files/cloud-api/pdf-split/sample.pdf

Body payload

keyvaluedescriptiondisabled
x-api-key Optional. Please use http headers instead when possible because passing your API key as parameter for POST or GET is not secure and is for legacy app compatibility only. 
true   

Example responses

/file/upload/url
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/703aa298cfe745baa3449fbdaba4d1d7/sample.pdf",
    "error": false,
    "status": 200,
    "name": "sample.pdf",
    "remainingCredits": 98145
}
GET Upload from URL: /file/upload/url
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/97415d1c45a04b29ac42c8dc01883316/sample.pdf",
    "error": false,
    "status": 200,
    "name": "sample.pdf",
    "remainingCredits": 77765
}

Code Snippet

CURL
curl --location --request GET 'https://api.pdf.co/v1/file/upload/url?url=https://bytescout-com.s3.amazonaws.com/files/demo-files/cloud-api/pdf-split/sample.pdf' \
--header 'x-api-key: '

[POST] /file/delete

Description: Deletes temp file (that was uploaded by you or generated by API)

IMPORTANT: All temp files are auto removed after 1 hour. You may use /file/delete methods to explicitly force remove temp files once you don’t need them.

Parameters

  • url required. URL of previously uploaded temporary file or output file that was generated by API method.

  • Method: POST
  • URL: /v1/file/delete

Query parameters

No query parameters accepted.

Body payload

{
    "file": "https://pdf-temp-files.s3.amazonaws.com/b5c1e67d98ab438292ff1fea0c7cdc9d/sample.pdf"
}

Example responses

/file/delete
{
    "error": false,
    "status": 200,
    "remainingCredits": 9999986
}
POST /file/delete
{
    "error": false,
    "status": 200,
    "remainingCredits": 77778
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/file/delete' \
--header 'x-api-key: ' \
--data-raw '{
    "file": "https://pdf-temp-files.s3.amazonaws.com/b5c1e67d98ab438292ff1fea0c7cdc9d/sample.pdf"
}'

[POST] /file/hash

Description: Calculate and return MD5 hash of file by url. Commonly used to control if the source document has been changed or not because every little change will cause hash string to differ as well. GET or POST request.

Parameters

  • url required. URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. For uploading files via API please check Files Upload section. If you are randomly getting Too Many Requests or Access Denied error for your input url, please try to add cache: to enable built-in url caching. You can also encrypt data for output files and decrypt data input files with user-controlled data encryption (uses strong AES encryption with your own keys). Click here to learn more.

  • Method: POST
  • URL: /v1/file/hash

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://bytescout-com.s3.amazonaws.com/files/demo-files/cloud-api/pdf-split/sample.pdf"
}

Example responses

/file/hash
{
    "hash": "d942e5becdcb0386598cce15e9e56deb1ca9d893b8578a88eca4a62f02c4000b",
    "remainingCredits": 98143
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/file/hash' \
--header 'x-api-key: ' \
--data-raw '{
    "url": "https://bytescout-com.s3.amazonaws.com/files/demo-files/cloud-api/pdf-split/sample.pdf"
}'