What is the File Uploader Web API?

The Uploader Web API consists of a number of methods for uploading and can upload files up to 2GB in size. Increased reliability as each part may be retried without needing to restart the full upload in case of a connection or application problem. Increased performance as parts may be uploaded in parallel. Ability to pause and resume uploads.

What is the File Deleting Web API?

The File Deleting Web API is a very handy module that can delete the files you uploaded in the cloud any time you want. The files have a shelf life of 1 hour by default. If you don’t want to wait an hour, you can use the File Deleting API to delete the file right away.

SIGN UP FOR FREE

Benefits of Using Our Web API

Get Generate Secure URL for Upload

This method generates a link to your local file to use in the cloud. 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.

Formdata 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 the status of background jobs you create.

Uploading Small File

Uploads a small (up to 100KB) local file as a temporary file. Please note that temporary files are automatically removed after 1 hour permanently.

Upload small file as Base64

Upload Small File as Base64 Creates temporary files using base64 source data. You may use this temporary file URL with other Web API methods. Temporary files are automatically permanently removed after 1 hour.

Upload file from URL

It downloads files from a source URL and uploads them as a temporary file. Temporary files are automatically permanently removed after 1 hour.

Large File

Support The Uploader Web API can process files up to 2GB in size. Please note that to process these files you should use async=true mode and it will return a job/check id to check the status of the background job.

Files Deleted

All temp files are auto-removed after an hour by default. Instead of waiting for an hour, you have the option to delete the file right away after use.

Secure Access

We run hour APIs from Amazon’s secure AWS servers, which use the latest technologies to securely receive and send files. Therefore, if you are handling protected health information, working with us ensures you remain compliant with electronic Protected Health Information (ePHI) laws.

Cost-Effective

When using our Web APIs, you only pay for usage, instead of the license. That allows us to offer you rock-bottom charges so that you can keep working without affecting your cash flow.

Integration with Other Services

Our Web API can integrate with popular automation platforms such as Zapier,  IntegromatUiPath, and BluePrism making it easier to integrate it with popular apps. You may also request to have our Web APIs running on your on-premise server, instead of our cloud-based servers.

On-Premise API Server

On-Premise API Server File Uploader and File Deleting Web API are two of the modules that are available in our on-premise API Server. The on-premise API Server version is secure, powerful, and scalable. It can be installed in your own Windows Server and you can have more control over the management of the Web API.

SIGN UP FOR FREE

 

How to Use the Web API to Upload & Delete Files

Here is the sample code and demo for the File Uploader Web API.

Get secure URL for upload and Put ‘presigned URL’ —–formdata file

To demonstrate the /v1/file/upload/get-pre-signed-url endpoint, we will show you what the output looks like.

Sample Uploader API

Here is the File Uploader Web API  /v1/file/get-pre signed url endpoint’s and their uses.

 

File Uploader Web API Endpoint

URL:                                      https://api.pdf.co/v1/file/upload/get-presigned-url
Method:                                GET
Parameter                             Description   
Name                                     optional. Output file name.
Encrypt                                 optional. Set to true to encrypt the output file.

 

cURL Code Snippet for File Uploader API

cURL for Get secure URL for upload

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'

cURL for Put ‘pre signed’—-formdata file

curl --location --request PUT '<insert presignedUrl generated by https://api.pdf.co/v1/file/upload/get-presigned-url >' \
--header 'x-api-key: ' \
--form 'file=@"/Users/em/Downloads/logo.png

This sample code and other cURL source source code samples are available at this link.

Let’s see the File Uploader Web API in action using cURL.

Upload File Demo
v1/file/upload/get-pre signed-url endpoint using the cURL.

 

The File Uploader Web API (generate secure URL) for Javascript source source code samples is in this link.

The File Uploader Web API (generate secure URL)  for Java source source code samples is in this link.

The File Uploader Web API (generate secure URL)  for PHP source source code samples is in this link.

The File Uploader Web API  (generate secure URL) for Python source source code samples is in this link.

The File Uploader Web API (generate secure URL)  for C# source source code samples is in this link.

 

File Deleting Web API Endpoint

Here are the File Deleting Web API v1/file/delete endpoints and their uses.

URL:                                                     https://api.pdf.co/v1/file/delete          
Method:                                                POST

 

cURL Code Snippet for File Deleting Web API

curl --location --request POST 'https://api.pdf.co/v1/file/delete' \
 --header 'x-api-key: your-api-key' \
 --header 'Content-Type: application/json' \
 --data-raw '{
 "Url”: “https://pdf-temp-files.s3.amazonaws.com/b5c1e67d98ab438292ff1fea0c7cdc9d/sample.pdf”  
}’

 

This sample code and other cURL source source code samples are available at this link.

Let’s see the Delete API in action using cURL.

File Deleting Web API
v1/file/delete endpoint using the cURL.

SIGN UP FOR FREE

 

Upload Files of Up to 2GB to API Temporary Storage

You can upload files of up to 2GB in size, and then process them using various Web API functions that we have. However, for large files, you must process them asynchronously, by setting the “async” to “true”, which will also force the API process to execute in the background. Follow these two steps to upload big files.

Step 1: Get Upload and Access URLs

In order to upload a file to our API’s temporary storage, you need to have an upload URL, after which you will also need an access URL, to access the file in its new temporary locations. To get those two URLs, you must call “/file/upload/get-presigned-url”, which will return the upload URL: “presignedUrl” and access URL: “URL”.

Step 2: Upload File

To upload your large file, use the PUT method with “presignedUrl” param, within 30 minutes after getting the upload and access URLs. After the upload is complete, you may use “URL” to access the uploaded file, and process it with our API tools.

In order to get an output once the Web API successfully processes your file, use “/job/check”, to get a “success” status. Once you download your data, you can wait for the file to auto-delete after an hour, or delete it using the PUT method and “/file/delete” request we discussed above.

Upload Small Files under 50KB

Uploading small files is quite straightforward. All you need to do is use the POST method along with “/file/upload” param. Small files of less than 100 pages or 50KB do not time out while being processed by our API. Therefore, you do not need to process them in the “async” mode.

Furthermore, once you are done working on the small file, you can delete it using the PUT method and “/file/delete” request. You also have an option to let the file auto delete after an hour.

Related Samples: