You do not need an SDK. You do not need an API key. You do not need to read 40 pages of documentation. Uploading a file with Python takes exactly three lines of code.
The 3-Line Solution
import requests
response = requests.post('https://easysend.co/api/v1/upload', files={'files[]': open('report.pdf', 'rb')})
print(response.json()['share_url'])
Run that script and you get a shareable download link back. That is the entire integration. No signup, no tokens, no configuration. The EasySend API is completely open.
What the API Returns
The response is a JSON object with everything you need:
{
"success": true,
"short_code": "Ab3Kz",
"share_url": "/Ab3Kz",
"upload_url": "/u/abc123...def456",
"upload_token": "abc123...def456",
"files": [
{"id": 42, "name": "report.pdf", "size": 1048576, "mime_type": "application/pdf"}
]
}
The short_code gives you the shareable link at https://easysend.co/Ab3Kz. The upload_token lets you manage the bundle later. The files array tells you what was uploaded.
Adding Proper Error Handling
The 3-line version works for scripts and quick tests. For production code you should handle failures gracefully:
import requests
import sys
def upload_file(filepath):
"""Upload a file to EasySend and return the share URL."""
try:
with open(filepath, 'rb') as f:
response = requests.post(
'https://easysend.co/api/v1/upload',
files={'files[]': f},
timeout=120
)
response.raise_for_status()
data = response.json()
if not data.get('success'):
print(f"Upload failed: {data}", file=sys.stderr)
return None
share_url = f"https://easysend.co/{data['short_code']}"
print(f"Uploaded: {share_url}")
return share_url
except FileNotFoundError:
print(f"File not found: {filepath}", file=sys.stderr)
return None
except requests.exceptions.Timeout:
print("Upload timed out. Try again or check your connection.", file=sys.stderr)
return None
except requests.exceptions.RequestException as e:
print(f"Network error: {e}", file=sys.stderr)
return None
# Usage
url = upload_file('report.pdf')
if url:
print(f"Send this link to anyone: {url}")
This version opens the file properly with a context manager, sets a timeout so it will not hang forever and catches the most common failure modes. Use this pattern in any real application.
Uploading Multiple Files
Bundle several files under a single shareable link by passing multiple entries in the files[] field:
import requests
filepaths = ['design-v2.psd', 'mockup.png', 'notes.txt']
files = [('files[]', open(fp, 'rb')) for fp in filepaths]
response = requests.post('https://easysend.co/api/v1/upload', files=files)
data = response.json()
print(f"Share link: https://easysend.co/{data['short_code']}")
print(f"Files uploaded: {len(data['files'])}")
# Close file handles
for _, fh in files:
fh.close()
All files are grouped into one bundle. Recipients see every file on a single download page.
Using a Custom Short Code
Want a memorable URL instead of a random code? Check availability first, then upload with your custom code:
import requests
custom = 'q1-reports'
# Check if the code is available
check = requests.get(f'https://easysend.co/api/v1/check/{custom}')
if check.json().get('available'):
response = requests.post(
'https://easysend.co/api/v1/upload',
files={'files[]': open('q1-report.pdf', 'rb')},
data={'custom_code': custom}
)
data = response.json()
print(f"Your link: https://easysend.co/{data['short_code']}")
else:
print(f"Code '{custom}' is already taken. Try another.")
Custom codes must be 3 to 30 characters. They make links easy to remember and share verbally. Read more about custom codes on the developer API page.
Uploading with Encryption
Mark a bundle as encrypted by adding the encrypted flag:
import requests
response = requests.post(
'https://easysend.co/api/v1/upload',
files={'files[]': open('sensitive-data.csv', 'rb')},
data={
'encrypted': '1',
'access_password': 'strong-passphrase-here',
'description': 'Q1 financial data - password protected'
}
)
data = response.json()
print(f"Protected link: https://easysend.co/{data['short_code']}")
The access_password field requires recipients to enter a password before they can view or download the files. For true end-to-end encryption, encrypt the file contents client-side before uploading. See our integration guide for details on client-side encryption flows.
Adding Files to an Existing Bundle
Got the upload token from a previous upload? You can add more files to the same bundle:
import requests
# Your token from the original upload
upload_token = 'abc123...def456'
response = requests.post(
f'https://easysend.co/api/v1/upload/{upload_token}',
files={'files[]': open('additional-file.zip', 'rb')}
)
data = response.json()
print(f"Bundle now has {len(data['files'])} files")
The share link stays the same. Recipients will see the new file alongside the originals.
Downloading Files Programmatically
Retrieve bundle info and download individual files:
import requests
# Get bundle info
short_code = 'Ab3Kz'
info = requests.get(f'https://easysend.co/api/v1/bundle/{short_code}')
bundle = info.json()
print(f"Bundle: {bundle['short_code']}")
print(f"Files: {len(bundle['files'])}")
# Download each file
for file_info in bundle['files']:
print(f"Downloading {file_info['name']}...")
dl = requests.get(f"https://easysend.co/api/v1/download/{file_info['id']}")
with open(file_info['name'], 'wb') as f:
f.write(dl.content)
print(f" Saved: {file_info['name']} ({file_info['size']} bytes)")
Building a Bulk Upload Script
Here is a complete script that uploads every file in a directory and prints the share link:
#!/usr/bin/env python3
"""Upload all files in a directory to EasySend."""
import os
import sys
import requests
def upload_directory(directory, description=None):
"""Upload all files in a directory as a single bundle."""
if not os.path.isdir(directory):
print(f"Not a directory: {directory}", file=sys.stderr)
return None
filepaths = [
os.path.join(directory, f)
for f in os.listdir(directory)
if os.path.isfile(os.path.join(directory, f))
]
if not filepaths:
print("No files found in directory.", file=sys.stderr)
return None
files = [('files[]', (os.path.basename(fp), open(fp, 'rb'))) for fp in filepaths]
data = {}
if description:
data['description'] = description
try:
response = requests.post(
'https://easysend.co/api/v1/upload',
files=files,
data=data,
timeout=300
)
response.raise_for_status()
result = response.json()
if result.get('success'):
url = f"https://easysend.co/{result['short_code']}"
print(f"Uploaded {len(result['files'])} files")
print(f"Share link: {url}")
return url
else:
print(f"Upload failed: {result}", file=sys.stderr)
return None
finally:
for _, fh in files:
if hasattr(fh, 'close'):
fh.close()
elif isinstance(fh, tuple) and hasattr(fh[1], 'close'):
fh[1].close()
if __name__ == '__main__':
directory = sys.argv[1] if len(sys.argv) > 1 else '.'
desc = sys.argv[2] if len(sys.argv) > 2 else None
upload_directory(directory, desc)
Run it with python upload_dir.py ./build-output "Build artifacts from CI" and every file in that folder gets bundled and shared.
Using the EasySend CLI Instead
If you just need quick uploads from the terminal without writing Python, the EasySend CLI handles everything in one command:
# Install
curl -fsSL https://easysend.co/cli/install.sh | bash
# Upload a file
easysend report.pdf
# Upload a directory
easysend ./build-output/
# Copy link to clipboard
easysend report.pdf --copy
The CLI is ideal for quick one-off uploads. Use Python when you need file sharing as part of a larger script or application.
Tips for Production Use
- Always use
with open(...)context managers so file handles close properly - Set a
timeouton requests to avoid hanging on large uploads - Store the
upload_tokenif you need to modify the bundle later - Use
descriptionto add context for recipients - The API is rate limited to 10 uploads per hour per IP. For higher limits, contact us
The full API documentation covers every endpoint, field and response format. Start with the 3-line version, then add features as you need them.
Related Guides
- EasySend API Documentation - full endpoint reference
- Developer API Overview - authentication, rate limits and SDKs
- Developer Guide to EasySend API - cURL, Python and JavaScript examples
- Send Files from the Command Line with cURL - terminal-first file sharing
- Integration Guide - embed file sharing in your app