The POST method accepts files up to 100 MB. If you need to upload larger files please refer to the Stream Upload API (PUT). See this section for more information about the upload process.
API Permissions
FILE_UPLOAD
Query Parameters
Parameter | Type | Default | Description |
---|---|---|---|
folder | string [Optional] |
/ | Specifies the folder to upload the file into. If it does not exist, it will be created Example: /path/to/folder |
upload_mode | string [Optional] |
try-safe-2000ms | safe The request is blocked and the response is returned only after the file is being successfully stored in at least one storage backend. try-safe[-xxxms] The request is blocked for the duration of the timeout parameter or until the file is being successfully stored in at least one storage backend - whichever happens first. quick Returns the response as soon as the Uploader has received the file. This method has the benefit from returning an answer quickly but is unreliable as the actual upload in the storage backend takes place after the response is being returned and there is no acknowledgement from the storage backend. |
Try it out
You can upload files using 3 methods:
Multipart/form-data request
This is the most common way to upload a file and allows easy integration in HTML forms. The file(s) should be attached to the file
parameter:
curl --request POST \
--url 'https://api.filerobot.com/fusqadtm/v4/upload?folder=/folder' \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--header 'X-Filerobot-Key: 19692813e7364ef8ad6a6504d50a12ca' \
--form file=@yourfile.txt
You can specify the target file name with the name
parameter and include metadata (meta
) upon upload:
curl --request POST \
--url 'https://api.filerobot.com/fusqadtm/v4/upload?folder=/folder_test' \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--header 'X-Filerobot-Key: 19692813e7364ef8ad6a6504d50a12ca' \
--form file=@yourfile.txt \
--form "name[file]=new_name.jpg" \
--form "meta[file]={\"meta_key\": {\"default\":\"meta_value\"}}"
Please note that the meta
fields have to match the custom metadata keys set in your container.
Remotely hosted file
The file(s) will be downloaded from their source URL into the Filerobot store.
Upon upload, you can rename the file with the name
field as well as fill in the file metadata by providing a meta
field in the JSON:
{
"files_urls": [
{
"meta": {
"meta_key": {
"default": "metadata field value"
}
},
"name": "new_image.png",
"url": "http://sample.li/frog.png"
}
]
}
Please note that the meta
fields have to match the custom metadata keys set in your container.
Click on the API Explorer tab to test the API in live.
You can provide up to 20 URLs in a single request. Additional files will not be uploaded.
Base64-encoded
You can upload base64-encoded content into Filerobot:
Parameter | Defaul | Description |
---|---|---|
name | [Required] | Specifies the file name after upload. |
meta | [Optional] | Fills in meta fields upon upload. |
data | [Required] | Base64-encoded file. |
postactions | [Required] | decode_base64 decodes the uploaded content after upload to store as file. |
Please note that the meta
fields have to match the custom metadata keys set in your container.
Copy-paste the cURL request in your Terminal or click on the API Explorer tab to see the API in action.
Success
{
"status": "success",
"file": {
"uuid": "340a56bc-8aa7-5b99-8e2a-ba1f9ef50000",
"name": "new_image_from_base64.png",
"type": "image/png",
"size": 3291,
"sha1": "102c4ec7c78b9dabc3c4d80211e8aea131a69314",
"meta": {
"img_h": 400,
"img_type": "PNG",
"img_w": 400
},
"url_permalink": "https://api.filerobot.com/fusqadtm/v1/get/_/340a56bc-8aa7-5b99-8e2a-ba1f9ef50000/new_image_from_base64.png",
"url_public": "https://store.filerobot.com/fusqadtm/new_image_from_base64.png",
"properties": {},
"overwrite": false
},
"info": {
"company_uuid": "c543bc43-0000-1111-2222-b5293daf15f4",
"uploaded_files": 1,
"input_info": {
"postactions": "decode_base64",
"name": "new_image_from_base64.png",
"data": "iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAIAAAAP3aGbAAAAA3...hADMECYggWEEOwgBiCBcT4fwvd8vhlstsNAAAAAElFTkSuQmCC"
},
"files_count": 0,
"project_uuid": "094dd930-ccd3-4945-a051-a55b484678a8",
"trace": "88utQneu-ov-610.elastic-uploader.airstore.scal3fl3x.comW",
"version": "ab76d1c",
"uniq_id": "370af52023774d2aa44b005395afa329",
"init_db": "atom009:27"
}
}
Errors
{
"status": "error",
"code": "ERR_UNAUTHORIZED",
"msg": "Invalid secret key",
"hint": "Uploads are not authorized with this secret key. (Login as admin on your Filerobot account, edit your key and add the UPLOAD permission)"
}
{
"status": "error",
"code": "ERR_JSON_INVALID",
"msg": "Invalid JSON string received, please check the parsing",
"hint": "Please check your JSON structure",
"info": {
"version": 2.07,
"uniq_id": "82cc4e53a2ce4d9cb19648722c1fd4cd",
"project_uuid": "094dd930-ccd3-4945-a051-xxxxxxxxxxxx",
"company_uuid": "c543bc43-0000-1111-2222-xxxxxxxxxxxx"
}
}