Python File Upload
Upload Files From Python With Plain requests
Upload files from Python with a plain HTTP request. No SDK, REST API, CDN delivery, prepaid credits.
If you've wired up file uploads in Python before, you know the boto3 ritual: pin the SDK, point it at credentials and a region, name a bucket, and hope your IAM policy is scoped right. files.link skips all of that and meets Python where it already is — the requests library (or httpx, or urllib3, your call). The upload is three plain HTTP calls. Step one, request a presigned URL by POSTing file metadata to /v1/files/{folderId} with your API key in the Authorization header (raw key, no Bearer prefix); the JSON back is { success, urls: [{ url, id }] }.
Step two, PUT the bytes straight to url. Step three, POST /v1/files/confirm-upload with { "ids": [id] } to finalize. Concretely:
import requests
API = "https://api.files.link"
KEY = "YOUR_API_KEY"
FOLDER = "your-folder-id"
PATH = "report.pdf"
# 1. ask for a presigned PUT URL
meta = requests.post(
f"{API}/v1/files/{FOLDER}",
headers={"Authorization": KEY},
json={"filesMetadata": [{"name": "report.pdf"}]},
).json()
slot = meta["urls"][0]
# 2. upload the bytes
with open(PATH, "rb") as f:
requests.put(slot["url"], data=f)
# 3. confirm
requests.post(
f"{API}/v1/files/confirm-upload",
headers={"Authorization": KEY},
json={"ids": [slot["id"]]},
)That's the whole integration — no vendor import, nothing to bundle into a Lambda zip, no credentials file. Streaming data=f rather than f.read() keeps memory flat for large files, which matters in workers and serverless. The contract is identical with httpx (sync or async) if you're in an async stack, so an await client.put(...) pipeline drops in cleanly.
Auth is a single header on every call; rotate keys from the dashboard without touching code beyond the env var. Once confirmed, a public file is served from a global CDN URL and a private file via a signed URL with a short default expiry — chosen at upload time, not through a separate subsystem. For files past ~100MB (up to 1TB) there's a multipart variant: initiate, PUT each part to its own presigned URL — easily parallelized with a ThreadPoolExecutor or asyncio.gather — then complete.
Billing is prepaid credits, so a runaway loop costs you credits, not an open-ended surprise invoice. Compared to boto3 you trade a feature-dense SDK for a contract you can read in one screen and call from any Python version. If you're in a web framework, the Flask and FastAPI upload guides show wiring the same three calls behind an endpoint; for the language-agnostic reference, see the cloud file storage API page.
Benefits With No Complexity
Global CDN delivery
Edge-cached worldwide
Signed-URL security
What You Get
Unlimited files
Unlimited storage
Public + Private storage
CDN ready links
Prepaid credits
More coming soon
How files.link Works
1. Upload
2. Copy
3. Use Anywhere
Why Developers Choose files.link
A Better Way to Store & Deliver Files
| AWS S3 (boto3) | Google Cloud Storage | Cloudinary SDK | files.link | |
|---|---|---|---|---|
| Works with requests / httpx (no SDK) | ||||
| No credentials file / IAM setup | ||||
| Streaming PUT (flat memory) | ||||
| Global CDN delivery included | ||||
| Public + signed URLs at upload time | ||||
| Multipart up to 1TB per file | ||||
| Prepaid credits, no surprise bills |
Calculate Your Needs
Storage
Egress
CDN Bandwidth
Upload Files from Python
- Global CDN delivery
- Edge-cached worldwide
- Signed-URL security
- Unlimited files
- Unlimited storage
- Public + Private storage
- No subscription — prepaid credits keep spend predictable