Automation transforms file sharing from manual task to seamless workflow. GetShared's API enables developers to integrate file operations into applications, automate processes, and build custom solutions. This guide covers API capabilities, authentication, and practical integration examples.
Why Use the GetShared API?
Manual file sharing works for occasional use. Automation makes sense when:
- Repetitive tasks – Regular uploads, scheduled shares
- Application integration – File storage within your apps
- Custom workflows – Business-specific requirements
- Scale – Processing thousands of files
- Consistency – Enforcing standards across operations
API Overview
RESTful Design
GetShared's API follows REST conventions:
- Standard HTTP methods (GET, POST, PUT, DELETE)
- JSON request/response format
- Predictable endpoint structure
- Stateless authentication
Base URL
https://api.getshared.com/v1/
Core Endpoints
| Endpoint | Method | Description |
|---|---|---|
| /files | GET | List files |
| /files | POST | Upload file |
| /files/{id} | GET | Get file details |
| /files/{id} | DELETE | Delete file |
| /folders | GET/POST | Manage folders |
| /shares | GET/POST | Manage share links |
| /shares/{id}/analytics | GET | Download analytics |
Authentication
API Keys
Generate API keys in your account settings:
- Go to Settings → API
- Click "Generate New Key"
- Name your key (e.g., "Production Server")
- Copy and securely store the key
Using API Keys
Include in request headers:
Authorization: Bearer YOUR_API_KEY
Security Best Practices
- Never commit API keys to code repositories
- Use environment variables
- Rotate keys periodically
- Use separate keys for development/production
- Enable two-factor authentication on accounts with API access
Common Operations
Uploading Files
// JavaScript/Node.js example
const FormData = require('form-data');
const fs = require('fs');
const form = new FormData();
form.append('file', fs.createReadStream('document.pdf'));
form.append('folder_id', 'abc123');
fetch('https://api.getshared.com/v1/files', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`
},
body: form
});
Creating Share Links
// Create password-protected, expiring share
fetch('https://api.getshared.com/v1/shares', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
file_id: 'file_123',
password: 'secure-password',
expires_at: '2026-02-28T00:00:00Z',
download_limit: 5
})
});
Retrieving Analytics
// Get download history for a share
fetch('https://api.getshared.com/v1/shares/share_123/analytics', {
headers: {
'Authorization': `Bearer ${API_KEY}`
}
})
.then(res => res.json())
.then(data => {
console.log(`Total downloads: ${data.total_downloads}`);
data.downloads.forEach(d => {
console.log(`${d.timestamp} - ${d.country}`);
});
});
Integration Examples
1. Automated Backup Upload
Script that uploads daily backups:
#!/bin/bash
# Daily backup upload
DATE=$(date +%Y-%m-%d)
BACKUP_FILE="/backups/db_${DATE}.sql.gz"
curl -X POST https://api.getshared.com/v1/files \
-H "Authorization: Bearer ${GETSHARED_API_KEY}" \
-F "file=@${BACKUP_FILE}" \
-F "folder_id=backups_folder_id"
See backup strategies for comprehensive backup strategies.
2. E-commerce Order Delivery
Automatically share digital products after purchase:
// After successful payment
async function deliverDigitalProduct(orderId, productFileId, customerEmail) {
// Create time-limited share
const share = await createShare({
file_id: productFileId,
expires_at: addDays(new Date(), 30),
download_limit: 3
});
// Send email with download link
await sendEmail({
to: customerEmail,
subject: 'Your download is ready',
body: `Download your purchase: ${share.url}`
});
return share;
}
3. Client Portal Integration
Embed file sharing in your application:
// List client's files
app.get('/client/:id/files', async (req, res) => {
const files = await getshared.listFiles({
folder_id: clientFolders[req.params.id]
});
res.render('client-files', { files });
});
// Generate download links
app.get('/client/:id/files/:fileId/download', async (req, res) => {
const share = await getshared.createShare({
file_id: req.params.fileId,
expires_at: addHours(new Date(), 24)
});
res.redirect(share.url);
});
Webhooks
Receive real-time notifications when events occur:
Available Events
file.uploaded– New file uploadedfile.downloaded– File downloaded via shareshare.created– New share link createdshare.accessed– Share link visitedshare.expired– Share link expired
Webhook Configuration
- Go to Settings → API → Webhooks
- Add endpoint URL
- Select events to receive
- Copy signing secret for verification
Rate Limits
| Plan | Requests/Minute | Uploads/Hour |
|---|---|---|
| Free | 60 | 20 |
| Pro | 300 | 100 |
| Team | 1000 | 500 |
| Enterprise | Custom | Custom |
Rate limit headers are included in responses:
X-RateLimit-Limit: 300
X-RateLimit-Remaining: 299
X-RateLimit-Reset: 1643723400
Error Handling
API returns standard HTTP status codes:
200– Success400– Bad request (check parameters)401– Unauthorized (check API key)403– Forbidden (insufficient permissions)404– Not found429– Rate limited500– Server error
SDKs and Libraries
Official SDKs available for:
- JavaScript/Node.js
- Python
- PHP
- Ruby
- Go
Community libraries for additional languages listed in our developer documentation.
Getting Started
- sign up for GetShared if you haven't already
- Generate API key in settings
- Review API documentation
- Start with simple operations (list files)
- Build up to complex integrations
Need help with integration? Our developer support team can assist with architecture questions and implementation guidance.