Adding file sharing to your application used to require building upload infrastructure, managing storage and handling security. With a file sharing API, you can add upload-and-share functionality with a single HTTP request.
Table of Contents
REST API Basics for File Sharing
A file sharing API lets your application upload files to a storage service and get back shareable URLs. The typical flow is:
- Your application sends a file via HTTP POST with multipart/form-data
- The API stores the file and returns a JSON response with a share URL
- Your application uses that URL to share the file with users
The EasySend API follows this pattern with the simplest possible interface: no API keys, no OAuth, no account creation.
Authentication Approaches
File sharing APIs handle authentication differently:
- No authentication - EasySend requires nothing. Send a POST request and get a share link. Ideal for scripts, prototypes and applications where simplicity matters.
- API key - File.io and similar services require an API key in the header. You generate the key from a dashboard.
- OAuth 2.0 - Google Drive and Dropbox APIs require OAuth flows with client IDs, redirect URIs, access tokens and refresh tokens. Significant setup for basic file sharing.
For most file sharing use cases, the zero-auth approach is sufficient and dramatically faster to implement.
Upload Flow
The EasySend upload endpoint accepts one or more files and returns a bundle with a shareable URL:
POST https://easysend.co/api/v1/upload
Content-Type: multipart/form-data
files[]: (binary file data)
files[]: (optional additional files)
Response:
{
"success": true,
"short_code": "Ab3Kz",
"share_url": "/Ab3Kz",
"upload_token": "tok_abc123...",
"files": [
{"id": 1, "name": "report.pdf", "size": 1048576}
]
}
The upload_token is your management credential. Save it if you need to add files, delete files or check download counts later.
Download and Bundle Management
After uploading, the API provides endpoints for managing the bundle:
- GET /api/v1/bundle/{code} - retrieve bundle metadata and file list
- GET /api/v1/bundle/{code}/status - check if the bundle still exists
- GET /api/v1/download/{file_id} - download a specific file
- POST /api/v1/upload/{token} - add more files to an existing bundle
- DELETE /api/v1/file/{file_id} - remove a file (requires upload_token as Bearer token)
Full endpoint documentation is available at /api and machine-readable at /openapi.json.
Code Examples
cURL
curl -F "files[][email protected]" https://easysend.co/api/v1/upload
Python
import requests
r = requests.post("https://easysend.co/api/v1/upload",
files={"files[]": open("report.pdf", "rb")})
print(r.json()["share_url"])
JavaScript (Node.js)
const FormData = require("form-data");
const fs = require("fs");
const fetch = require("node-fetch");
const form = new FormData();
form.append("files[]", fs.createReadStream("report.pdf"));
const res = await fetch("https://easysend.co/api/v1/upload", {
method: "POST", body: form
});
const data = await res.json();
console.log(data.share_url);
More examples: Python tutorial, cURL guide, React component.
Advanced: Webhooks and Event-Driven Workflows
For applications that need to react to file events (download notifications, expiry alerts), the API supports optional notification features:
- Email notifications - pass
notify_emailin the upload request to receive email alerts when files are downloaded - Download tracking - the bundle info endpoint includes view_count for monitoring access
- Stripe webhooks - payment events (upgrades, extensions) trigger webhooks for server-side processing
AI Integration via MCP
The EasySend MCP plugin enables AI assistants to upload and share files as native tools. Install with npx easysend-mcp and your AI can handle file sharing in development workflows. See the CLI tool for terminal-based automation.
Error Handling and Edge Cases
Production integrations need to handle failures gracefully. The API returns standard HTTP status codes:
- 200/201 - success
- 400 - bad request (missing files, invalid parameters)
- 403 - forbidden (invalid upload token for delete operations)
- 404 - bundle or file not found
- 413 - file too large (exceeds 1GB on free tier)
- 429 - rate limited (too many requests). Check the
Retry-Afterheader for when to retry. - 500 - server error (rare, retry with exponential backoff)
Retry Logic Example (Python)
import requests
import time
def upload_with_retry(filepath, max_retries=3):
for attempt in range(max_retries):
try:
r = requests.post(
"https://easysend.co/api/v1/upload",
files={"files[]": open(filepath, "rb")},
timeout=60
)
if r.status_code == 429:
wait = int(r.headers.get("Retry-After", 60))
time.sleep(wait)
continue
r.raise_for_status()
return r.json()
except requests.exceptions.RequestException:
if attempt == max_retries - 1:
raise
time.sleep(2 ** attempt)
return None
Comparison: File Sharing APIs
| Feature | EasySend | File.io | Google Drive |
|---|---|---|---|
| Authentication | None required | API key | OAuth 2.0 |
| Setup time | 0 minutes | 5 minutes | 30+ minutes |
| Free tier | 1GB/upload | 100MB/upload | 15GB total |
| Multi-download | Unlimited | Single download | Unlimited |
| E2E encryption | Yes (optional) | No | No |
Common Integration Patterns
- CI/CD pipeline artifacts - upload build artifacts after each successful build, share the link in the deploy notification
- Customer support - let customers upload files through your support form using the embeddable widget, receive the share link in your ticket system
- Automated reports - generate a PDF report on a schedule, upload via API and email the share link to stakeholders
- Backup snapshots - upload database dumps or config backups, keep the share link as a quick-access reference
- Client portals - integrate the upload API into your client dashboard so clients can submit files directly
The full OpenAPI specification is available at easysend.co/openapi.json for automatic client generation in any language.