API Permissions
FILE_UPLOAD
Query Parameters
Parameter | Type | Default | Description |
---|---|---|---|
folder | string | / | optional Specifies the directory to upload the file into. If it does not exist, it will be created Example: /path/to/folder |
resize | optional Sets the maximum dimensions (width,height ) of the image. If the image is larger, it will be resized upon upload Example: resize=1000,800 | ||
postprocess | string | optional Enqueues postprocess actions (see Postprocess actions section below) Example: postprocess=blurhash |
You can upload files using 3 methods:
Method 1 - 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. You can also pass metadata with the meta[file]={}
parameter.
The metadata object has to match the structure of your container (can be seen in the response of Get file details API). Both default and custom metadata fields are supported as well as multi-language fields.
Try it out
curl --request POST \
--url 'https://api.filerobot.com/fdocs/v4/files?folder=/api-demo' \
--header 'content-type: multipart/form-data' \
--header 'X-Filerobot-Key: fa5fe3303dd34e1da4810915c7c3fd6f' \
--form file=@photo.jpg \
--form 'meta[file]={"price":"500","title":{"de_DE":"Foto","en_US":"photo","fr_FR":"photo","it_IT":"foto"}}'
Method 2 - URL(s) of remotely hosted file(s)
Request body
The body consists of an array named files_urls which contains a list of files to be uploaded. Each element can contain the following parameters:
Parameter | Type | Default | Description |
---|---|---|---|
url | string | required Specifies the url of the file to be uploaded | |
name | string | optional Defines the new filename. If not specified, the original filename will be kept | |
meta | object | {} | optional Fills in metadata fields upon upload |
product | object | {} | optional Assigns a product reference upon upload (see Product reference section below) |
The metadata object has to match the structure of your container (can be seen in the response of Get file details API). Both default and custom metadata fields are supported as well as multi-language fields.
You can provide up to 20 URLs in a single request. Additional files will not be uploaded.
Method 3 - base64-encoded content
You can upload base64-encoded content into Filerobot.
Parameter | Default | Description |
---|---|---|
name | required Specifies the file name after upload. | |
data | required Base64-encoded file. | |
postactions | required decode_base64 decodes the uploaded content after upload to store as file. | |
meta | {} | optional Fills in metadata fields upon upload |
product | {} | optional Assigns a product reference upon upload (see Product reference section below) |
The metadata object has to match the structure of your container (can be seen in the response of Get file details API). Both default and custom metadata fields are supported as well as multi-language fields.
Response
{
"status": "success",
"file": {
"uuid": "889caa34-8c13-50c7-adc7-ffb9e2c50001",
"name": "boat.jpg",
"size": {
"bytes": 67450,
"pretty": "65.87 KB"
},
"type": "image/jpeg",
"url": {
"public": "https://store.filerobot.com/fdocs/api-demo/boat.jpg",
"permalink": "https://api.filerobot.com/fdocs/v4/get/889caa34-8c13-50c7-adc7-ffb9e2c50001",
"cdn": "https://fdocs.filerobot.com/api-demo/boat.jpg?vh=c78308",
"path": "/api-demo/boat.jpg"
},
"hash": {
"sha1": "c7830848f6760785265553efdf529823c0dc6d3d",
"blur_hash": null
},
"created_at": "2021-08-11T22:24:51Z",
"modified_at": "2021-08-11T22:24:51Z",
"overwrite": false,
"folder": {
"uuid": "7610923e-80d0-50e8-a2e4-c509be390158",
"name": "/api-demo"
},
"info": {
"img_type": "JPEG",
"img_w": 1300,
"img_h": 812
},
"meta": {
"material": "wood",
"title": {
"de_DE": "Boot",
"en_US": "boat",
"fr_FR": "bateau",
"it_IT": "barca"
},
"price": "79000"
}
},
"info": {
"version": 2.26,
"trace": "l-eu-ms-xxxtest.elastic-uploader.airstore.scal3fl3x.com",
"uniq_id": "ea7e30f4eafc401c8d5be8eac844d133",
"project_uuid": "094dd930-ccd3-4945-a051-a55b484678a8",
"company_uuid": "c543bc43-0000-1111-2222-b5293daf15f4",
"uploaded_files": 1,
"files_count": 1,
"init_db": "atom014:105"
}
}
Product reference
To assign a product reference to an asset upon upload, you need to provide the reference number in the product object in your request:
"product": {
"ref": "H03423",
"position": 1, // optional
}
To manipulate product references on existing assets, please see the Product API section.
Postprocess actions
parameter | description |
---|---|
blurhash | Generates a blurhash of the uploaded image (see Blurhash). Information is added to asset metadata |
face-count | Passes the uploaded image through a face-detection algorithm which adds the number if faces in the image to the asset metadata |
invalidate | Invalidates the CDN URLs using the uploaded file path. Useful when replacing existing assets with the same filename |
transcode | Enqueues a video transcoding task (see Video transcoding) for the uploaded video |
whitespace-detect | Detects the presence of excess uniform background or solid color background. Useful for flagging images which might require cropping. Information is added to asset metadata |