Product Files
Product Files let you upload files (installers, updates, assets) to a product and distribute them to licensed users via authenticated downloads.
File Properties
| Field | Description |
|---|---|
name | Display name for the file |
filename | Original filename |
size | File size in bytes |
mimeType | MIME type (auto-detected) |
versionId | Optional: link to a specific app version |
planId | Optional: restrict to a specific plan |
public | Whether the file is publicly downloadable |
downloads | Download count |
Managing Files (Dashboard API)
List Files
GET /v1/dashboard/product-files/products/:productId
Upload a File
Files are uploaded via multipart form data:
const formData = new FormData();
formData.append('file', fileBlob, 'setup.exe');
formData.append('name', 'Installer v2.1');
// formData.append('versionId', 'version-uuid'); // Optional
// formData.append('planId', 'plan-uuid'); // Optional
// formData.append('public', 'false'); // Optional
await fetch('/v1/dashboard/product-files/products/PRODUCT_ID', {
method: 'POST',
headers: { 'Authorization': 'Bearer YOUR_TOKEN' },
body: formData
});
Maximum file size: 500 MB.
Delete a File
DELETE /v1/dashboard/product-files/products/:productId/:fileId
Deletes both the database record and the file from disk.
Downloading Files (Client API)
Authenticated downloads use an API key with file:download permission:
const response = await fetch(
'https://api.geckoguard.com/v1/product-files/download/FILE_ID',
{
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
}
);
// Response is the file stream with appropriate Content-Type and Content-Disposition headers
const blob = await response.blob();
The API key must belong to the same product as the file. Download counts are automatically incremented.
Use Cases
- Software distribution — host installers and updates behind license validation
- Asset delivery — distribute premium content to licensed users
- Version-specific files — link files to app versions for organized releases
- Plan-gated content — restrict files to specific subscription plans