Guides

Upload

Upload assets

Use this API to upload one or more files and create assets within FileSpin.


📘

For uploads from websites, use the File Picker Web Widget.

Note:

  • To upload a single file, use file as multipart-form field name for file.
  • To upload multiple files in a single request, use file1, file2, file3, etc. as multipart-form field names for files.
  • Each uploaded file will result in a new asset being created.
  • file , file1, file2, file3, etc. are conventional names for multipart-form field names. You can use any name for the field names.

Adding metadata to the asset

There are two ways to add custom metadata to the asset.

  1. Update the asset with custom metadata once the upload completes. See Update Data API to do this.
  2. Send custom metadata with the upload. To send custom asset metadata with the upload, include JSON metadata as string in custom_metadata form-data field, like below. Custom metadata sent as below will be added to the asset.
curl --request POST \
  --url https://app.filespin.io/api/v1/assets/new/content/original/upload \
  --header 'X-FileSpin-Api-Key: {{X-FileSpin-Api-Key}}' \
  --header 'content-type: multipart/form-data' \
  --form [email protected] \
  --form 'custom_metadata={"data":{"foo":"bar"}, "data_schema_id":1}'

The custom_metadata field JSON value follows the same format and rules as the Update API payload.

Note : Since data being sent as multipart/form-data custom_metadata JSON should be sent as string as shown above.


HTTP RESPONSE

Standard HTTP Status Code (200 or 202)

KeyValueDescription
filesJSONList of files
idstringAsset ID, 32 character alphanumeric UUID
namestringFile name
sizeintegerSize of file in bytes
checksumstringMD5 checksum
content_typestringMIME type
providerstringAlways "local" to indicate local upload
successbooleantrue if upload completed, false otherwise
metadataJSONOnly returned for custom plans. Applies to image uploads. Where available, Exiftool tag values for 'ColorMode', 'ColorSpace', 'Orientation', 'Make' and 'Model' are returned. 'Width' and 'Height' are always returned

Response JSON

{
  "files": [
    {
      "id": "99d819953914402babbdeb68337ea6a3",
      "name": "sample.jpg",
      "size": 8836363,
      "checksum": "5f5f26bd7c0f62c6e02e44c73d09734e",
      "content_type": "image/jpeg",
      "metadata": {
        "Make": "Apple",
        "ColorSpace": "sRGB",
        "Model": "iPhone 3G",
        "Orientation": "Horizontal (normal)",
        "width": 1200,
        "height": 800
      }
    }
  ],
  "success": true,
  "provider": "local"
}
Language
Credentials
Header
URL