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.
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'
Copy
Ask AI
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'
Copy
Ask AI
var https = require("https");var path = require("path");const API_KEY = "**********************************************";function getPresignedUrl(apiKey) { return new Promise(resolve => { // Prepare request to `Get Presigned URL` API endpoint let queryPath = `/v1/file/upload/get-presigned-url?name=test.pdf`; let reqOptions = { host: "api.pdf.co", path: encodeURI(queryPath), headers: { "x-api-key": apiKey } }; // Send request https.get(reqOptions, (response) => { response.on("data", (d) => { let data = JSON.parse(d); if (data.error == false) { console.log("presignedUrl: " + data.presignedUrl); // Return presigned url we received resolve([data.presignedUrl, data.url]); } else { // Service reported error console.log("getPresignedUrl(): " + data.message); } }); }) .on("error", (e) => { // Request error console.log("getPresignedUrl(): " + e); }); });}let result = getPresignedUrl(API_KEY);
Copy
Ask AI
# The authentication key (API Key).# Get your own by registering at https://app.pdf.coAPI_KEY = "*************************************"# Base URL for PDF.co Web API requestsBASE_URL = "https://api.pdf.co/v1"fileName = "test.pdf"url = "{}/file/upload/get-presigned-url?contenttype=application/octet-stream&name={}".format( BASE_URL, os.path.basename(fileName))# Execute request and get response as JSONresponse = requests.get(url, headers={"x-api-key": API_KEY})if (response.status_code == 200): json = response.json() if json["error"] == False: # URL to use for file upload uploadUrl = json["presignedUrl"] # URL for future reference uploadedFileUrl = json["url"]