PreviewFile IconPreviewFile.dev

Onboarding Guide

Get started with PreviewFile.dev - three ways to create secure preview links

Onboarding Guide

PreviewFile.dev offers three core ways to create secure preview links for your files and URLs. Whether you're a casual user, business user, or developer, you can get started quickly.

New to PreviewFile? This guide will walk you through all three usage scenarios with practical examples.


Scenario 1: Direct URL Preview (No Login Required)

Use Case: Quickly share any web resource (images, videos, PDFs, etc.) while hiding the original URL

How It Works

  1. Visit the URL shortening endpoint

    https://previewfile.dev/u?url=[YOUR_ORIGINAL_URL]

    Example:

    https://previewfile.dev/u?url=https://example.com/sensitive-document.pdf
  2. Get your preview link

    • System automatically generates a short link: /p/abc123xyz
    • Full preview link: https://previewfile.dev/p/abc123xyz
  3. Share with others

    • Recipients can view the content by visiting /p/abc123xyz
    • Original URL is completely hidden
    • Link expires based on configured duration (default 1 hour)

Example Use Case

Scenario: Share internal company report without exposing S3 storage path

# Enter in browser
https://previewfile.dev/u?url=https://s3.company.com/reports/Q3-2025.pdf

# Returns short link
https://previewfile.dev/p/x7k2m9n

# Share short link with team members

Benefits

  • ✅ No registration or login required
  • ✅ Instant preview link generation
  • ✅ Hide original resource address
  • ✅ Automatic expiration protection

Scenario 2: Browser File Upload (Login Required)

Use Case: Upload local files for online preview with advanced security policies

How It Works

  1. Visit homepage

    • Go to https://previewfile.dev
    • See file upload component
  2. Drag/select file

    • Drag and drop file to upload area
    • Or click "Upload File" button to select
  3. Login prompt

    • System prompts for login on first upload
    • Supports GitHub / Google / Email quick login
  4. Configure preview policies (optional)

    • Link Validity: Set expiration time (15 minutes to 7 days, plan limits apply, default 1 hour)
    • Dynamic Watermark: Add watermark text
    • No Download: Disable download, view-only
    • One-Time Link: Link expires after one view
  5. Generate preview link

    • Click "Guard Your Files with Effortless Previews"
    • Get /p/[shortUrl] format preview address
  6. Manage history

    • View all created preview sessions in Dashboard
    • Manually delete or wait for automatic expiration

Example Use Case

Scenario: Designer shares design with client, view-only, no download

  1. Upload design-final.psd
  2. Check "No Download"
  3. Set "Dynamic Watermark" to "Client Preview Only"
  4. Set validity to 24 hours
  5. Get link: https://previewfile.dev/p/d3s1gn42
  6. Client can only view online, cannot download original file

Benefits

  • ✅ Support local file upload
  • ✅ Flexible security policy configuration
  • ✅ Manage all preview records after login
  • ✅ Suitable for internal enterprise collaboration

Scenario 3: Developer API Integration

Use Case: Integrate file preview functionality in applications, batch generate preview links

API Endpoint

POST /api/u
Content-Type: application/json
x-api-key: YOUR_API_KEY

Request Parameters

{
  "url": "https://example.com/document.pdf",
  "ttlMinutes": 60,
  "watermark": "Confidential",
  "noDownload": true,
  "oneTime": false
}

Response Example

{
  "success": true,
  "data": {
    "shortUrl": "a1b2c3d4",
    "previewUrl": "https://previewfile.dev/p/a1b2c3d4",
    "expireAt": "2025-10-02T15:30:00Z",
    "status": "READY"
  }
}

Integration Examples

Node.js

const fetch = require('node-fetch');

async function createPreview(originalUrl) {
  const response = await fetch('https://previewfile.dev/api/u', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${process.env.PREVIEWFILE_API_KEY}`
    },
    body: JSON.stringify({
      url: originalUrl,
      ttlMinutes: 120,
      noDownload: true
    })
  });

  const result = await response.json();
  return result.data.previewUrl;
}

// Usage
const previewLink = await createPreview('https://cdn.company.com/invoice-2025.pdf');
console.log('Preview link:', previewLink);

Python

import requests

def create_preview(original_url):
    response = requests.post(
        'https://previewfile.dev/api/u',
        headers={
            'Content-Type': 'application/json',
            'Authorization': f'Bearer {API_KEY}'
        },
        json={
            'url': original_url,
            'ttlMinutes': 120,
            'noDownload': True
        }
    )
    data = response.json()
    return data['data']['previewUrl']

# Usage
preview_link = create_preview('https://cdn.company.com/invoice-2025.pdf')
print(f'Preview link: {preview_link}')

Application Scenarios

  1. SaaS Application Integration

    • Auto-generate preview links after user uploads
    • Include temporary preview address in email notifications
  2. Customer Relationship Management (CRM)

    • Share contracts, invoices with customers
    • Automatically set expiration and download restrictions
  3. Internal Collaboration Tools

    • Batch generate preview links for team documents
    • Centrally manage permissions and validity

Benefits

  • ✅ RESTful API, easy to integrate
  • ✅ Support batch operations
  • ✅ Complete error handling and retry mechanism
  • ✅ Seamless integration with existing systems

Security Policies Explained

1. TTL (Time To Live)

  • Configurable from 15 minutes to 7 days (plan limits apply, default 1 hour)
  • Link automatically expires after TTL
  • Use case: Temporary sharing, sensitive documents

2. Dynamic Watermark

  • Overlay text watermark on preview page
  • Can set username, timestamp, etc.
  • Use case: Copyright protection, internal audit

3. No Download

  • Users can only view online, cannot save locally
  • Blocks right-click save, drag download, etc.
  • Use case: Design review, contract preview
  • Expires immediately after one access
  • Use case: Password transmission, temporary authorization

FAQ

Q1: Are there limits for free users?

A: Free users get 10 preview quota per month, max 10MB per file, max 24-hour link validity.

Q2: Where are uploaded files stored?

A: Files are encrypted and stored in the cloud, automatically deleted after expiration. Paid users can choose private deployment.

A: Modification not supported, but you can delete old link and regenerate.

Q4: What file types are supported?

A: Images (JPG/PNG/GIF/WebP), PDF, videos (MP4/WebM), Office documents, and more.

Q5: Are there API rate limits?

A: Free users: 10/day, paid users: 100-10000/day depending on plan.


Next Steps


Need Help? Contact us: [email protected]

On this page