Skip to main content

Documentation Index

Fetch the complete documentation index at: https://fileguard.dev/docs/llms.txt

Use this file to discover all available pages before exploring further.

Step 1: Get Your API Key

After signing up at app.fileguard.io, create an API key from your dashboard.
Store your API key securely. It’s only shown once during creation and cannot be retrieved later.
Your API key looks like: fg_aBcDeFgHiJkLmNoPqRsTuVwXyZ123456789012

Step 2: Create a File Context

File contexts define rules for uploads. Create one for your use case:
curl -X POST "https://api.fileguard.io/api/v1/contexts" \
  -H "Authorization: Bearer fg_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "context_key": "documents",
    "display_name": "Documents",
    "allowed_extensions": ["pdf", "docx"],
    "max_file_size_mb": 10
  }'
Use descriptive context_key values like patient_reports, invoices, or profile_images.

Step 3: Upload a File

Upload a file to your context:
curl -X POST "https://api.fileguard.io/api/v1/files/upload" \
  -H "Authorization: Bearer fg_your_api_key" \
  -F "file=@/path/to/document.pdf" \
  -F "context=documents"
Response:
{
  "status": "SUCCESS",
  "message": "File uploaded successfully",
  "data": {
    "file_id": "file_z1x2c3v4b5n6",
    "original_filename": "document.pdf",
    "content_type": "application/pdf",
    "size_bytes": 245678,
    "context_key": "documents"
  }
}

Step 4: Download a File

Get a pre-signed URL to download:
curl "https://api.fileguard.io/api/v1/files/file_z1x2c3v4b5n6" \
  -H "Authorization: Bearer fg_your_api_key"
Response:
{
  "status": "SUCCESS",
  "data": {
    "file_id": "file_z1x2c3v4b5n6",
    "download_url": "https://bucket.s3.amazonaws.com/...",
    "expires_in_seconds": 300,
    "original_filename": "document.pdf"
  }
}
Pre-signed URLs expire after expires_in_seconds (default: 300). Request a new URL when needed.

What’s Next?

File Contexts

Learn about file validation rules

API Keys

Manage API keys with scopes

File Validation

Blank file, corrupt file, and virus detection

Statistics

Monitor usage and analytics