Turn a PDF into a public URL for OCR, AI, and document APIs
Invoices, contracts, reports, Drive exports, and webhook PDFs are useful only after another service can fetch them. Upload the PDF, confirm the URL serves `application/pdf`, then pass it into OCR, AI, or document APIs.
- Reviewed by
- GetFileURL technical team
- Updated
- Header proof
- 200 OK with Content-Type: application/pdf
- Response
- url, file_id, content_type, size, expires_at, delete_url
- Common flows
- invoice OCR, contracts, reports, Drive exports, webhooks
What this page answers
Yes. Use the returned url when the OCR API asks for a public PDF URL, and confirm it serves application/pdf before the OCR job starts.
- Reviewed by
- GetFileURL technical team
- Last updated
One request in, a URL and JSON out
curl -X POST https://api.getfileurl.com/v1/files \
-H 'Authorization: Bearer $GETFILEURL_KEY' \
-F 'file=@invoice.pdf' \
-F 'visibility=public'{
"file_id": "file_8ks41p",
"url": "https://cdn.getfileurl.com/f/file_8ks41p/invoice.pdf",
"content_type": "application/pdf",
"visibility": "public",
"expires_at": "2026-06-26T10:30:00.000Z"
}PDF links break when they are private, temporary, or wrapped in preview pages.
Document and OCR APIs usually fetch a URL server-side. If that URL requires a session, redirects to HTML, serves the wrong content type, or expires too early, the workflow fails.
Invoice OCR
Upload the invoice PDF and pass the returned `url` into OCR or extraction APIs.
Drive exports
Download or export the real PDF first, then use the GetFileURL URL instead of a Drive preview link.
Webhook PDFs
Turn incoming PDF attachments into direct URLs before the next CRM, AI, OCR, or support step.
OCR providers need a fetchable PDF response.
The safest PDF-to-URL handoff proves the URL returns PDF bytes before the OCR job starts.
Public URL
Use the returned GetFileURL `url` where the OCR API asks for a document URL.
Header check
Run `curl -I <returned-url>` and confirm `200 OK` plus `Content-Type: application/pdf`.
Base64 fallback
Use Base64 only when the OCR source or automation tool cannot send PDF bytes directly.
Treat sensitive documents as lifecycle-bound handoffs.
PDF workflows need clear retention behavior. Track expiry, keep the file ID or delete URL, and delete documents after the OCR or processing job finishes.
Short retention
Use short expiry windows for one-time OCR, AI review, validation, or document extraction tasks.
Delete endpoint
Call delete when OCR confirms the file was fetched and the result is saved.
Audit-ready metadata
Keep `url`, `file_id`, `content_type`, `size`, `expires_at`, and OCR job status in workflow logs.
Most PDF handoff failures are access or header problems.
PDF processors fetch server-side. They need a reachable URL, the PDF bytes, and a content type the service accepts.
Private document link
A link that opens for you in the browser may still fail for OCR or document APIs without your session.
HTML instead of PDF
If the source URL returns a viewer page or `text/html`, upload the PDF bytes and use the returned direct URL.
Expired before fetch
Confirm `expires_at` leaves enough time for retries, queue delays, and downstream processing.
Size or type rejected
Check both the upload limit and the downstream service limit before sending large contracts or reports.
Copy the same upload shape into code
curl -X POST https://api.getfileurl.com/v1/files \
-H 'Authorization: Bearer $GETFILEURL_KEY' \
-F 'file=@invoice.pdf' \
-F 'visibility=public'
{
"file_id": "file_8ks41p",
"url": "https://cdn.getfileurl.com/f/file_8ks41p/invoice.pdf",
"content_type": "application/pdf",
"visibility": "public",
"expires_at": "2026-06-26T10:30:00.000Z"
}Common questions
Can I pass the returned PDF URL to OCR APIs?
Yes. Use the returned `url` when the OCR API asks for a public PDF URL, and confirm it serves `application/pdf` before the OCR job starts.
Does the PDF URL expire?
Expiry should be set to match the workflow. The response includes lifecycle metadata so the caller knows when the URL stops resolving.
How do I remove a PDF after processing?
Store `file_id` or `delete_url` from the upload response and remove public access when OCR or document processing is complete.