Workflow recipe

Send a PDF to OCR with a direct public URL

To send a PDF to OCR by URL, upload the PDF bytes, confirm the returned URL serves `application/pdf`, pass `url` to the OCR API, then keep `file_id`, `expires_at`, and `delete_url` for cleanup.

Reviewed by
GetFileURL technical team
Updated
PDF OCR URLapplication/pdfMistral OCRAdobe OCRdelete after use
Recipe shape
Input
PDF invoice, contract, report, Drive export, or webhook attachment
Action
Upload PDF bytes and verify application/pdf delivery
Output
OCR-ready PDF URL plus file_id, expires_at, and delete_url
Header proof
200 OK with Content-Type: application/pdf
OCR fields
url, file_id, content_type, expires_at, delete_url
Failure signal
Drive preview links, HTML pages, or wrong MIME type
Short answer

What this page answers

It turns a PDF invoice, contract, report, Drive export, or webhook attachment into an OCR-ready URL that serves application/pdf.

Reviewed by
GetFileURL technical team
Last updated
Handoff

One request in, a URL and JSON out

Request
Drive export or invoice.pdf
  -> POST /v1/files
  -> curl -I response.url
  -> Content-Type: application/pdf
  -> OCR API document_url
  -> delete after OCR completes
Steps

Make the file handoff visible.

A useful PDF OCR recipe shows the source PDF, upload request, `application/pdf` header proof, OCR URL mapping, and cleanup handle.

01

Capture the file

Start from the actual PDF bytes, such as a Drive export, invoice upload, contract, report, email attachment, or webhook PDF.

02

Upload and parse JSON

Upload the PDF with `POST /v1/files`, then confirm the returned URL serves `application/pdf` before mapping it into OCR.

03

Send onward

Pass `url` to the OCR API, keep `file_id`, `content_type`, `expires_at`, and `delete_url`, then delete after OCR completes.

Checks

Validate the URL before the destination retries.

Most PDF OCR URL issues come from one of four places: Drive preview links, expired attachment URLs, HTML responses instead of PDF bytes, or the wrong MIME type.

01

Direct response

The URL should return file bytes, not an app preview, permission page, or redirect loop.

02

Useful headers

Content type, size, and disposition should match what the destination expects.

03

Enough retention

Expiry should account for queue delays, async processing, and retry branches.

OCR platform proof

Match the URL shape OCR tools ask for.

PDF OCR tools usually fetch the PDF from their own servers. The URL must be public, reachable, and clearly a PDF response.

01

Mistral OCR

Use a public PDF URL or Base64 PDF input when the OCR provider accepts those document shapes.

02

Adobe OCR

Keep the PDF served as `application/pdf` so the OCR job receives the expected input type.

03

PDF.co and similar tools

Pass a direct file URL to a single PDF, not a Drive folder, viewer page, or permissioned app link.

Header proof

Prove the returned URL serves PDF bytes before OCR runs.

The fastest preflight is the same check the OCR provider effectively performs: fetch headers from the returned URL and confirm a PDF response.

01

Run curl -I

Run `curl -I https://cdn.getfileurl.com/f/file_8ks41p/invoice.pdf` before mapping the URL into the OCR request.

02

Check status

Confirm `200 OK`, not a redirect loop, sign-in page, or expired link.

03

Check type

Confirm `Content-Type: application/pdf`, then keep `content_type` beside the OCR job.

Cleanup

Treat OCR URLs as job-scoped access.

Invoices, contracts, and reports can be sensitive. Keep the PDF reachable through OCR retries, then remove public access after the job finishes.

01

Expiry

Compare `expires_at` with OCR queue time, retries, and manual replay windows.

02

Delete after OCR

Use `delete_url` or `DELETE /v1/files/{file_id}` when the OCR result is saved.

03

Log the run

Store `url`, `file_id`, `content_type`, `expires_at`, destination job ID, and OCR response status.

Examples

Copy the same upload shape into code

curl -I 'https://cdn.getfileurl.com/f/file_8ks41p/invoice.pdf'
HTTP/2 200
content-type: application/pdf

Response fields to keep:
  url, file_id, content_type, expires_at, delete_url
FAQ

Common questions

What does this recipe solve?

It turns a PDF invoice, contract, report, Drive export, or webhook attachment into an OCR-ready URL that serves `application/pdf`.

Should the URL be permanent?

Not by default. Keep it alive through OCR fetches and retries, then delete after the OCR result is saved.

What should I log?

Log `url`, `file_id`, `content_type`, `expires_at`, `delete_url`, the OCR job ID, and the OCR response status.