URL File Upload
Endpoint
POST /api/file-url-upload
Full URL: https://modelfold.ai/api/file-url-upload
Authentication: every request must include the
Authorization: Bearer <API_KEY>header.
INFO
Uploaded files are deleted 24 hours after upload.
Features
- Supports HTTP and HTTPS file links
- Automatically downloads remote files and uploads them
- If fileName is omitted, a random file name is generated (the original extension is kept). Identical filenames overwrite old files; caching delays may occur.
- Automatically identifies MIME types
- Returns complete file information and download links
- Protected by API Key authentication
Supported Protocols
- HTTP:
http://example.com/file.jpg - HTTPS:
https://example.com/file.jpg
Use Cases
- Migrating files from other services
- Batch downloading and storing web resources
- Backing up remote files
- Caching external resources
Important Notes
- Ensure the provided URL is publicly accessible
- Download timeout is 30 seconds
- Recommended maximum file size is 100MB
Request Parameters
Body (application/json)
| Parameter | Type | Required | Description |
|---|---|---|---|
fileUrl | string | Yes | File download URL, must be a valid HTTP or HTTPS address Example: https://example.com/images/sample.jpg. |
uploadPath | string | Yes | File upload path, without leading or trailing slashes Example: images/downloaded. |
fileName | string | No | File name (optional), including file extension. If not provided, a random file name will be generated. If the same file name is uploaded again, the old file will be overwritten, but changes may not take effect immediately due to caching Example: sample-image.jpg. |
Request Example
bash
curl -X POST "https://modelfold.ai/api/file-url-upload" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"fileUrl": "https://example.com/images/sample.jpg",
"uploadPath": "images/downloaded",
"fileName": "sample-image.jpg"
}'json
{
"fileUrl": "https://example.com/images/sample.jpg",
"uploadPath": "images/downloaded",
"fileName": "sample-image.jpg"
}Response
200 — File uploaded successfully
| Parameter | Type | Required | Description |
|---|---|---|---|
success | boolean | Yes | Whether the request was successful |
code | integer | Yes | Response Status Code |
msg | string | Yes | Response message Example: File uploaded successfully. |
data | object | Yes | — |
data.fileName | string | Yes | File name Example: uploaded-image.png. |
data.filePath | string | Yes | Complete file path in storage Example: images/user-uploads/uploaded-image.png. |
data.downloadUrl | string | Yes | File download URL Example: https://tempfile.redpandaai.co/xxx/images/user-uploads/uploaded-image.png. |
data.fileSize | integer | Yes | File size in bytes Example: 154832. |
data.mimeType | string | Yes | File MIME type Example: image/png. |
data.uploadedAt | string | Yes | Upload timestamp Example: 2025-01-01T12:00:00.000Z. |
json
{
"success": true,
"code": 200,
"msg": "File uploaded successfully",
"data": {
"fileName": "uploaded-image.png",
"filePath": "images/user-uploads/uploaded-image.png",
"downloadUrl": "https://tempfile.redpandaai.co/xxx/images/user-uploads/uploaded-image.png",
"fileSize": 154832,
"mimeType": "image/png",
"uploadedAt": "2025-01-01T12:00:00.000Z"
}
}400 — Request parameter error
| Parameter | Type | Required | Description |
|---|---|---|---|
success | boolean | Yes | Whether the request was successful |
code | integer | Yes | Response status code |
msg | string | Yes | Response message Example: File uploaded successfully. |
json
{
"success": false,
"code": 400,
"msg": "Missing required parameter: uploadPath"
}401 — Unauthorized access
| Parameter | Type | Required | Description |
|---|---|---|---|
code | integer | No | Status code of the request. The HTTP status is 200 even when the request fails, so always check this field: 200 means success; any other value means the request failed and msg describes the reason. Common values: 401 invalid or missing API key; 402 insufficient credits; 429 rate limit exceeded; 422 or 500 the request could not be processed (read msg and check your parameters before retrying). Allowed values: 200 / 401 / 402 / 404 / 422 / 429 / 455 / 500 / 501 / 505. Example: 200. |
msg | string | No | Response message, error description when failed Example: success. |
success | boolean | Yes | Whether the request was successful |
json
{
"success": false,
"code": 401,
"msg": "Authentication failed: Invalid API Key"
}500 — Internal server error
| Parameter | Type | Required | Description |
|---|---|---|---|
success | boolean | Yes | Whether the request was successful |
code | integer | Yes | Response status code |
msg | string | Yes | Response message Example: File uploaded successfully. |
json
{
"success": false,
"code": 500,
"msg": "Internal server error"
}