Upload File (Base64)
/api/v1/media/files/upload-base64Upload files using JSON with base64-encoded content. This endpoint is designed for workflow automation tools (Xano, N8N, Make, etc.) that don't support multipart/form-data uploads.
For Xano/N8N users: This is the recommended endpoint for file uploads. The standard /upload endpoint requires multipart/form-data which most automation tools don't support.
Request Body
file_datastringrequiredBase64-encoded file content
filenamestringrequiredFilename with extension (e.g., "image.png", "document.pdf")
content_typestringMIME type (auto-detected from filename if not provided)
folderstringOptional folder path within your bucket (e.g., "logos", "images/products")
Response
successbooleanWhether the upload succeeded
urlstringPublic URL to access the uploaded file
keystringFile key within the bucket
content_typestringMIME type of the uploaded file
sizeintegerFile size in bytes
Example
- cURL
- Python
- JavaScript
curl -X POST "https://spideriq.ai/api/v1/media/files/upload-base64" \
-H "Authorization: Bearer cli_abc123:sk_xxx:secret_xxx" \
-H "Content-Type: application/json" \
-d '{
"file_data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"filename": "pixel.png",
"folder": "images"
}'
import requests
import base64
# Read and encode file
with open("image.png", "rb") as f:
file_data = base64.b64encode(f.read()).decode()
url = "https://spideriq.ai/api/v1/media/files/upload-base64"
headers = {
"Authorization": "Bearer cli_abc123:sk_xxx:secret_xxx",
"Content-Type": "application/json"
}
payload = {
"file_data": file_data,
"filename": "image.png",
"folder": "uploads"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
// Convert file to base64
const fileToBase64 = (file) => {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {
// Remove data URL prefix (e.g., "data:image/png;base64,")
const base64 = reader.result.split(',')[1];
resolve(base64);
};
reader.onerror = reject;
});
};
// Upload file
const uploadFile = async (file) => {
const fileData = await fileToBase64(file);
const response = await fetch(
'https://spideriq.ai/api/v1/media/files/upload-base64',
{
method: 'POST',
headers: {
'Authorization': 'Bearer cli_abc123:sk_xxx:secret_xxx',
'Content-Type': 'application/json'
},
body: JSON.stringify({
file_data: fileData,
filename: file.name,
folder: 'uploads'
})
}
);
return response.json();
};
Response Example
{
"success": true,
"url": "https://media.spideriq.ai/client-cli-abc123/images/pixel.png",
"key": "images/pixel.png",
"content_type": "image/png",
"size": 68,
"bucket": "client-cli-abc123",
"file_id": "images/pixel.png"
}
Xano Integration
In Xano, use an External API Request action:
- Method: POST
- URL:
https://spideriq.ai/api/v1/media/files/upload-base64 - Headers:
Authorization:Bearer {your_token}Content-Type:application/json
- Body (JSON):
{
"file_data": "{base64_encoded_file}",
"filename": "uploaded-file.jpg",
"folder": "xano-uploads"
}
In Xano, you can use the base64_encode function to convert file content to base64 before sending.
N8N Integration
In N8N, use an HTTP Request node:
- Method: POST
- URL:
https://spideriq.ai/api/v1/media/files/upload-base64 - Authentication: Header Auth with
Authorization: Bearer {token} - Body Content Type: JSON
- Body Parameters:
file_data: Use expression{{ $binary.data.data }}for binary datafilename: Your desired filenamefolder: Optional folder path