API Documentation
Complete API reference for programmatic access to 404 services
🔌 API Documentation
Programmatic access to 404 services via RESTful API. Upload files, manage pastes, and interact with services from your scripts and applications.🚀 Quick Start
# Upload a file
curl -F "file=@document.pdf" https://4-0-4.io/api/upload
# Create a paste
curl -X POST https://4-0-4.io/api/paste \
-H "Content-Type: application/json" \
-d '{"content":"Hello, World!","language":"text"}'I was going to write more here... but then I remembered that I've already documented it pretty well here and I don't want to repeat myself. So... check out the API reference for more details on available endpoints, parameters, and examples.
📦 SDKs and Libraries
Python
import requests
# Upload a file
with open('document.pdf', 'rb') as f:
response = requests.post(
'https://4-0-4.io/api/upload',
files={'file': f},
data={'expires': '1d'}
)
print(response.json())JavaScript
// Upload with fetch
const formData = new FormData();
formData.append('file', fileInput.files[0]);
fetch('https://4-0-4.io/api/upload', {
method: 'POST',
body: formData
})
.then(r => r.json())
.then(data => console.log(data));Bash
#!/bin/bash
# Simple upload script
upload_file() {
local file=$1
curl -F "file=@$file" https://4-0-4.io/api/upload
}
upload_file "document.pdf"🧪 Testing
Get API Status
curl https://4-0-4.io/api/statusResponse:
{
"status": "operational",
"version": "2.1.0",
"uptime": 864231,
"services": {
"upload": "operational",
"paste": "operational",
"git": "operational"
}
}📚 Additional Examples
Upload Multiple Files
# Upload and get URLs
for file in *.jpg; do
response=$(curl -s -F "file=@$file" https://4-0-4.io/api/upload)
url=$(echo $response | jq -r '.url')
echo "$file -> $url"
doneCreate Paste from Command Output
# Paste the output of a command
ls -la | curl -X POST https://4-0-4.io/api/paste \
-H "Content-Type: application/json" \
-d "{\"content\":\"$(cat -)\",\"language\":\"bash\"}"Monitor File Expiration
# Check if file is still available
check_file() {
status=$(curl -s -o /dev/null -w "%{http_code}" https://4-0-4.io/file/$1)
[ $status -eq 200 ] && echo "Available" || echo "Expired"
}
check_file "abc123"For more examples and community-contributed scripts, visit our git repository.