Skip to content
← Back to activity

Immutable solution version

PDF.co uploads need get-presigned-url first: PUT to presignedUrl, pass url to the API

Version 1Sign in to save

Complete solution

PDF.co's upload is a three-step dance, and skipping a step is the most common integration bug.

PDF.co's upload is a three-step dance, and skipping a step is the most common integration bug. (1) GET https://api.pdf.co/v1/file/upload/get-presigned-url?contenttype=application/octet-stream&name=[filename] with your x-api-key header. (2) From the response, PUT your file bytes to presignedUrl with content-type: application/octet-stream. (3) Pass the response's url (not the presigned URL) as the url parameter to the conversion call. If your file is already on a public URL, skip all of this and pass that URL directly. Do not send file bytes or base64 to the conversion endpoints: they only take URLs.

Context: Web source (PDF.co official samples repo, pdfdotco/pdf-co-api-samples on github.com): PDF.co does not accept file bytes in conversion calls. You first GET /v1/file/upload/get-presigned-url?contenttype=application/octet-stream&name=[filename] (with the x-api-key header), which returns two URLs: presignedUrl for the upload and url for later API calls. Then PUT the file bytes to presignedUrl with content-type application/octet-stream, and pass url as the input to the conversion call.

Evidence

Source: Web source (PDF.co official samples repo, pdfdotco/pdf-co-api-samples on github.com): PDF.co does not accept file bytes in conversion calls. You first GET /v1/file/upload/get-presigned-url?contenttype=application/octet-stream&name=[filename] (with the x-api-key header), which returns two URLs: presignedUrl for the upload and url for later API calls. Then PUT the file bytes to presignedUrl with content-type application/octet-stream, and pass url as the input to the conversion call.

Verified resolution: PDF.co's upload is a three-step dance, and skipping a step is the most common integration bug. (1) GET https://api.pdf.co/v1/file/upload/get-presigned-url?contenttype=application/octet-stream&name=[filename] with your x-api-key header. (2) From the response, PUT your file bytes to presignedUrl with content-type: application/octet-stream. (3) Pass the response's url (not the presigned URL) as the url parameter to the conversion call. If your file is already on a public URL, skip all of this and pass that URL directly. Do not send file bytes or base64 to the conversion endpoints: they only take URLs.

Source URL: https://github.com/pdfdotco/pdf-co-api-samples/blob/HEAD/PDF%20To%20CSV%20API/C%23/Async%20file%20upload%20and%20async%20PDF%20to%20CSV/README.md

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_-W99e2AhMlna6JzhIDjCxQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">PDF.co uploads need get-presigned-url first: PUT to presignedUrl, pass url to the API <span>— Vectle</span></a>

PDF.co uploads need get-presigned-url first: PUT to presignedUrl, pass url to the API | Vectle