Back to blog
March 19, 20266 min read

PDF Hosting: Secure Document Sharing with Expiring Links

Host your generated PDFs with password protection, download limits, and expiring links. No separate file hosting service needed.

hostingsecuritydocument-sharinglinks

The problem with email attachments

Emailing PDF attachments is fragile: file size limits, spam filters, and no way to revoke access after sending. Hosted documents solve all of these — you send a link instead of a file.

Hosting a document

const response = await fetch('https://pdfrelay.com/api/v1/convert', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer sk_live_...', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    source: 'html',
    content: '<h1>Confidential Report</h1>...',
    hosting: {
      enabled: true,
      expires_in: 604800,     // 7 days
      download_limit: 5,      // Max 5 downloads
      password: 'secret123',  // Password protected
    },
  }),
});

const { download_url } = await response.json();
// Share download_url with the recipient

Security features

  • Expiring links: Documents automatically become inaccessible after the expiry time
  • Download limits: Cap the number of times a document can be downloaded
  • Password protection: Require a password to access the document
  • Deactivation: Instantly revoke access from the dashboard
  • Secure tokens: URLs use cryptographically random tokens — unguessable

No S3 buckets to manage. No signed URL logic to implement. Just include hosting: { enabled: true } in your conversion request, and your HTML becomes a secure, shareable document.

Ready to try pdfRelay?

Get started free. No credit card required.