Welcome
Welcome to FileSpin Headless DAM API Documentation!
This documentation covers everything you need as a developer to:-
- Upload and manage Assets
- Create and manage Users
- Process Image and Video
- Request Dynamic Image Transformations
- Provide streaming video playback
- Use addons, manage Integrations
- and much more
Contact us
For developer support, email us at support@filespin.io
, use the Help button on the Dashboard once you have logged-in or visit the Support site
DAM Basics
Within FileSpin, the following terms have specific and actionable meaning:-
Term | Definition |
---|---|
Asset | A File and it's Metadata |
Role | A label for a set of permissions that allow associated actions within FileSpin |
User | A valid FileSpin account that has a Role |
What is an Asset
Within FileSpin an Asset is the main entity. It contains the file you want to manage and associated metadata.
A simple way to remember what an Asset is:
ASSET = CONTENT + METADATA
CONTENT
is:-- Original file and
- One or more derivative content such as image conversions, video transcodes, etc
METADATA
is:-
Core metadata
such as file size, image height/width, that cannot be updated by user, andCustom metadata
added by user
Who is a User
Access to FileSpin is through a User (a.k.a. User Account). A User Account provides login-based access to Web Dashboard and API-based access to headless DAM API.
What is a User Role
The User Role determines the actions a User Account can perform within FileSpin. Each User has a Role assigned.
FileSpin provides the following system-defined user roles:-
Role ID | Role Name | Description |
---|---|---|
1 | ADMIN | Manage assets (create/upload, view, edit, download, distribute, delete, restore & purge), manage users (create, update and disable), manage global settings |
2 | MANAGER | Manage assets (create/upload, view, edit,download, distribute, delete, restore), manage their own settings |
3 | CREATOR | Create/upload, edit, download and distribute assets |
4 | USER | View and download assets |
What are User Permissions
Permissions are string tokens that define what actions a user is allowed to perform. Permissions are determined by User Role as below.
Role ID | Role Name | Permissions | Description |
---|---|---|---|
1 | ADMIN | CREATE_ASSET , DELETE_UNDELETE_ASSET , PURGE_ASSET , EDIT_ASSET , READ_ASSET , DISTRIBUTE_ASSET , UPDATE_SETTINGS , USER_ADMIN |
Administer users, assets and settings, purge deleted assets |
2 | MANAGER | CREATE_ASSET , DELETE_UNDELETE_ASSET , EDIT_ASSET , READ_ASSET , DISTRIBUTE_ASSET , UPDATE_SETTINGS |
Manage assets and update settings |
3 | USER | READ_ASSET |
View and download assets |
4 | CREATOR | CREATE_ASSET , DELETE_UNDELETE_ASSET , EDIT_ASSET , READ_ASSET , DISTRIBUTE_ASSET |
Upload assets and update settings |
What are User Groups
Users are grouped under the Administrator User who created the Users. Users within a User Group can access assets created by other users is they have Group Asset Access enabled.
Asset Access Security
Here's a quick rundown of how FileSpin implements secure access for Assets using Users, Roles, Permissions and Groups:-
- All access is either API key or JWT (see Authentication for details)
- Assets are owned by the User who created it
- What a User can do with an Asset is determined by the User's Role
- A User can access an asset only if atleast one of the below two conditions are met:-
- if the User created the asset or
- if the User has
Group Asset Access
setting enabled and one of their group members created the asset
Before you begin
Service endpoints
Our service endpoints are listed below. All our services are over https.
Service | Base URL |
---|---|
Javascript | https://js.filespin.io |
API | https://app.filespin.io |
CDN | https://cdn.filespin.io |
Code examples
The column on the right has code examples. When you are at a specific API within the documentation, checkout the side panel.
Asset ID and API Keys
A quick introduction to some of the IDs used within FileSpin service that you should be aware of.
Asset ID
This is a unique identifier for a file within our service. It is composed of 36 alphanumeric characters, like 678d1dbb934c4a42aa4833e893346857
When you integrate an application with FileSpin.io, most often this is the ID you would store within your application.
API KEY
This is the secret key that you will use to access FileSpin API. FileSpin will not disclose this to anyone except you. You should keep this well protected.
The API Key is unique to you. It is composed of 36 alphanumeric characters.
UPLOAD KEY
This is the Key for use in the File Picker for associating a file upload with your FileSpin account. The Upload Key is unique to you. It is composed of 36 alphanumeric characters.
UPLOAD KEY cannot be used anywhere except with File Picker to upload assets. It cannot be used to view or access uploaded assets.
Access ID
This is a unique ID associated with a user account. This may be required to retrieve signed URLs using certain APIs.
Asset Storage
Amazon S3
You may use FileSpin's storage or alternately use your own Amazon AWS S3 storage for storing assets and conversions.
If you are using your own S3 storage, please add the policy shown below to all the S3 Buckets you use in your FileSpin Storage settings. This policy allows FileSpin to store assets and processed files into your bucket.
FileSpin.io S3 Bucket Policy
- Replace
YOUR-BUCKET
below with your actual bucket name while applying the policy. YOUR-BUCKET
must have ACLs enabled in Object Ownership settings. This allows FileSpin to assign object ownership to bucket owner.YOUR-BUCKET
must haveBlock all public access
setting turned OFF. If this is not done,Make Public
API will fail to set public access.
{
"Id": "FileSpinBucketPolicy",
"Statement": [
{
"Sid": "Stmt1295042087538",
"Effect": "Allow",
"Principal": {
"AWS": ["arn:aws:iam::103679559772:root"]
},
"Action": [
"s3:GetObject",
"s3:PutObjectAcl",
"s3:ListMultipartUploadParts",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::YOUR-BUCKET/*"
},
{
"Sid": "Stmt1295042087538",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::103679559772:root"
},
"Action": "s3:DeleteObject",
"Resource": "arn:aws:s3:::YOUR-BUCKET/*"
},
{
"Sid": "Stmt1295042087538",
"Effect": "Allow",
"Principal": {
"AWS": ["arn:aws:iam::103679559772:root"]
},
"Action": [
"s3:GetBucketAcl",
"s3:ListBucket",
"s3:ListBucketMultipartUploads",
"s3:GetBucketLocation"
],
"Resource": "arn:aws:s3:::YOUR-BUCKET"
}
]
}
File Picker Web Widget
FileSpin File Picker is a web widget for your users to upload files from their computer or pick files from their Cloud accounts and send it to your application.
Get started with File Picker
Start by including filespin.js just before the closing body
tag in your HTML.
<script type="text/javascript"
src="https://js.filespin.io/embed/dist/filespin.min.js"></script>
Then, initialize Picker for use with the UPLOAD_KEY
associated with the FileSpin account. You can get the UPLOAD_KEY
from FileSpin Account Dashboard.
FileSpin.initPicker({
uploadKey: "UPLOAD_KEY"
});
Example HTML
Here is a complete example that shows how to setup an "Upload Files" button on a web page
<body>
<!-- a button for user to start file uploads-->
<button id="upload">Upload Files </button>
<!-- Insert this just before the closing body tag -->
<script type="text/javascript"
src="https://js.filespin.io/embed/dist/filespin.min.js"></script>
<script>
//initialize and open File Picker on button press
document.getElementById('upload').addEventListener('click', function() {
FileSpin.initPicker({
uploadKey: "UPLOAD_KEY"
});
});
</script>
</body>
Picker Limitations
- Cloud Uploads is limited by Cloud provider's API limitations
- Picker does not support uploading entire cloud folders except for Dropbox
- Dropbox uploads require additional setup (see Dropbox Support below)
- Picker may not display more than 500 files (approx) in a cloud folder
- Display order of Cloud files is not guaranteed to be in any particular order
Picker API
Picker provides a rich set of APIs so you can control how the Picker works to suit your web application needs.
initPicker API
This API is the starting point for Picker. Use this to initialize the Picker. It uses sensible default options which can be overridden.
//Initialize the Picker. Replace UPLOAD_KEY with the correct key
FileSpin.initPicker({
uploadKey: "UPLOAD_KEY",
});
initPicker API with callback on ready event
FileSpin.initPicker(settings, function() {})
API can be used to safely take actions only when the Picker is ready. You can pass a callback function as the second argument which will be called when the Picker is ready.
//Initialize the Picker with `display` set to `false`
//When Picker is ready, display an alert using the callback function.
FileSpin.initPicker(
{
uploadKey: "UPLOAD_KEY",
display: false,
},
function () {
//this function is called when picker is initialized and ready
alert("Picker ready!");
FileSpin.showPicker();
}
);
showPicker API
Use this API to programmatically show the File Picker dialog. Using this in conjunction with hidePicker() API and display
parameter of initPicker() API, you can realize advanced user interactions.
//Show Picker API
FileSpin.showPicker();
hidePicker API
Use this API to programmatically hide the File Picker dialog.
//Hide Picker API
FileSpin.hidePicker();
resetPicker API
If you need to return the user to file selection after an upload, use this API. Reset will not alter the Picker's initialization state. It is purely a UI reset.
//Reset Picker API
FileSpin.resetPicker();
minimizePicker API
Use this API to programmatically minimize Picker modal and place it at bottom-right of user window.
//Minimize Picker Modal
FileSpin.minimizePicker();
maximizePicker API
Use this API to programmatically maximize a minimized Picker modal.
//Maximize Picker Modal
FileSpin.maximizePicker();
delete API to delete uploaded files
Use this API to delete uploaded files in one upload session.
This API takes three parameters:-
Upload ID
, a unique ID that is returned when you open the Upload dialog withFileSpin.initPicker()
API- A list of
Asset IDs
- note that Asset ID is returned in thecomplete
upload event - A callback function as a third parameter to handle API call success or error
Example code to delete a file that was uploaded
//Initialize Picker and get an uploadID
var uploadID = FileSpin.initPicker({
uploadKey: "UPLOAD_KEY",
});
//setup Asset IDs list payload by listening to 'complete' event
//note that we are attempting to delete all the uploaded files here
// normally, this will not be the case
var file_ids;
FileSpin.on("complete", function (data) {
file_ids = data.files.map(function (item) {
return item.id;
});
});
//trigger delete with a delete button click and call the 'delete' API
document.getElementById("delete-button").onclick = function (e) {
FileSpin.delete(uploadID, file_ids, function (err, response) {
if (err) {
// delete failed
// err will be "UPDATE_UNAUTHORIZED" or "UPDATE_FAILED"
} else {
// delete succeeded
}
});
return false;
};
Picker configuration
The Picker can be initialized with the following parameters.
Only the uploadKey
is mandatory, all other parameters are optional.
By default, the FileSpin widget will allow users to upload local device. Dropbox uploads require additional setup (see Dropbox Support below).
Parameter | Description |
---|---|
uploadKey | required , your uploadKey |
providers | Valid options are local , weburl , dropbox , googledrive , box , flickr , onedrive . To customize which providers to show, provide an array of valid values |
maxFilesize | The maximum file size to allow (in MB, can be a float, like 250.5). Default is 5000 (5 GB). |
minFilesize | The minimum file size to allow (in MB, can be a float, like 0.01). Default is 0.01 (10 KB). |
maxFiles | The maximum number of files allowed. Default is 100. |
allowedTypes | An array of extensions allowed for upload. Example: ["jpg","png"] |
autoUpload | default false. if set to true, once a file is selected in the picker for any provider it will trigger the upload immediately. |
maximizeOnOpen | default is false. if set to true, picker modal will fill the viewing area |
display | if set to false, the picker is accessible only via its API, the dialog won't display. Default is true |
minimizeOnUpload | if set to true, when user clicks Upload, Picker will be minimized and placed at bottom-right of user window |
hideOnUpload | if set to true, when user clicks Upload, Picker is hidden immediately but uploads continue and events are fired as usual. Default is false |
hideAfterUpload | if set to true, the Picker is hidden once all uploads are completed. Default is false |
css | provide headerColor and headerTextColor to control the Picker Window header colors |
lang | Sets the widget UI display language. Can be en , fr , de or es . If not set, defaults to the user browser's language where possible otherwise falls back to en (English). |
fileToReplaceId | Asset ID for file replace. Used when Picker is openeed in Asset replace mode |
serviceToken | Used when Picker is opened in Asset replace mode. See Asset replace mode for more |
Dropbox Support
Please note that in order to use dropbox
provider you must provide your own App Key and App Secret for OAuth2 flow. You can create an app and get the App Key and Secret from Dropbox App Console. After obtaining the details from Dropbox, you can specify the Dropbox App Key and Secret in your FileSpin Account Authorization Settings.
Picker configuration with all options
Here is a sample initPicker
API with all available options set to their defaults (excluding Asset replace mode
).
//Initialize Picker with all available options
FileSpin.initPicker({
uploadKey: "UPLOAD_KEY",
lang: "en", //Picker Dialog language - en, fr, de, es, zh, ja
providers: ["local", "weburl", "flickr", "box", "onedrive", "googledrive"],
maxFilesize: 5000,
minFilesize: 0.01,
maxFiles: 100,
allowedTypes: ["jpg", "png", "gif", "mp4", "wav", "mp3"],
css: { headerColor: "#fff", headerTextColor: "#000" },
display: true,
maximizeOnOpen: true,
minimizeOnUpload: false,
hideOnUpload: false,
hideAfterUpload: false,
autoUpload: false,
});
Picker Events
"start" event - JSON Sample
{
"provider": "local",
"files": [
{
"name": "sample.pdf",
"size": 884888
}
]
}
"complete" event - JSON Sample
{
"provider": "local",
"files": [
{
"id": "54dcbfbe2b124361a6ff4c62814789c7",
"name": "sample.pdf",
"size": 884888,
"success": true,
"message": "UPLOAD_SUCCESS"
}
]
}
When users upload files using filespin.js, it will emit start
and complete
events detailed below:-
Event | Description |
---|---|
ready |
raised when the Picker Dialog is ready and displayed. This event does not supply any data. |
close |
raised when the Picker Dialog is closed by user. This event does not supply any data. |
start |
raised when a user has initiated upload of a file. This will not be triggered for Cloud Uploads. |
complete |
raised when an upload has finished, whether error or success. If upload is successful for a file, a unique Asset ID is returned in id. |
Listening to Picker Events
To listen for events, use the FileSpin.on API. You can listen to start
, complete
or all events using the special *
event.
//listen to 'start' event
FileSpin.on("start", function (data) {
console.log(data);
});
//listen to 'complete' event
FileSpin.on("complete", function (data) {
console.log(data);
});
//listen to all events
FileSpin.on("*", function (data, eventName) {
console.log(eventName, "triggered with data", data);
});
//Stop listening to 'complete' event
FileSpin.off("complete", myEventHandler);
Event data JSON format and samples
"complete" event - Upload success JSON Sample
{
"provider": "local",
"files": [
{
"id": "54dcbfbe2b124361a6ff4c62814789c7",
"name": "sample.pdf",
"size": 884888,
"success": true,
"message": "UPLOAD_SUCCESS"
}
]
}
Upload events raised provide JSON formatted data. The data format is intentionally simple and the keys are as below:-
Key | Description |
---|---|
provider | source where files were picked from, it is one of the valid provider values |
files | list of files |
Event data samples for start
event raised when upload starts and complete
event raised when upload completes are shown in the code samples to the right.
Upload failures
"complete" event - Upload failed JSON Sample
{
"provider": "local",
"files": [
{
"id": null,
"name": "sample.pdf",
"size": 884888,
"success": false,
"message": "UPLOAD_FAILED"
}
]
}
"complete" event - Upload unauthorized JSON Sample
{
"provider": "local",
"files": [
{
"id": null,
"name": "sample.pdf",
"size": 884888,
"success": false,
"message": "UPLOAD_UNAUTHORIZED"
}
]
}
When uploads fail, it could be due to any of the following reasons:-
- File upload is not authorized for the website
- Picker was initialized with incorrect Upload Key
- Network or server error
For network or server error, "message" will be set to UPLOAD_FAILED
. In both failure cases, "id" is null
and "success" is false
.
For unauthorized or incorrect upload key, message
will be set to UPLOAD_UNAUTHORIZED
.
Picker Replace mode
Using Picker's Asset replace mode
you can replace a file that was uploaded earlier. In order to use this mode, you'll need:-
- ID of the file you want to replace
uploadKey
to initialize the PickerserviceToken
to open Picker in replacement mode
How to get the ServiceToken
serviceToken
is a short-lived token that must be retrieved using a API call to FileSpin Service. Call the API by supplying your API_KEY
and scope=EDIT_ASSET
parameter. cURL example is shown below:-
curl -X "GET" \
"https://app.filespin.io/api/v1/authentication/service_token?scope=EDIT_ASSET" \
-H "X-FileSpin-Api-Key:API_KEY"
Using ServiceToken in Picker for replacing a file
The following code sample shows how to use ServiceToken to start a file replace.
FileSpin.initPicker({
uploadKey: "UPLOAD_KEY",
serviceToken: "SERVICE_TOKEN",
fileToReplaceId: "REPLACEABLE_ASSET_ID",
});
Save form data
Sometimes you may wish to store additional data with files that users upload such as form data or custom JSON data. The FileSpin.update API allows you to easily do this. The API takes three parameters:-
Upload ID
, a unique ID that is returned when you open the Upload dialog withFileSpin.initPicker()
API- A dictionary object with
Asset ID
as key and JSON data as value - note that file ID is returned in thecomplete
upload event - A callback function as a third parameter to handle API call success or error
Example that shows how to save some data with a file including searcheable keywords
//Initialize Picker and get an uploadID
var uploadID = FileSpin.initPicker({
uploadKey: "UPLOAD_KEY",
});
//prepare JSON data you want to save with the file
//use "filespin_search_txt" to add searcheable keywords
var payload = {
"Asset ID 1": {
foo: "bar",
filespin_search_txt: "sample search keywords",
},
"Asset ID 2": { foo: "bar" },
};
//Save the data
FileSpin.update(uploadID, payload, function (err) {
if (err) {
// data update failed
// err will be "UPDATE_UNAUTHORIZED" or "UPDATE_FAILED"
} else {
// data storage succeeded
}
});
If filespin_search_txt
is present in the JSON data, it is treated as a special key whose value will be indexed for search using Search API.
You can update arbitrary data against all or any file id returned in the complete
event. Simply pass the data against each file id you would like to be updated.
JSON Schema for Custom Data
FileSpin optionally supports JSON Schema for Asset Form Data. Assigning schema to asset data enables versatile field-based search and additional data validations.
Once Asset schemas have been setup for an account, you can pass the schema id __data_schema_id
as shown below along with form data to automatically assign a schema to the asset data.
//pass "__data_schema_id" to assign a JSON Schema for the asset data
var payload = {
"Asset ID 1": {
fieldA: "value1",
fieldB: "value2",
"__data_schema_id": 1,
},
"Asset ID 2": {
fieldA: "value11",
fieldB: "value22",
__data_schema_id: 1,
},
};
Note that __data_schema_id
is a reserved key to indicate the schema to be used and will not be stored as part of the form data.
Showing a thumbnail after upload
To display a thumbnail of the uploaded file immediately within your web page, use the On-demand Image URL:-
<img
src="https://cdn.filespin.io/api/v1/assets/{ASSET_ID}/conversions?resize=WIDTH,HEIGHT"
/>
Replace {ASSET_ID} with the actual file ID and set the resize WIDTH
, HEIGHT
parameters.
An example on-demand URL would look like below:-
<img
src="https://cdn.filespin.io/api/v1/assets/0c3c6d026858460abc4de1dcb4de15ac/conversions?resize=180,180"
/>
Internationalization (i18n) of Picker
The following languages are supported out-of-the-box by File Picker UI.
Key | Description |
---|---|
English | en |
French | fr |
German | de |
Spanish | es |
Italian | it |
Chinese | zh |
Japanese | ja |
The Picker will detect the browser's language and will set the language automatically with English as the default fallback. This behavior can be overridden by passing the lang
parameter to the initPicker
API.
Opening Picker in a specific language
To open Picker in a specific language, use lang
parameter.
FileSpin.initPicker({
uploadKey: "UPLOAD_KEY",
lang: "zh", //sets chinese language for the interface
});
Web Connector Widget
FileSpin Connector simplifies integration of FileSpin.io with your web application so that users can search and use images, videos and documents hosted in FileSpin.io from right within your application.
With FileSpin Connector, users can:-
- Search for files using image annotation search. For example, they can search for all images that contain, say,
Eiffel tower
- Find files using advanced search with various parameters such as file name, size, etc
- Preview images and videos
- Select files for use within your application, such as embedding thumbnails and videos
- Dynamically create secure File Distributions that can be used within your application
Get started with FileSpin Connector
Start by including filespin.js just before the closing body
tag in your HTML.
<script type="text/javascript"
src="https://js.filespin.io/embed/dist/filespin.min.js"></script>
Then, initialize Connector with Service Token. For obtaining a ServiceToken, see below Get Service Token section.
FileSpin.initConnector({
serviceToken: "INSERT_YOUR_SERVICE_TOKEN",
});
How to get the ServiceToken
serviceToken
is a short-lived token that must be retrieved using a API call to FileSpin.io Service. Call the API by supplying your API_KEY
and scope=READ_ASSET
. cURL example is shown below:-
curl -X "GET" \
"https://app.filespin.io/api/v1/authentication/service_token?scope=READ_ASSET" \
-H "X-FileSpin-Api-Key:API_KEY"
The following code sample shows how to use ServiceToken to initialize the connector.
FileSpin.initConnector({
serviceToken: "INSERT_YOUR_SERVICE_TOKEN",
});
Connector configuration
The Connector specific options are listed below. serviceToken
is mandatory. All other parameters are optional.
Parameter | Type | Description |
---|---|---|
serviceToken | string | (required) mandatory to initialize Connector |
lang | string | (optional) Sets the Connector language. Can be en , fr , de or es . If not set, defaults to the user browser's language where possible otherwise falls back to en (English). |
maxSelection | integer | (optional) Maximum files a user can select. Default is 30 (Connector has a limit of 30 files, any higher value will be reset to 30) |
hideOnMaxSelect | boolean | (optional) Hide Conenctor when maxSelection is reached. Default is false. |
dialogTitle | object | (optional) Customize dialog title. Default is FileSpin Connector . See below for object structure. |
Connector dialog title in multiple languages
Supply custom dialog title in multiple languages like below:-
{
"en": "Dialog title english",
"fr": "Dialog title french"
}
Title will be set based on user browser's language or based on lang
parameter. Default fallback is english title FileSpin Connector
.
Connector with all options
Here is a code sample that initializes the Connector with all available options set to their defaults.
FileSpin.initConnector({
serviceToken: "INSERT_YOUR_SERVICE_TOKEN",
lang: "en", //Connector Dialog language - en, fr, de, es, zh, ja
maxSelection: 30,
hideOnMaxSelect: false,
dialogTitle: {
en: "FileSpin Connector",
},
});
Connector - User File Selection
Users can select files listed in the Connector by clicking on the thumbnail.
Each file selected by user triggers a connector-file-selected
event. By listening to this event, you can receive the selected file's details and take action within your application (such as adding selected files to user's basket within your application).
For more details about events, see Connector Events.
Connector API
Connector provides a rich set of APIs so you can control how it works to suit your web application needs.
initConnector
This API is the starting point for Connector. Use this to initialize the Connector. It uses sensible default options which can be overridden.
initConnector with default options
Initialze Connector with default options. serviceToken
is a mandatory parameter.
FileSpin.initConnector({
serviceToken: "INSERT_YOUR_SERVICE_TOKEN",
});
initConnector with callback on ready
FileSpin.initConnector(settings, function() {})
API can be used to safely take actions only when the Connector is ready. You can pass a callback function as the second argument which will be called when the Connector is ready.
Below code initializes the Connector, and using the callback function when the Connector is ready, it displays an alert and shows the Connector.
FileSpin.initConnector(
{
serviceToken: "INSERT_YOUR_SERVICE_TOKEN",
},
function () {
//this function is called when Connector is initialized and ready
alert("Connector ready!");
}
);
showConnector
Use this API to programmatically show the Connector dialog.
FileSpin.showConnector();
hideConnector
Use this API to programmatically hide the Connector dialog.
FileSpin.hideConnector();
resetConnector
This API resets the Connector by clearing current search and any file selections. It does not change the initialization parameters.
FileSpin.resetConnector();
updateConnectorSettings
Convenience method to update Connector with the new settings without reloading it.
FileSpin.updateConnectorSettings(connectorSettings);
connectorSettings
are the same as for initConnector
API as defined in Connector configuration above.
Here is a sample connectorSettings
:-
FileSpin.updateConnectorSettings({
serviceToken: "INSERT_YOUR_SERVICE_TOKEN",
lang: "en",
maxSelection: 30,
hideOnMaxSelect: false,
dialogTitle: {
en: "FileSpin Connector",
},
});
Connector Events
When users select and deselect files or create File Distributions, filespin.js will emit events as detailed below:-
Event | Description |
---|---|
ready |
raised when the Connector Dialog is ready and displayed. This event does not supply any data. |
closeConnector |
raised when the Connector Dialog is closed by user. This event does not supply any data. |
connector-file-selected |
raised when the user selects a file |
connector-file-deselected |
raised when the user deselects a file |
Listening to Connector Events
To listen to events, use the FileSpin.on API. You can listen to a specific event or all events using the special *
event.
//listen to 'connector-file-selected' event
FileSpin.on("connector-file-selected", function (data) {
console.log(data);
//Perhaps, hide the Connector once a file is selected
FileSpin.hideConnector();
});
//listen to all events
FileSpin.on("*", function (data, eventName) {
console.log(eventName, "triggered with data", data);
});
Connector Event Data
The events provide file data in the following formats:-
Event | Data Format |
---|---|
connector-file-selected | Standard Asset Data Format |
connector-file-deselected | Standard Asset Data Format |
Internationalization (i18n) of Connector
The following languages are supported out-of-the-box by File Connector:-
English | en |
French | fr |
German | de |
Spanish | es |
Italian | it |
Chinese | zh |
Japanese | ja |
The Connector will detect the browser's language and will set the language automatically with English as the default fallback. This behavior can be overridden by passing the lang
parameter to the initConnector
API.
Opening Connector in a specific language
To open Connector in a specific language, use lang
parameter.
FileSpin.initConnector({
serviceToken: "INSERT_YOUR_SERVICE_TOKEN",
lang: "zh", //sets chinese language for the interface
});
Image Transformations
FileSpin provides two ways to transform and display images:-
- On-demand Image Transformation that can be requested with dynamic URL parameters. These are image transformations are generated and supplied on-the-fly
and do not use any storage quota. For example, when you request a 300x300 resize of an image asset via a URL
such as
https://cdn.filespin.io/api/v1/assets//conversions?resize=300,300
, the resize transformation is generated on-demand and delivered instantly). - Static Image Conversion which are presets configured in an account to be generated and stored in storage before they can be requested
On-demand Image Transformations
Get started with on-demand images
Use the Asset ID and request a image transformation like below:-
https://cdn.filespin.io/api/v1/assets/{ASSET_ID}/conversions?resize=200,200
Where resize=200,200
requests a resized image of width 200px and height 200px.
By default, the returned images will be webp
or avif
format for supported browsers with JPG
as fallback format. This can be changed using the format
option.
Here is a sample on-demand image request URL used in a img
tag:-
<img
src="https://cdn.filespin.io/api/v1/assets/0c3c6d026858460abc4de1dcb4de15ac/conversions?resize=200,200"
/>
The following sections describe all the image transformations supported.
ODI Limitations
- On-demand image (ODI) is available for assets after they are processed. Availability of ODI for an asset is indicated with the ON_DEMAND_IMAGE key in addons_info. See Asset Data Format for more info.
- For large images and cloud files, FileSpin would return a low-resolution image if ODI is requested immediately after upload. A short expiration time will be returned in HTTP response header in this case. The ODI URL will be updated with a high-resolution image after the file is processed.
resize
Request a resized image that fits in a rectangle of given width and height without changing the aspect ratio.
Transformation | Examples | Description |
---|---|---|
resize=width,height |
resize=100,100 |
request a resized image that fits in a rectangle of given width,height |
resize=width,height,fill:color |
resize=100,150,fill:red resize=100,100,fill:blue |
resize and fill any gaps with given color |
The transformation parameters are described below:-
Parameter | Description |
---|---|
width | width of the transformation requested. Specify 0 (zero) for original source image width or the maximum allowed (2048) |
height | height of the transformation requested. Specify 0 (zero) for original source image height or the maximum allowed (1536) |
fill:color | (optional) fill color to fit to the specified size when preserving aspect ratio. color can be auto , transparent or HTML color name such as red or hexadecimal color code such as FF0000 |
crop
Get a cropped region from the original image, with optional face detection.
Transformation | Examples | Description |
---|---|---|
crop=left,top,width,height |
crop=150,170,200,50 |
request a cropped region from the original image |
The transformation parameters are described below:-
Parameter | Description |
---|---|
left | left pixel co-ordinate for the crop |
top | top pixel co-ordinate for the crop |
width | width of the cropped image |
height | height of the cropped image |
watermark
Watermarked image transformations can be done in two ways:-
- Providing dynamic watermark options such as watermark image, placement, etc as URL parameters
- Using the pre-defined watermark options already setup in the user's account settings
Watermark option can be combined with all other transformation options such as resize
, crop
, etc.
Using dynamic watermark options
watermark={watermark_image},{x},{y}{opacity},{width_scale},{height_scale}
Generate a watermarked image transformation by providing all the watermark options as URL parameters. This method allows you to apply different watermarks for the same image depending on the use case.
Parameter | Description |
---|---|
watermark_image | Watermark image URL such as http://www.example.com/logo.png |
x | Horizontal watermark position starting at left: integer like 0 or 10 - negative value such as -0 will start placement at right, center - places watermark in the center, repeat - repeats the watermark horizontally |
y | Vertical watermark position starting at top : integer like 0 or 10 - negative value such as -0 will start placement at bottom, center - places watermark in the center, repeat - repeats the watermark vertically |
opacity | watermark image transparency, 0 is fully opaque, 100 is fully transparent, all values in between to alter opacity |
width_scale | (optional) percentage of the width of the image the watermark should fit-in. For example 20 would scale the watermark to fit within 20% of the image's width. Note: watermark aspect ratio will be preserved |
height_scale | (optional) percentage of the height of the image the watermark should fit-in |
Examples
The complete URL would look like:- https://cdn.filespin.io/api/v1/assets/0c3c6d026858460abc4de1dcb4de15ac/conversions?resize=1200,1200&watermark=https://app.filespin.io/static/img/logo.png,-0,-0
watermark=https://app.filespin.io/static/img/logo.png,-0,-0,0
Uses FileSpin logo as watermark and places it to the bottom right of the image. Watermark image is used with the original size. Note tha use of -0,-0
to place the watermark at the bottom right of the image.
The complete URL would look like:- https://cdn.filespin.io/api/v1/assets/0c3c6d026858460abc4de1dcb4de15ac/conversions?resize=1200,1200&watermark=https://app.filespin.io/static/img/logo.png,-0,0,0,40,40
watermark=https://app.filespin.io/static/img/logo.png,-0,0,0,40,40
Uses FileSpin logo as watermark and places it to the right top of the image. Watermark takes 40% of the image's width and height and opacity is 0
for fully opaque.
The complete URL would look like:- https://cdn.filespin.io/api/v1/assets/0c3c6d026858460abc4de1dcb4de15ac/conversions?resize=1200,1200&watermark=https://app.filespin.io/static/img/logo.png,repeat,-0,0,40,40
watermark=https://app.filespin.io/static/img/logo.png,repeat,-0,0,40,40
Uses FileSpin logo as watermark and repeats it horizontally at the bottom. Watermark takes 40% of the image's width and height.
Using User's default watermark
The complete URL would look like:- https://cdn.filespin.io/api/v1/assets/0c3c6d026858460abc4de1dcb4de15ac/conversions?resize=1200,1200&watermark=https://app.filespin.io/api/v1/user/watermark/{USER_ID},0,0,0
watermark=https://app.filespin.io/api/v1/user/watermark/{USER_ID},0,0,0
Where {USER_ID}
should be replaced with the user's ID. Note that https://app.filespin.io/api/v1/user/watermark/{USER_ID} is accessible publicly.
This option applies the watermark setup in the user's account settings.
background color
Fill transparent parts of a PNG image with a specified color. This is useful when you want fill an image that has transparent background with a specific color dynamically to match the web page style (such as in retail product image pages).
Example
Consider this original PNG image with transparent background. As it has transparent background, you see the page color as the background color.
Below are some transformations with bgcolor
that fills the background transparency with a specified color.
Transformation | Examples | Description |
---|---|---|
bgcolor=f00000 |
request a image with red background | |
bgcolor=008080 |
request a image with teal background |
The transformation parameters are described below:-
Parameter | Description |
---|---|
bgcolor=color | specify the hex color code (6 characters - RRGGBB ). |
quality
Specify the quality of the returned image (a value from 1 to 100). If not specified, default quality of 90 is applied. Quality determines the returned file size in bytes. Lower quality will yield smaller file size and hence faster page loads.
Transformation | Description |
---|---|
quality=integer |
request a image transformation with a specific quality |
The transformation parameters are described below:-
Parameter | Description |
---|---|
quality | a value from 1 to 100. Default is 90 |
format
Specify the format of the returned image. If not specified, format is implicitly set to avif
or webp
for supported browsers with JPG
as fallback format.
Transformation | Examples | Description |
---|---|---|
format=type |
format=png |
request a png image |
format=type&resize=width,height |
format=png&resize=100,100 |
request resized png image |
The transformation parameters are described below:-
Parameter | Description |
---|---|
type | webp , avif , png , jpg or gif |
trim
Trim removes the same color pixels from the edges of the image. This is useful when you want to remove the white space around an image.
Transformation | Examples | Description |
---|---|---|
trim=tolerance |
trim&resize=100,100 trim=10&resize=100,100 |
request a trimmed image with normal tolerance |
The transformation parameters are described below:-
Parameter | Description |
---|---|
tolerance | can be 0 to 10, where 0 compares edge pixel colors strictly and 10 treats them equal if they are close enough. A tolerance of 10 will trim even if they are small color gradient in surrounding pixels. |
rotate
Rotate the image anti-clockwise by an angle.
Transformation | Examples | Description |
---|---|---|
rotate=angle |
rotate=90&resize=100,100 |
request a image rotated 90 degrees anti-clockwise |
rotate=angle&resize=width,height |
rotate=180&resize=100,100 |
request a 180 degress rotated resized image |
The transformation parameters are described below:-
Parameter | Description |
---|---|
angle | can be can be 90 , 180 or 270 |
flip
Flip an image left to right (horizontal) or top to bottom (vertical).
Transformation | Examples | Description |
---|---|---|
flip=type |
flip=v&resize=100,100 |
request a image flipped vertically |
flip=type&resize=width,height |
flip=h&resize=100,100 |
request a image flipped horizontally and resized |
The transformation parameters are described below:-
Parameter | Description |
---|---|
type | v for vertical flip, h for horizontal flip |
Effects
Effects are transformations applied after all other conversion options such as width, height, etc are applied.
Parameter | Description |
---|---|
effect | can be grayscale , blur , roundcorner |
grayscale
Request a grayscale image
Transformation | Example | Description |
---|---|---|
effects=grayscale |
request a grayscale image | |
effects=grayscale&resize=200,200 |
request resized grayscale image |
blur
Request a blurred image
Transformation | Example | Description |
---|---|---|
effects=blur&resize=100,100 |
request a blurred image with default blur value of 20 | |
effects=blur:5&resize=200,200 |
request resized blurred image with blur value of 5 |
Parameter | Description |
---|---|
blur:value |
value can be from 0 to 150. Default blur is 20 |
roundcorner
Request a image with round corner
Transformation | Example | Description |
---|---|---|
effects=roundcorner&resize=100,100 |
request a roundcorner image | |
effects=roundcorner:50:128:128:128&resize=100,100 |
request roundcorner resized image with a radius of 50 and gray background behind rounded corner |
Parameter | Description |
---|---|
roundcorner:radius:r:g:b |
radius controls the amount of roundedness, defaults to 20. r,g,b are the red, blue and green color values to fill the background behind the rounded corners. The values default to 255,255,255 (white) |
Multiple effects
Combine multiple effects
Transformation | Example | Description |
---|---|---|
effects=grayscale,roundcorner:30&resize=200,200 |
request grayscale roundcorner resized image | |
effects=blur:5,roundcorner&resize=200,200 |
request roundcorner blurred resized image |
Signed URL for image transformations
Signed URL with php
<?php
$api_key = '0c3c6d026858460abc4de1dcb4de15ac'
$string_to_sign = '0c3c6d026858460abc4de1dcb4de15ac?resize=300,300&expiry=1452894790&accessId=IZJTAMBQGAYDAMBQGAYDAMBQGAYDANKT'
$signature = urlencode(base64_encode(hash_hmac('sha1', $string_to_sign, $api_key, true)));
$signed_url = 'https://cdn.filespin.io/api/v1/conversions/'.$string_to_sign.'&signature='.$signature
?>
Signed URL with python
import base64, hmac, hashlib, urllib
from six import text_type, b
API_KEY = '0c3c6d026858460abc4de1dcb4de15ac'
string_to_sign = '0c3c6d026858460abc4de1dcb4de15ac?resize=300,300&expiry=1452894790&accessId=IZJTAMBQGAYDAMBQGAYDAMBQGAYDANKT'
signature = urllib.quote_plus(base64.urlsafe_b64encode(hmac.new(b(API_KEY), text_type(string_to_sign).encode('utf-8'), hashlib.sha1).digest()))
signed_url = '%s%s&signature=%s' % ('https://cdn.filespin.io/api/v1/conversions/',string_to_sign,signature)
Signed URL with java
import java.security.SignatureException;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
String api_key = "0c3c6d026858460abc4de1dcb4de15ac";
String string_to_sign = "0c3c6d026858460abc4de1dcb4de15ac?resize=300,300&expiry=1452894790&accessId=IZJTAMBQGAYDAMBQGAYDAMBQGAYDANKT";
SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(), "HmacSHA1");
Mac mac = Mac.getInstance("HmacSHA1");
mac.init(api_key);
byte[] hmac = mac.doFinal(string_to_sign.getBytes());
String signature = Encoding.EncodeBase64(hmac);
String signed_url = "https://cdn.filespin.io/api/v1/conversions/" + string_to_sign + "&signature=" + signature;
If Secure On-demand Images
option is enabled in your settings, then you must use signed URLs for on-demand images.
Steps to generate signed URL
Besides the File Id and size parameters, you'll need the below:-
Parameter | Type | Description |
---|---|---|
API Key | string | Your API Key. This is available in your Authorization Settings page. |
EXPIRY | integer | Seconds since Unix Epoch time. |
ACCESS_ID | string | Access Id that must be used to sign URLs. You can obtain your account's Access Id from the Authorization Settings page. |
Signing a image URL is done by setting an expiry and signing the URL using your FileSpin API_KEY and Access Id. The signing process is as below:-
- Take the URL part staring with the ASSET_ID, excluding the signature part, like
0c3c6d026858460abc4de1dcb4de15ac?resize=300,300&expiry=1452894790&accessId=IZJTAMBQGAYDAMBQGAYDAMBQGAYDANKT
, where expiry is seconds since Epoch time - Using your API Key, Access Id and the above URL part as the string-to-sign, calculate the HMAC signature
- Encode the signature to a base64 string, then URL encode the resulting string and append it to the URL as
signature
query parameter value
Example signed image URL
https://cdn.filespin.io/api/v1/assets/0c3c6d026858460abc4de1dcb4de15ac/conversions?resize=300,300&expiry=1452894790&accessId=IZJTAMBQGAYDAMBQGAYDAMBQGAYDANKT&signature=vsR0_NFfeLEJPc8MXWMh2xI2Qvg%3D
Downloadable URL for image transformations
These options allow you to set additional URL parameters that sets Content-Disposition
HTTP headers such that when user accesses the URL via a browser, the image transformation downloads to their device as a file with appropriate extension.
The parameters are described below:-
Parameter | Description |
---|---|
delivery | Set this to download |
dl_prefix | Set this to the name of the downlod file without the extension |
format | Mandatory parameter for image downloads to set the format of the file. Do not set this if already set via format option |
Example downloadable image URL
The URL below will download a 300x300 image transformation called testimage.jpg
to user's device.
https://cdn.filespin.io/api/v1/assets/0c3c6d026858460abc4de1dcb4de15ac/conversions?resize=300,300&delivery=download&dl_prefix=testimage&format=jpg
Static Image Conversions
Static Image Conversions are image sizes that are pre-generated and stored in cloud storage before they can be delivered. Usually, these are image transformations that cannot be done on-demand (for example, Zoomable image conversion).
Static Image Conversions can be setup within an account's Image Settings page to be generated automatically on image uploads.
They can also be done via /process
API call. See Asset Processing API
section on how to use the /process
API.
Requesting a static image conversion for display
To request a static image conversion, use the same URL as the On-demand image with the static image conversion name appended, like
/api/v1/assets/{ASSET_ID}/conversions/{conversion_name}?resize=300,300
where, conversion_name
is the custom name specified for the static conversion in your Image Settings.
For example, if the account has a static image conversion called black_and_white
, this can be requested via:
https://cdn.filespin.io/api/v1/assets/0c3c6d026858460abc4de1dcb4de15ac/conversions/black_and_white
A 300x300 resized static conversion can be requested via:
https://cdn.filespin.io/api/v1/assets/0c3c6d026858460abc4de1dcb4de15ac/conversions/black_and_white?resize=300,300
Requesting a non-public static image conversion
If a static image conversion is not public, the request must be authenticated. This can be done in two ways:-
- by passing
X-FileSpin-Api-Key:{API_KEY}
if the request is made from a server-side application (see Authentication) - by passing
Authorization: Bearer {JWT}
header in the request if the request is made from a client-side application (see JWT Authentication) - by signing the request URL. A signed URL can be generated using the same method detailed for On-demand Image Conversion. Please see Signed URL for image transformations.
Video Transcoding & Streaming
FileSpin provide extensive video transcoding capabilities to process many video input formats into standard output formats suitable for various devices.
Following outputs are supported:-
- Low-resolution video (360p)
- Standard Definition (480p)
- High Definition (720p)
- Full-HD (1080p)
- Ultra-HD (4k)
- Adaptive Bitrate Streams (HLS)
In addition to above, FileSpin supports:-
- Video Previews with SD, HD, UHD presets
- Video watermarking for all outputs
- Clip Creation API for creating video clips
- Video Storyboard Addon and other video addons such as ML-based video subtitles
- Global video CDN for delivery of videos
Transcoding a video
FileSpin provides a number of ways to transcode videos:-
- Enable trancodes in account's video settings to generate transcodes when videos are uploaded
- Request a transcode to be generated via
/process
API at any time after a video is ingested (seeVideo Transcoding API
underAsset Processing API
section for more details) - Clip creation API to create clips of specified video segments. Please see
Video Clip Creation API
underAsset Processing API
section for more details.
Streaming a Video
Example Video stream URL
https://cdn.filespin.io/api/v1/assets/f99255d2bf8142b29561641491e9940c/transcodes/480p-video.mp4
Example Video Thumbnail/Poster Image URL
https://cdn.filespin.io/api/v1/assets/f99255d2bf8142b29561641491e9940c/conversions?resize=800,600
Video transcodes are stored in cloud storage and can be requested via FileSpin CDN for global playback with ultra-low latency. Video Stream URL for playback takes the below format:-
Video Stream URL
https://cdn.filespin.io/api/v1/assets/{ASSET_ID}/transcodes/{TRANSCODE_KEY}
Poster image URL
https://cdn.filespin.io/api/v1/assets/{ASSET_ID}/conversions?resize={width},{height}
Parameter | Description |
---|---|
{ASSET_ID} | Asset ID, 32 character alphanumeric UUID |
{TRANSCODE_KEY} | 480p-video.mp4 , 720p-video.mp4 , 720p-wm-video.mp4 or any available video transcode for video stream url. Use playlist.m3u8 for Adaptive bitrate/HLS transcode. |
Note: Poster image is supplied as On-demand image. All On-demand Image conversions can be applied to this image.
Embedding Video in a Web page
Displaying a video in a webpage is as simple as providing the correct URLs.
<video
src="https://cdn.filespin.io/api/v1/assets/f99255d2bf8142b29561641491e9940c/transcodes/480p-video.mp4"
type="video/mp4"
poster="https://cdn.filespin.io/api/v1/assets/f99255d2bf8142b29561641491e9940c/conversions?resize=800,600"
width="800"
></video>
HLS Video playback
Displaying a HLS video requires you to provide a stream info file.
To stream video in HTTP Live Streaming (HLS) format, the video URL must be provided as below:
HLS Video URL
https://cdn.filespin.io/api/v1/assets/{ASSET_ID}/transcodes/playlist.m3u8
FileSpin dynamically generates and supplies playlist.m3u8
if HLS streams have been generated for a video.
Signed URL for video transcodes
Code example in php
<?php
$api_key = '678d1dbb934c4a42aa4833e893346857'
$string_to_sign = 'f99255d2bf8142b29561641491e9940c/transcodes/480p-video.mp4?expiry=1452894790&accessId=IZJTAMBQGAYDAMBQGAYDAMBQGAYDANKT'
$signature = urlencode(base64_encode(hash_hmac('sha1', $string_to_sign, $api_key, true)));
$signed_url = 'https://cdn.filespin.io/api/v1/assets/'.$string_to_sign.'&signature='.$signature
Code example in python
import base64, hmac, hashlib, urllib
from six import text_type, b
API_KEY = '678d1dbb934c4a42aa4833e893346857'
string_to_sign = 'f99255d2bf8142b29561641491e9940c/transcodes/480p-video.mp4?expiry=1452894790&accessId=IZJTAMBQGAYDAMBQGAYDAMBQGAYDANKT'
signature = urllib.quote_plus(base64.urlsafe_b64encode(hmac.new(b(API_KEY), text_type(string_to_sign).encode('utf-8'), hashlib.sha1).digest()))
signed_url = '%s%s&signature=%s' % ('https://cdn.filespin.io/api/v1/assets/',string_to_sign,signature)
Code example in java
import java.security.SignatureException;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
String api_key = "678d1dbb934c4a42aa4833e893346857";
String string_to_sign = "f99255d2bf8142b29561641491e9940c/transcodes/480p-video.mp4?expiry=1452894790&accessId=IZJTAMBQGAYDAMBQGAYDAMBQGAYDANKT";
SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(), "HmacSHA1");
Mac mac = Mac.getInstance("HmacSHA1");
mac.init(api_key);
byte[] hmac = mac.doFinal(string_to_sign.getBytes());
String signature = Encoding.EncodeBase64(hmac);
String signed_url = "https://cdn.filespin.io/api/v1/assets/" + string_to_sign + "&signature=" + signature;
In order to use a signed URL that provides URL expiry and security, you must generate the URL by setting an expiry and signing the URL using your FileSpin API_KEY and Access Id.
Besides the File Id and the transcode type (such as 480p-video.mp4), you'll need the below:-
Parameter | Type | Description |
---|---|---|
API Key | string | Your API Key. This is available in your Authorization Settings page. |
EXPIRY | integer | Seconds since Unix Epoch time. |
ACCESS_ID | string | Access Id that must be used to sign URLs. You can obtain your account's Access Id from the Authorization Settings page. |
The signing process is as below (see code samples to the right):-
- Take the URL part staring with the FILE_ID and add an expiry in seconds since Epoch time and your Access Id, like
678d1dbb934c4a42aa4833e893346857/transcodes/480p-video.mp4?expiry=1452894790&accessId=IZJTAMBQGAYDAMBQGAYDAMBQGAYDANKT
- Using your API Key and the above URL part as the string-to-sign, calculate the HMAC signature
- Encode the signature to a base64 string and append as signature query parameter value
Example of a signed video URL
https://cdn.filespin.io/api/v1/assets/f99255d2bf8142b29561641491e9940c/transcodes/480p-video.mp4?expiry=1452894790&accessId=IZJTAMBQGAYDAMBQGAYDAMBQGAYDANKT&signature=vsR0_NFfeLEJPc8MXWMh2xI2Qvg%3D
Downloadable URL for video transcodes
These options allow you to set additional URL parameters that sets Content-Disposition
HTTP header such that when user accesses the URL via a browser, the video transcode downloads to their device as a file.
The parameters are described below:-
Parameter | Description |
---|---|
delivery | Set this to download |
dl_prefix | Set this to the name of the downlod file without the extension |
Example downloadable video URL
The URL below will downloads the 480p watermarked video transcode called testvideo.mp4
to user's device.
https://cdn.filespin.io/api/v1/assets/f99255d2bf8142b29561641491e9940c/transcodes/480p-wm-video.mp4?delivery=download&dl_prefix=testvideo
API Overview
FileSpin exposes all its features via a comprehensive API. Use this API to manage Assets, Users, Asset Collections, Addons, etc.
Authentication
FileSpin API calls require a valid API Key or Authorization
HTTP Header.
Using API Key
Replace {API_KEY} with your API Key
curl -H "X-FileSpin-Api-Key:{API_KEY}"
Send API request with API key in request header like:-
X-FileSpin-Api-Key:{API_KEY}
Where {API_KEY} should be replaced with your API Key
Using JSON Web Token (JWT)
Replace {JWT} with the token from Login API response
curl -H "Authorization: Bearer {JWT}"
JSON Web Token (JWT) is an open standard (RFC 7519) for secure communication. You can use FileSpin JWT to create rich Web applications such as such as reactjs apps that run inside the web browser. The entire FileSpin API is available for use opening up the possibility to create custom web interfaces that suit your business needs.
Send API request with JWT in request header like:-
Authorization: Bearer {JWT}
Where {JWT} should be replaced with the token obtained via /login API.
Web Application Login & JWT
Web applications should use this API to retrieve JWT and user profile.
Login and obtain JWT and User profile
curl -X "POST" -H "Content-Type: application/json" \
-d '{ "email": "user@example.org",
"password": "PASSWORD"
}' https://app.filespin.io/api/v1/login
HTTP REQUEST
POST https://app.filespin.io/api/v1/login
HTTP HEADER
None
API PARAMETERS
Parameter | Type | Description |
---|---|---|
string | Login email ID | |
password | string | Login password |
API RESPONSE
A JSON with JWT and other user details.
Response with JWT
{
"user_id": 42,
"user_email": "user@example.org",
"username": "John Doe",
"jwt": "JWT",
"role_id": 1,
"role_name": "ADMIN",
"uploadkey": "ec5139a372f6478d97365ec0df9c9a814",
"notifications": ["Notification message 1"]
}
Parameter | Type | Description |
---|---|---|
jwt | string | JSON Web Token. Use this in API calls. See Authentication for details. |
user_id | string | Login email ID |
user_email | string | Login password |
username | string | User name as Firstname Lastname |
role_id | integer | User role ID |
role_name | string | User role name |
uploadkey | string | File Uploadkey for use in Picker |
notifications | string | List of notification messages since last login |
API Response Codes
API calls return the following HTTP response codes:
Code | Meaning |
---|---|
200 | OK -- Request was successful |
202 | Received -- Request was received successfully. Further processing may happen asynchronously. |
400 | Bad Request -- Request has incorrect parameters |
401 | Unauthorized -- Requested operation not permitted |
403 | Forbidden -- Request is not allowed for the API key |
404 | Not Found -- Requested resource is not found |
405 | Method Not Allowed |
422 | Unprocessable Content - Feature Not Available |
429 | Too Many Requests -- Slow down! |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |
Asset API
FileSpin exposes all its features via a comprehensive API. Use this API to manage Assets, Users, Asset Collections, Addons, etc.
Asset Data Format
FileSpin returns Asset data in a standard JSON format as below for all Asset API calls. In addition, data posted to your Webhooks will also be of this format.
Asset Data JSON Format - Example
{
"id": "99d819953914402babbdeb68337ea6a3",
"status": "OK",
"name": "sample.mov",
"size": 8836363,
"checksum": "5f5f26bd7c0f62c6e02e44c73d09734e",
"provider": "local",
"storage_type": "AMAZON_S3",
"bucket": "filespin-labs",
"key": "/99d819953914402babbdeb68337ea6a3/sample.jpg",
"public": false,
"content_type": "video/quicktime",
"creator_id": 272,
"upload_time": "2015-07-02T08:12:56Z",
"update_user_id": 272,
"update_time": "2015-07-02T08:12:56Z",
"upload_source": "upload.example.com",
"data_schema_id": 1,
"metadata": {
"width": 1200,
"height": 800,
"duration": 30
},
"data": {
"foo": "bar"
},
"conversions": {
"720p-video": {
"storage_type": "s3",
"bucket": "filespin-labs",
"key": "/99d819953914402babbdeb68337ea6a3/720p-video.mp4",
"width": 1280,
"height": 720,
"duration": 30,
"size": 716000,
"public": true,
"watermarked": false
},
"hls-video": {
"storage_type": "s3",
"bucket": "filespin-labs",
"key": "/99d819953914402babbdeb68337ea6a3/hls/playlist.m3u8",
"width": 1280,
"height": 720,
"duration": 30,
"size": 716000,
"public": true,
"watermarked": false
}
},
"addons_info": {
"ON_DEMAND_IMAGE": {
"available": true
}
}
}
JSON Parameters
Key | Value | Description |
---|---|---|
id | string | Asset's unique ID, 32 character alphanumeric UUID |
status | string | OK if Asset was saved successfully,NOT_READY if file is being saved, ERROR if the asset has any errors (such as , if it is not a image or a video). ARCHIVED if the asset is archived. An archived asset will be available in read-only mode and cannot be updated. |
event | string | file-saved, file-processed or file-data-updated |
name | string | File name |
size | integer | Size of file in bytes |
checksum | string | MD5 checksum |
provider | string | The source of the file, local or one of the supported cloud providers |
storage_type | string | Always AMAZON_S3 in this release |
bucket | string | S3 Bucket name |
key | string | S3 Object key for this file |
public | boolean | true if file is publicly accessible, false otherwise |
content_type | string | MIME type |
creator_id | integer | User Id of file owner |
update_user_id | integer | User Id of user updating file derivatives or file data |
upload_time | string | ISO 8601 datetime |
update_time | string | ISO 8601 datetime, when the file was last updated |
upload_source | string | where the file was sourced from |
data_schema_id | integer | JSON Schema Id for the asset data |
metadata | JSON | Depending on Addons enabled, file metadata is returned. For image/video files, width , height in pixels and duration in seconds are always returned |
data | JSON | Optional user-data stored along with an asset |
conversions | JSON | Standard image/video conversions and those generated by addons |
addon_info | JSON | Indicates which addons were processed for the asset |
errors | JSON | Errors if any while processing asset. This will be like: {"original": "Original file appears to be invalid!"} |
Asset Upload
Upload a single file and receive asset id (
sample.jpg
file should be present in the folder where the program is invoked)
curl -H "X-FileSpin-Api-Key:API_KEY" \
-X "POST" -F "file=@sample.jpg" \
https://app.filespin.io/api/v1/assets/new/content/original/upload
Upload multiple files in a single request (use file1, file2, file3, etc. as field names. Each file will result in a new asset being created)
curl -H "X-FileSpin-Api-Key:API_KEY" \
-X "POST" \
-F "file1=@sample1.jpg" \
-F "file2=@sample2.jpg" \
-F "file3=@sample3.jpg" \
/api/v1/assets/new/content/original/upload
Use this API to upload one or more files and create assets within FileSpin. Once asset has been created, custom metadata can be added to the asset using Asset Update Data
API.
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP REQUEST
POST https://app.filespin.io/api/v1/assets/new/content/original/upload (multipart/form-data)
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.
HTTP RESPONSE
Standard HTTP Status Code (200 or 202) and a JSON response like the one shown in the code sample to the right.
Response JSON - Example
{
"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"
}
Key | Value | Description |
---|---|---|
files | JSON | List of files |
id | string | Asset ID, 32 character alphanumeric UUID |
name | string | File name |
size | integer | Size of file in bytes |
checksum | string | MD5 checksum |
content_type | string | MIME type |
provider | string | always "local" to indicate local upload |
success | boolean | true if upload completed, false otherwise |
metadata | JSON | Only 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 |
Asset Ingest from URI
Use of this API to request FileSpin to retrieve a file from external HTTP URL or a S3 Bucket and create an asset.
Note
- If S3 source is provided, the S3 Bucket must have S3 Access policy to authorize FileSpin access (see
Asset Storage
section for policy details) - If HTTP URL is provided, the URL must supply downloadable content and should not require authentication. Downloads from external websites will be rate-limited.
HTTP REQUEST
cURL sample request
curl -X "POST" "https://app.filespin.io/api/v1/assets/new/content/original/external" \
-H "X-FileSpin-Api-Key: 0de9d8e207974dc7b29c76372890e4ca" \
-H "Content-Type: application/json; charset=utf-8" \
-d $'{
"name": "test.jpg",
"key": "s3://my-bucket/test.jpg"
}'
Using your API Key send a request as below:-
HTTP POST https://app.filespin.io/api/v1/assets/new/content/original/external
The request body should contain a JSON with name
and key
.
Key | Value | Description |
---|---|---|
name | string | A name to assign for the downloaded file |
key | string | The file location. This can a http/https URL or a S3 object location (see examples below) |
{
"name": "test.jpg",
"key": "https://example.com/test.jpg"
}
Example request JSON payload
Request to pull a S3 file
{
"name": "test.jpg",
"key": "s3://my-bucket/test.jpg"
}
Request to pull a file from a https URL
{
"name": "test.jpg",
"key": "https://example.com/test.jpg"
}
HTTP RESPONSE
Standard HTTP Status code (202 or 200) and a JSON response like the one shown in the code sample to the right.
Response JSON - Example
{
"id": "ceace459cd2a4d2c904e38e9ab352ebb",
"status": "QUEUED",
"message": "Queued for processing"
}
Key | Value | Description |
---|---|---|
id | string | Asset ID, 32 character alphanumeric UUID |
status | string | "QUEUED" if request was successfully received, "ERROR" if request cannot be processed |
message | string | Additional details about status |
Asset Replace
Replace API_KEY with your API Key.
sample.jpg
file should be present in the folder where the program is invoked
curl -H "X-FileSpin-Api-Key:API_KEY" \
-X "POST" -F "file=@sample.jpg" \
https://app.filespin.io/api/v1/assets/{ASSET_ID}/content/original/replace
API to replace the original content file of an asset while keeping the Asset ID unchanged.
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP REQUEST
POST https://app.filespin.io/api/v1/assets/{ASSET_ID}/content/original/replace (multipart/form-data)
Key | Type | Description |
---|---|---|
ASSET_ID | string | Asset's unique ID, 32 character alphanumeric UUID |
HTTP RESPONSE
HTTP Status code and JSON response like the one shown in the code sample to the right.
Response JSON - Example
{
"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"
}
Key | Value | Description |
---|---|---|
files | JSON | List of files |
id | string | Asset ID, 32 character alphanumeric UUID |
name | string | File name |
size | integer | Size of file in bytes |
checksum | string | MD5 checksum |
content_type | string | MIME type |
provider | string | always "local" to indicate local upload |
success | boolean | true if upload completed, false otherwise |
metadata | JSON | Only 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 |
Asset Add Conversion
Replace API_KEY with your API Key.
my_edited_copy.jpg
file should be present in the folder where the program is invoked
curl -H "X-FileSpin-Api-Key:API_KEY" \
-X "POST" -F "file=@my_edited_copy.jpg" \
https://app.filespin.io/api/v1/assets/99d819953914402babbdeb68337ea6a3/content/my_edited_copy
Use this API to upload and add a custom conversion file to an asset (such a manually edited copy of an image). The uploaded file will be stored as an asset's conversion in the Cloud Storage.
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP REQUEST
POST https://app.filespin.io/api/v1/assets/{ASSET_ID}/content/{CONVERSION_NAME} (multipart/form-data)
Key | Value | Description |
---|---|---|
ASSET_ID | string | Asset ID, 32 character alphanumeric UUID |
CONVERSION_NAME | string | An identifier for the Conversion such as my_edited_copy . It must not exceed 30 characters. It can only be alphanumeric. Spaces are not allowed. |
HTTP RESPONSE
Standard HTTP Status code - 202 or 200
Asset Get Conversion
Asset conversions can be retrieved:-
As Static Image Conversion URL
Use the URL https://app.filespin.io/api/v1/assets/{ASSET_ID}/conversions/{conversion_name}
and passing X-FileSpin-Api-Key:{API_KEY}
or Authorization: Bearer {JWT}
header
When using this option, all On-demand Image transformation options such as resize, crop, etc can be applied.
As a signed URL via /get_link API
Use /get_link
API providing the conversion_name
as CONTENT_KEY
as described in Asset Get Link section
Asset Delete Conversion
Replace API_KEY with your API Key
curl -H "X-FileSpin-Api-Key:API_KEY" \
-X "POST" \
https://app.filespin.io/api/v1/assets/99d819953914402babbdeb68337ea6a3/content/my_edited_copy
Use this API to delete a conversion file of an asset.
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP REQUEST
POST https://app.filespin.io/api/v1/assets/{ASSET_ID}/content/{CONVERSION_NAME}/delete
Key | Value | Description |
---|---|---|
ASSET_ID | string | Asset ID, 32 character alphanumeric UUID |
CONVERSION_NAME | string | An identifier for the Conversion such as my_edited_copy . It must not exceed 30 characters. It can only be alphanumeric. Spaces are not allowed. |
HTTP RESPONSE
Appropriate HTTP Status Code as specified in API Overview
section.
Asset Get Data
Get Asset Data
curl -H "X-FileSpin-Api-Key:API_KEY" \
https://app.filespin.io/api/v1/assets/{ASSET_ID}/data
Retrieve an Asset's data that includes Core metadata
, Custom metadata
, conversions and addon details.
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP REQUEST
GET https://app.filespin.io/api/v1/assets/{ASSET_ID}/data
REQUEST QUERY PARAMETERS
Parameter | Description |
---|---|
ASSET_ID | Asset ID, 32 character alphanumeric UUID |
HTTP RESPONSE
HTTP Status code and JSON response that follows Standard Asset Data Format.
Asset Update Data
Update Asset's custom data
curl -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" -d \
'{"data": {"input1": "value1"}, "mode": "APPEND"}' \
https://app.filespin.io/api/v1/assets/{ASSET_ID}/data/update
Save arbitrary JSON data with a file.
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP REQUEST
POST https://app.filespin.io/api/v1/assets/{ASSET_ID}/data/update
REQUEST QUERY PARAMETERS
Parameter | Description |
---|---|
ASSET_ID | Asset ID, 32 character alphanumeric UUID |
REQUEST JSON BODY
The request body should be a JSON with data
and mode
keys.
Example request
To update file data, send a JSON payload like below to store with the file.
{
"data": {
"input1": "value1",
"input2": "value2",
"filespin_search_txt": "MY_OWN_FILE_ID"
},
"mode": "APPEND"
}
Key | Value | Description |
---|---|---|
data | JSON | JSON data to be saved with the file |
mode | string | APPEND will append the data to any existing data, REPLACE will overwrite with the new data |
JSON Schema support
FileSpin supports JSON Schema for Asset Data. Assigning schema to asset data enables versatile field-based search and additional data validations.
Once one or more schemas have been setup for an account, you can pass the optional schema id data_schema_id
as shown below to automatically assign a schema to the asset data.
{
"data": {
"input1": "value1",
"input2": "value2",
"filespin_search_txt": "MY_OWN_FILE_ID"
},
"mode": "APPEND",
"data_schema_id": 1
}
HTTP RESPONSE
Response JSON
{
"status": "OK",
"message": "Data updated"
}
HTTP Status code and JSON response like the one shown in the code sample to the right.
Asset Download
Replace API_KEY with your API Key.
sample.jpg
file should be present in the folder where the program is invoked
#cURL sample
curl -H "X-FileSpin-Api-Key:API_KEY" \
-X "GET"
https://app.filespin.io/api/v1/assets/{ASSET_ID}/content/{CONTENT_KEY}/download \
-o original.jpg
Use this API to retrieve the original file or a pre-defined image conversion or a video transcode. HTTP Range header can also be used to retrieve large file as multiple parts.
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP REQUEST
GET https://app.filespin.io/api/v1/assets/{ASSET_ID}/content/{CONTENT_KEY}/download
URL PARAMETERS
Parameter | Type | Description |
---|---|---|
ASSET_ID | string | Asset’s unique ID, 32 character alphanumeric UUID |
CONTENT_KEY | string | “original” or any pre-defined conversion key for images and video transcodes. See your Settings for image and video keys. |
HTTP RESPONSE
The file is returned. Mime type and length of the content returned will be set in the response header.
Download large file as multiple parts
# Example using HTTP Range header to get a file as two parts. Assume the file size is 200 MB original video file.
#Get first 100 MB
curl -H "X-FileSpin-Api-Key:API_KEY" \
-X "GET" \
-r 0-104857600 \
https://app.filespin.io/api/v1/assets/{ASSET_ID}/content/{CONTENT_KEY}/download \
-o part1
#Get second and final part
curl -H "X-FileSpin-Api-Key:API_KEY" \
-X "GET" \
-r 104857601-209715200 \
https://app.filespin.io/api/v1/assets/{ASSET_ID}/content/{CONTENT_KEY}/download \
-o part2
#Merge the parts to get the original file
cat part1 part2 > original.mp4
You can use HTTP Range header parameter to download a large file as multiple parts. For details about the HTTP Range header, please visit http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35
Asset Get Link
To retrieve links for asset
original
or conversions
#Example to get a link for the original file with maximum expiry
curl -H "X-FileSpin-Api-Key:API_KEY" \
https://app.filespin.io/api/v1/assets/{ASSET_ID}/get_link?key=original&expiry=MAX&accessId=IZJTAMBQGAYDAMBQGAYDAMBQGAYDANKT
#returns a link such as below:-
https://cdn.filespin.io/api/v1/files/content/e31c8dae2e934caf9cdbbacf60091a38?key=original&expiry=1486556379&delivery=display&accessId=IZJTAMBQGAYDAMBQGAYDAMBQGAYDANKT&signature=ScdZeFTEs41edgmfgk-XJbO2ACk%3D
Use this API to retrieve links for Asset original content file and asset conversions.
You can use this API to get a content link that can be presented as a downloadable link in a web page or an app.
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP REQUEST (HTTP GET for single content file)
GET https://app.filespin.io/api/v1/assets/{ASSET_ID}/get_link?key={CONTENT_KEY}&expiry={SECONDS}&delivery={DELIVERY_MODE}&accessId={ACCESS_ID}
HTTP REQUEST (HTTP POST for multiple content files)
Retrieve lilnks for multiple Assets
curl -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '["{ASSET_ID}", "{ASSET_ID}"]' \
https://app.filespin.io/api/v1/assets/get_link?key={CONTENT_KEY}&expiry={SECONDS}&delivery={DELIVERY_MODE}&accessId={ACCESS_ID}
POST https://app.filespin.io/api/v1/assets/get_link?key={CONTENT_KEY}&expiry={SECONDS}&delivery={DELIVERY_MODE}&accessId={ACCESS_ID}
Pass the Asset IDs in the request body as a list.
REQUEST PARAMETERS
Parameter | Type | Description |
---|---|---|
ASSET_ID | string | Asset ID, 32 character alphanumeric UUID |
CONTENT_KEY | string | "original" or any pre-defined conversion name/key for images and video transcodes. See your Settings for image and video keys. |
EXPIRY | integer | Seconds after which the link should expire. Defaults to 6000 (10 minutes). Use the special value MAX to set expiry to maximum possible (defined as 19 January 2038) |
ACCESS_ID | string | Access Id that must be used to sign URLs. You can obtain your account's Access Id from the Authorization Settings page. |
DELIVERY_MODE | string | optional parameter to get a link for use in display or download. Values can be display or download . Defaults to download which gets a link that when clicked will download the file. |
HTTP RESPONSE
Response for a single asset GET request
https://cdn.filespin.io/api/v1/files/content/c5651f8783f64d09985f0dd38359d846?key=thumbnail&expiry=1486556379&delivery=display&accessId=IZJTAMBQGAYDAMBQGAYDAMBQGAYDANKT&signature=ScdZeFTEs41edgmfgk-XJbO2ACk%3D
HTTP Status code and JSON response like the one shown in the code sample to the right.
For GET request for a single Asset, the link is returned in response as shown in the code samples to the right.
For POST request with multiple Asset IDs, a JSON with links is returned as shown.
{
"ASSET_ID": "https://URL",
}
Response JSON with links for multiple assets POST request
{
"c5651f8783f64d09985f0dd38359d846": "https://cdn.filespin.io/api/v1/files/content/c5651f8783f64d09985f0dd38359d846?key=thumbnail&expiry=1486556379&delivery=display&accessId=IZJTAMBQGAYDAMBQGAYDAMBQGAYDANKT&signature=ScdZeFTEs41edgmfgk-XJbO2ACk%3D",
"aa2e7cce8a1e479daf5eb94cc413e8cb": "https://cdn.filespin.io/api/v1/files/content/ca2e7cce8a1e479daf5eb94cc413e8cb?key=thumbnail&expiry=1486556379&delivery=display&accessId=IZJTAMBQGAYDAMBQGAYDAMBQGAYDANKT&signature=ScdZeFTEs41edgmfgk-XJbO2ACk%3D"
}
Asset Search
#HTTP POST - Get fist page of results
curl -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{ "keyword": "test*", "content_type": "image*", \
"upload_time_range": {"start": "2013-01-01T10:25:11Z","end": "2013-02-01T10:25:11Z"}, \
"file_size_range": {"start": 10240, "end": 402600}, "limit_per_page": 30 }' \
https://app.filespin.io/api/v1/assets/search
#HTTP GET - Get additional search result pages
curl -H "X-FileSpin-Api-Key:API_KEY" \
https://app.filespin.io/api/v1/assets/search/{SEARCH_RESULT_ID}/{PAGE_NO}
Search API provides a powerful way to find files based on file name, mime type, size and other Asset properties. Search API has two invocation methods:
- HTTP POST to run the search and get first page of results (default 50 per page)
- HTTP GET to get additional result pages
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP POST - Get first page with results
Run search and get first results page
POST https://app.filespin.io/api/v1/assets/search
REQUEST JSON PARAMETERS
All parameters are optional. A complete JSON payload for search request below:-
{
"keyword": "sample",
"file_name": "test*",
"content_type": "image* OR video* OR audio*",
"creator_id": 100,
"upload_time_range": {
"start": "2013-01-01T10:25:11Z",
"end": "2013-02-01T10:25:11Z"
},
"file_size_range": {
"start": 10240,
"end": 402600
},
"sort_by": [
"upload_time_range_DESC",
"file_size_range_ASC",
"content_type_DESC"
],
"limit_per_page": 30
}
Key | Type | Description |
---|---|---|
keyword | string | (optional) Search for keywords (includes keywords added to reserved Asset metadata field filespin_search_txt or custom schema fields with keyword_searchable set to true . Use OR to find assets that match any of the given search words. john OR doe will find assets that contain john or doe in keywords. Use AND to find assets that contain both john and doe in keywords.OR and AND conditions cannot be used together in a search. keyword cannot contain more than 40 words |
file_name | string | (optional) File name, * wildcard character is allowed in the suffix. To find multiple types in search supply value separated by OR , like myfile1* OR myfile2* . Note that . is a reserved search character and cannot be used in file name search |
content_type | string | (optional) File content type type. * wildcard is allowed. To find multiple types in search supply value separated by OR , like image* OR video* |
creator_id | integer | (optional) Search only the files created by this user. Note that the user calling the API must belong to the same user group as the user id passed |
upload_time_range | JSON | (optional) like {"start": TIME, "end": TIME } where TIME is an ISO 8601 datetime string, such as "2013-01-20T15:30:25Z". Range is inclusive, times will be considered as UTC times |
file_size_range | JSON | (optional) like {"start": SIZE, "end": SIZE } where SIZE is in bytes ( 1 KiB = 1024 bytes, 1 MiB = 1048576 bytes), range is inclusive |
limit_per_page | integer | (optional) Limit how many files are returned in a page. Can be from 1 to 30. Defaults to 30. |
sort_by | JSON | (optional) List of key strings. Sort keys can be "file_name", "content_type", "upload_time_range" or "file_size_range". Append _ASC or _DESC to the key to sort by ascending or descending order. Example: ["upload_time_range_DESC", "file_size_range_ASC"] will sort by upload_time_range in descending order and within that by ascending file_size. Default sort is by descending order of upload_time_range. If sort_by keys are provided, it will override default sorting. |
extended_result | boolean | (optional) Set this to true to return extended result which will contain the complete asset data for asset ids returned. Searches with this set to true will take longer to run |
trashed | boolean | (optional) Set this to true to return files that have been deleted (but not purged). Deleted files will not be returned in normal searches. Admin role is required to retrieve deleted assets |
HTTP GET - Get additional result pages
To get the result pages, use HTTP GET with the SEARCH_RESULT_ID
and page required
GET https://app.filespin.io/api/v1/assets/search/{SEARCH_RESULT_ID}/{PAGE_NO}
REQUEST QUERY PARAMETERS
Parameter | Type | Description |
---|---|---|
SEARCH_RESULT_ID | string | the SEARCH_RESULT_ID returned in the HTTP POST call |
PAGE_NO | integer | index of result page requested, should be less than or equal to the total pages returned in the HTTP POST call |
The HTTP GET response JSON is the same as for HTTP POST that provides one page of search result.
HTTP RESPONSE
HTTP Status code and JSON response like the one shown in the code sample to the right.
//Response JSON with {Asset Data}
{
"status": "OK",
"search_result_id": "0a9761f2f9",
"total_files": 1,
"page": 1,
"total_pages": 1,
"result": ["116f6a2a266d45d58d067f7c39a2e4dd"],
"extended_result": {
"116f6a2a266d45d58d067f7c39a2e4dd": {Asset Data}
}
}
Asset Data is as specified in Asset Data Format - the JSON format used across all Asset API responses.
Key | Value | Description |
---|---|---|
status | string | "OK" if search was successful, "ERROR" otherwise |
search_result_id | string | an alphanumeric value between 10 and 32 characters, valid 60 minutes from time of API call |
total_files | integer | total number of files found for the search. Note that there may be more than one page of results if there are more than 100 files in result |
page | integer | index of currently returned result page, always less than or equal to total_pages |
total_pages | integer | total number of pages in the search result |
result | JSON | List of file ids |
extended_result | JSON | A dictionary containing the current data for each file id returned in result. Data for each file follows Asset Data Format JSON |
#HTTP POST - Search for exact match for word "a+b"
#note the escaped double quotes around the search word
curl -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{ "keyword": "\"a+b\""}' \
https://app.filespin.io/api/v1/assets/search
#HTTP POST - Search for exact match for word "abc 123"
#note the escaped double quotes around the search word
curl -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{ "keyword": "\"abc 123\""}' \
https://app.filespin.io/api/v1/assets/search
Search for exact match
To search for exact match for a word, enclose the word in double quotes "
and escape the doouble quotes as shown in the examples.
For example,
- to search for
ABC 123
, you need to search for"ABC 123"
(the double quote escaped format is"\"ABC 123\""
)
Search for words with special characters
+ - && | | ! ( ) { } [ ] ^ " ~ * ? : \ /
are special characters in the search query. To search for a word that contains special characters you should enclose the word in double quotes.
For example,
- to search for
a+b
, enclose the word in double quotes like"a+b"
- to search for
ABC-123
, provide the search word as"ABC-123"
Search using Custom Schema Fields
FileSpin supports searching on custom schema fields defined as searchable
in Custom Asset Schema. You can provide search criteria for custom schema via a JSON as below:-
This search with below schema_criteria
will return with all assets whose schema ID is 1 and which contain "john"
in the "name"
field.
{
"schema_criteria": {
"data_schema_id": 1,
"fields": {
"name": "john"
}
}
}
Key | Value | Description |
---|---|---|
data_schema_id | JSON | Asset Data Schema ID to search on. Mandatory if schema_criteria is given |
fields (optional) | JSON | Field name and the search value |
#Search and retrieve assets that contain word starting `john` anywhere in a custom field called `customerName`
curl -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{
"schema_criteria": {
"data_schema_id": 1,
"fields": {
"customerName": "john"
}
}
}' \
https://app.filespin.io/api/v1/assets/search
#HTTP POST - Custom Schema search with wildcards
#Search and retrieve assets that contain word starting with `john` in a custom field called `customerName`
curl -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{
"schema_criteria": {
"data_schema_id": 1,
"fields": {
"customerName": "john*"
}
}
}' \
https://app.filespin.io/api/v1/assets/search
#Search and retrieve assets that contain word `john` or `dan` in a custom field called `customerName`
curl -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{
"schema_criteria": {
"data_schema_id": 1,
"fields": {
"customerName": "john OR dan"
}
}
}' \
https://app.filespin.io/api/v1/assets/search
Custom Schema search with AND, OR and wildcards
Custom Schema search supports AND, OR and wildcards with certain limitations.
AND
andOR
cannot be used together in the same search criteria.- Search criteria can contain upto 5
AND
orOR
operators. *
wildcard can only be used in suffix of search terms liketest*
,image*
.
Examples
- to search and retrieve assets that contain for
john
ordan
in a custom field calledcustomerName
, use"customerName":"john OR dan"
- to search and retrieve assets that contain the term
john
in the custom field calledcustomerName
, use"customerName":"john"
- to search and retrieve assets that contain the term
john
orjohny
orjohnny
in a custom field calledcustomerName
, use"customerName":"john*"
Notes & tips on Search API
- To search for exact string match, quote the search string, e.g.
"\"my exact search string\""
. This will search for the exact string"my exact search string"
. - Custom Schema Fields search using
"schema_criteria"
can be used in combination with other standard search parameters such askeyword
,content_type
,sort_by
, etc. - Rules for searching words with special characters and exact match apply to custom schema fields as well.
- Search results are sorted by relevance by default. You can sort the results by other supported sort fields such as
upload_time
,file_size
, etc. using thesort_by
parameter. - Search conditions are additive. FileSpin applies
AND
when searching for more than one condition, e.g. if you providekeyword
andcontent_type
, the search will return files that match both the keyword and content type.
Asset Find Duplicates
Find asset duplicates
#get duplicates. returns default first page
curl -H "X-FileSpin-Api-Key:API_KEY" \
https://app.filespin.io/api/v1/assets/{ASSET_ID}/content/original/duplicates
#get second page
curl -H "X-FileSpin-Api-Key:API_KEY" \
https://app.filespin.io/api/v1/assets/{ASSET_ID}/content/original/duplicates/2
Retrieve duplicates of an asset original file by checking for the Asset file's MD5 checksum.
HTTP REQUEST
GET https://app.filespin.io/api/v1/assets/{ASSET_ID}/content/original/duplicates/{PAGE_NO}
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
REQUEST QUERY PARAMETERS
Parameter | Type | Description |
---|---|---|
ASSET_ID | string | Asset ID, 32 character alphanumeric UUID |
PAGE_NO | integer | Optional. Page number to paginate results if result is too large. Defaults to 1 (first page). |
RESPONSE JSON
Response JSON with duplicates
{
"id": "99d819953914402babbdeb68337ea6a3",
"name": "example.jpg",
"size": 8836363,
"content_type": "image/jpeg",
"checksum": "5f5f26bd7c0f62c6e02e44c73d09734e",
"total_files": 62,
"total_pages": 3,
"page": 3,
"duplicates": [
"425f6a2a266d45d58d067f7c39a2e4bd",
"a563da2a266d45d58d067b8c39a3d5ad"
]
}
HTTP Status code and JSON response like the one shown in the code sample to the right.
Key | Value | Description |
---|---|---|
id | string | File's unique ID, 32 character alphanumeric UUID |
name | string | File name |
size | integer | Size of file in bytes |
checksum | string | MD5 checksum |
content_type | string | MIME type |
duplicates | JSON | List of file ids whose MD5 checksum is the same as the query file id |
total_files | integer | Number of duplicate files found |
total_pages | integer | Number of pages in result. Normally a page will contain 30 asset IDs. |
page | integer | Current page of the result. Defaults to 1. |
Asset Delete
API to delete an asset or it's conversions.
Delete an original asset or a conversion. Below deletes 480p-video conversion of a video asset.
curl -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{"keys": ["480p-video"]}' \
https://app.filespin.io/api/v1/assets/{ASSET_ID}/delete
- Deleting the
original
is a soft-delete within FileSpin. It will mark Asset as deleted and hide it from view (See Purge API to completely purge an Asset) - Asset administrators can retrieve deleted Assets using Search API by setting
trashed
option to true - Unknown custom keys and keys that do not apply to the file type will be ignored
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP Request
POST https://app.filespin.io/api/v1/assets/{ASSET_ID}/delete
Query parameters
Parameter | Default | Description |
---|---|---|
{ASSET_ID} | string | Asset ID, 32 character alphanumeric UUID |
Request JSON Parameters
Request JSON payload
{
"keys": ["480p-video", "720p-video"]
}
Key | Value | Description |
---|---|---|
keys | JSON | List of conversion keys. See below for Keys that you can specify |
Asset/Key type | keys list values |
---|---|
Image | Built-in keys such as "deepzoom" and/or all the custom conversion keys setup in account settings |
Video | Built-in keys such as "480p-video", "480p-wm-video", "hls-video", "storyboard", etc |
Original | To delete the original asset, use the key “original”. Note this will delete and purge all conversions from storage |
Addon | Addon key defined by the addons deployed |
All Conversions | Use the special key * to delete all conversions |
HTTP RESPONSE
Standard HTTP Status code - 202 or 200
Webhook callback on delete completion
Once the delete request is completed, callback is issued to configured Webhook.
Please see Tools & Integration- > Webhooks section for file-deleted
event callback to learn about the callback JSON structure.
Asset Undelete
Undelete an asset
curl -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{"keys": ["original"]}' \
https://app.filespin.io/api/v1/assets/trash/{ASSET_ID}/undelete
API to undelete an asset that has been deleted.
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP Request
POST https://app.filespin.io/api/v1/assets/trash/{ASSET_ID}/undelete
Query parameters
Parameter | Default | Description |
---|---|---|
ASSET_ID | string | Asset ID, 32 character alphanumeric UUID |
Request JSON Parameters
Key | Value | Description |
---|---|---|
keys | JSON | List of conversion keys. For undelete only "original" key is accepted. |
HTTP RESPONSE
Standard HTTP Status code - 202 or 200
Webhook callback on undelete completion
Once the undelete request is completed, callback is issued to configured Webhook.
Please see Tools & Integration- > Webhooks section for file-undeleted
event callback to learn about the callback JSON structure.
Asset Purge
Purge deleted assets
curl -H "X-FileSpin-Api-Key:ASSET_KEY" \
-X DELETE https://app.filespin.io/api/v1/assets/trash/purge
This is a ADMIN-only API
API to completely purge all assets that are in Trash (i.e. in deleted
state) across all users within a User Group.
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP REQUEST
DELETE https://app.filespin.io/api/v1/assets/trash/purge
HTTP RESPONSE
Standard HTTP Status code - 202 or 200
Asset Access - Make Public
Make an asset or its conversion public
curl -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{"keys": ["480p-wm-video"]}'\
https://app.filespin.io/api/v1/assets/{ASSET_ID}/content/set_public_access
This API can be used to set public-read access to a file or its conversions in the Cloud Storage (such as S3).
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP Request
POST https://app.filespin.io/api/v1/assets/{ASSET_ID}/content/set_public_access
REQUEST QUERY PARAMETERS
Parameter | Default | Description |
---|---|---|
ASSET_ID | string | Asset ID, 32 character alphanumeric UUID |
REQUEST JSON
Key | Value | Description |
---|---|---|
keys | JSON | List of conversion keys. See below for Possible Key values that you can specify. |
Possible Key values
Type | keys list values |
---|---|
All files | Built-in key "original" the asset original file |
Image files | Built-in keys: "deepzoom" and/or all the custom conversion keys setup in account settings |
Video files | Built-in keys: "360p-video", "360p-wm-video", "480p-video", "480p-wm-video", "720p-video", "720p-wm-video", "1080p-video", "1080p-wm-video" and/or "hls-video" (note that *-wm-video keys are for watermarked videos) |
HTTP RESPONSE
Standard HTTP Status code - 202 or 200
Asset Access - Remove Public Access
Remove public access permission from an asset or its conversion
curl -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{"keys": ["480p-wm-video"]}'\
https://app.filespin.io/api/v1/assets/{ASSET_ID}/content/remove_public_access
This API can be used to remove public-read access permission from a file or its conversions in the Cloud Storage (such as S3).
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP Request
POST https://app.filespin.io/api/v1/assets/{ASSET_ID}/content/remove_public_access
REQUEST QUERY PARAMETERS
Parameter | Default | Description |
---|---|---|
ASSET_ID | string | Asset ID, 32 character alphanumeric UUID |
REQUEST JSON
Key | Value | Description |
---|---|---|
keys | JSON | List of conversion keys. See below for Possible Key values that you can specify. |
Possible Key values
Type | keys list values |
---|---|
All files | Built-in key "original" the asset original file |
Image files | Built-in keys: "deepzoom" and/or all the custom conversion keys setup in account settings |
Video files | Built-in keys: "360p-video", "360p-wm-video", "480p-video", "480p-wm-video", "720p-video", "720p-wm-video", "1080p-video", "1080p-wm-video" and/or "hls-video" (note that *-wm-video keys are for watermarked videos) |
HTTP RESPONSE
Standard HTTP Status code - 202 or 200
Asset Processing API
Assets can be processed for image transformations, video transcodes and other custom workflows using /process
API.
Image Processing API
Process an image asset for deepzoom
curl -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{"keys": ["deepzoom"]}' \
https://app.filespin.io/api/v1/assets/{ASSET_ID}/process
The /process
API is useful in the following scenarios:-
- Create static image conversions that are not covered by On-demand Image Conversion
- Re-process a static image conversion to apply a new watermark
- Re-process an image if there are any on-demand image conversion errors
- Re-process an image if auto-tags have not been generated
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP REQUEST
POST https://app.filespin.io/api/v1/assets/{ASSET_ID}/process
REQUEST QUERY PARAMETERS
Parameter | Description |
---|---|
ASSET_ID | Asset ID, 32 character alphanumeric UUID |
REQUEST JSON BODY
Unknown keys and keys that do not apply to the file type will be ignored.
Key | Value | Description |
---|---|---|
keys | JSON | List of conversion keys such as deepzoom and/or all the custom conversion keys setup in account settings. Below built-in processing keys can also be used. |
Built-in Image processing keys
Re-generate on-demand image
curl -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{"keys": ["smart_imaging"]}' \
https://app.filespin.io/api/v1/assets/{ASSET_ID}/process
Key | Description |
---|---|
smart_imaging |
used for on-demand images and image annotation re-processing |
HTTP RESPONSE
Standard HTTP Status code - 202 or 200
Also, once processing completes, Asset Data JSON will contain process state for smart_imaging
as below:
"addons_info": {
"ON_DEMAND_IMAGE": {
"available": true
}
}
Video Transcoding API
Process a 720p-video
curl -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{"keys": ["720p-video"]}' \
https://app.filespin.io/api/v1/assets/{ASSET_ID}/process
This API uses the same endpoint as image conversion API. It is useful in the following scenarios:-
- Generate standard video transcodes that do not exist for a video file
- Re-apply a new watermark to existing video transcodes
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP REQUEST
POST https://app.filespin.io/api/v1/assets/{ASSET_ID}/process
REQUEST QUERY PARAMETERS
Parameter | Description |
---|---|
ASSET_ID | Asset ID, 32 character alphanumeric UUID |
REQUEST JSON BODY
Key | Value | Description |
---|---|---|
keys | JSON | List of built-in transcode keys and special processing keys |
Built-in Video processing keys
- Built-in keys that correspond to video quality and sizes:
360p-video
,480p-video
,720p-video
,1080p-video
,hls-video
- Watermarked transcodes:
360p-wm-video
,480p-wm-video
,720p-wm-video
,1080p-wm-video
Special video processing keys
Key | Description |
---|---|
clip_preview |
generate a preview clip of the video using user's settings profile |
storyboard |
generate a set of storyboard images for the video using user's video settings profile |
Note that unknown keys and keys that do not apply to the file type will be ignored.
HTTP RESPONSE
Standard HTTP Status code - 202 or 200 and JSON response body as below:-
{
"status": "QUEUED",
"message": "Job queued",
"job_id": 42
}
Key | Value | Description |
---|---|---|
status | string | Status of the process. Can be QUEUED or ERROR |
message | string | Message describing the status |
job_id | integer | Job ID of the process. Can be used to query the status of job using Job Status API |
Video Custom Transcoding API
You can make use of /clip/process
API to create custom transcodes to :-
- create a clip from specific section of a video
- add a custom watermark to a video other than the default watermark
The transcode output will be added as a conversion to the asset and stored in Video transcodes bucket specified in account settings. Webhook callback will be issued once output is created.
Using your API Key send a request as below:-
HTTP REQUEST
Example transcode requests
#Create a clip with 480p preset from a video starting from 10 seconds and length of 5 seconds.
#Name the clip as "sample.mp4"
#Make access public in Storage to allow playback using /transcodes API without signed URL
curl -X "POST" "https://app.filespin.io/api/v1/assets/{ASSET_ID}/clip/process" \
-H "X-FileSpin-Api-Key: 0de9d8e207974dc7b29c76372890e4ca" \
-H "Content-Type: application/json; charset=utf-8" \
-d $'{
"name": "sample",
"preset": "480p-video",
"start": 10,
"length": 5,
"public": true,
}'
#Transcode the entire video using 720p preset and add a custom watermark.
#Name the clip as "720p-custom-wm-video.mp4"
curl -X "POST" "https://app.filespin.io/api/v1/assets/{ASSET_ID}/clip/process" \
-H "X-FileSpin-Api-Key: 0de9d8e207974dc7b29c76372890e4ca" \
-H "Content-Type: application/json; charset=utf-8" \
-d $'{
"name": "720p-custom-wm-video",
"preset": "720p-video",
"watermark": {
"url": "http://app.filespin.io/api/v1/user/watermark/1",
"placement": "top-right",
"scale": 0.2
}
}'
HTTP POST https://app.filespin.io/api/v1/assets/{ASSET_ID}/clip/process
REQUEST QUERY PARAMETERS
Key | Value | Description |
---|---|---|
ASSET_ID | string | Asset ID of the video file |
REQUEST JSON
Key | Value | Description |
---|---|---|
name | string | Conversion name. The transcode output will be named as name .mp4, like clip_sample.mp4 |
preset | string | Any of the standard video transcode keys “360p-video”, “360p-wm-video”, “480p-video”, “480p-wm-video”, “720p-video”, “720p-wm-video”, “1080p-video”, “1080p-wm-video” |
start | (optional) integer or timecode string | Defaults to 0. Seconds into the video for clip start. Can also given as timecode of the format HH:MM:SS.fff where fff is the frame |
length | (optional) integer | Defaults to entire video. Length of clip in seconds |
public | (optional) boolean | Defaults to false . Make the output file public in Storage to allow playback using /transcodes API without signed URL |
aspect | (optional) string | Defaults to "pad". Determines aspect and padding. Can be "pad" - to add padding, "preserve" - preserves original aspect ratio, padding color will be ignored, "scale" - scales the output, "crop" - crops the output to match requested dimensions. |
padding | (optional) string | Defaults to "000000" - black. Padding color. Applies only when aspect is "pad". Value is a six character colorcode such as "000000" - black, "ffffff" - white, etc. |
upscale | (optional) boolean | Defaults to false. Upscale the output if original is of lower size than requested output size. |
watermark | (optional) object | Defaults to null. Add a watermark to the output. See below for details. |
watermark->url | (required) string | URL of the watermark image. Can be a public URL or an on-demand image URL of an asset in your account |
watermark->placement | (optional) string | Defaults to account watermark setting. Position of the watermark. Can be "top-left", "top-right", "bottom-left", "bottom-right" or "center" |
watermark->scale | (optional)float | Defaults to account watermark setting. Scale of the watermark. Can range from 0 to 1. 0.1 will scale the watermark to 10% of the output video size and place it at the specified placement, 0.5 will scale it to 50% of output video size. |
Asset Data - Example custom conversion added to Asset
"480p-custom-wm-video": {
"key": "/transcodes/12bc22852739447c956b97580977fdf4/480p-custom-wm-video.mp4",
"bucket": "my-bucket",
"width": 640,
"height": 480,
"public": true,
"watermarked": true,
"size": 346344,
"duration": 5
}
Note:
- Transcode output will be added to Asset as a Conversion automatically using the given
name
key - Transcode output details can be retrieved using the
Get Data
API (see Asset Data Storyboard JSON example) - Transcode output is stored in Video Transcodes storage bucket specified in account settings
HTTP RESPONSE
Standard HTTP Status code - 202 or 200 and JSON response body as below:-
{
"status": "QUEUED",
"message": "Job queued",
"job_id": 42
}
Key | Value | Description |
---|---|---|
status | string | Status of the process. Can be QUEUED or ERROR |
message | string | Message describing the status |
job_id | integer | Job ID of the process. Can be used to query the status of job using Job Status API |
Batch Processing API
Process one or more assets in a single API call for creating or re-creating image conversions, video transcodes and addon processing.
# Example: use Asset IDs to re-process assets for specified conversions, transcodes and addons
curl -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{
"ids": [
"7204fbc866d94805ad3fab3e1a194abd"
],
"conversions": ["smart_imaging"],
"transcodes": ["480p-video"],
"addons": ["storyboard"]
}' \
https://app.filespin.io/api/v1/assets/content/original/reprocess
The asset batch processing API is useful in the following scenarios:-
- process multiple assets to apply updated watermark
- process multiple assets to create a specific conversion, transcode or addon
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP REQUEST
POST https://app.filespin.io/api/v1/assets/content/original/reprocess
REQUEST JSON BODY
Note:
- A maximum of 100 assets can be re-processed in one API call
- If
conversions
,transcodes
oraddons
are all empty, or not provided, all conversions, transcodes and addons enabled in caller's account settings will be re-processed. - Unknown keys in
conversions
,transcodes
oraddons
and keys that do not apply to the file type will be ignored.
Parameter | Description |
---|---|
ids | Asset Ids of assets that should be re-processed |
conversions | (optional) List of conversion keys such as deepzoom. See Image Processing API for keys |
transcodes | (optional) List of transcode keys such as 480p-video. See Video Transcoding API for keys |
addons | (optional) List of addon keys such as storyboard. Addon must be available and enabled in the caller's account. See specific addon in Addons section for keys |
HTTP RESPONSE
Standard HTTP Status codes
Asset Schema API
Asset Schema provides the ability to store custom metadata (provided as JSON) that conform to a standard schema.
Asset Schema is defined using JSON Schema 2020-12 with a simple FileSpin envelope as below.
FileSpin extends JSON Schema to support additional properties using filespin_properties
for rendering in frontend UI.
Asset Schema JSON
Build-in default Asset Schema
When a new Asset is created, it is assigned a default Asset Schema with a single field filespin_search_txt
which is a searchable text field.
This field is a build-in field that cannot be altered. It can be used to store keywords for searching.
{
"id": 0,
"name": { "en": "FileSpin Asset Schema" },
"status": "ACTIVE",
"schema": {
"$id": "https://app.filespin.io/json-schema/Asset.CustomMetadata.v1.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "Default Asset Metadata",
"required": [],
"properties": {
"filespin_search_txt": {
"type": "string",
"description": "Searchable keywords",
"minLength": 0,
"maxLength": 200,
"filespin_properties": {
"title": { "en": "Searchable keywords" },
"hint": { "en": "Keywords associated with this asset for seaching" },
"placeholder": { "en": "Enter keywords separated by a space" },
"searchable": true,
"keyword_searchable": true,
"ui": {
"order": 1,
"readonly": false,
"disabled": false,
"hidden": false
}
}
}
}
}
}
Example Schema with a custom field
This example shows a custom schema with a single field a_name
of type string
and a field a_date
of type string
with format
set to date
according to
JSON Schema 2020-12 specification
{
"name": { "en": "Sample Asset Schema" },
"status": "ACTIVE",
"schema": {
"$id": "https://app.filespin.io/json-schema/Asset.CustomMetadata.v1.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "Default Asset Metadata",
"required": ["a_date"],
"properties": {
"a_name": {
"type": "string",
"description": "A name",
"minLength": 0,
"maxLength": 200,
"filespin_properties": {
"title": { "en": "A name" },
"hint": { "en": "A name" },
"placeholder": { "en": "A name" },
"searchable": true,
"keyword_searchable": true,
"ui": {
"order": 1,
"readonly": false,
"disabled": false,
"hidden": false
}
}
},
"a_date": {
"type": "string",
"description": "A date",
"minLength": 0,
"maxLength": 24,
"format": "date",
"filespin_properties": {
"title": { "en": "Important date" },
"hint": { "en": "Important date" },
"placeholder": { "en": "Important date" },
"searchable": true,
"ui": {
"order": 1,
"readonly": false,
"disabled": false,
"hidden": false
}
}
}
}
}
}
Built-in support for string sub-types
JSON Schema string
type has built-in support for these optional format
sub-types: "date"
, "email"
.
For a more details, please consult with your FileSpin technical contact who can help setup appropriate schema for your asset data.
FileSpin Asset Schema properties
filespin_properties
within $schema->properties
contains FileSpin specific properties per field defined as below:-
Key | Type | Description |
---|---|---|
title | JSON | Displayable title in multiple languages. Language keys are ISO 639-1 codes (two-letter codes). en is mandatory. Example: {"en": "My Custom Field"} |
hint | JSON | Help text for the field in multiple languages. Language keys are ISO 639-1 codes (two-letter codes). en is mandatory. Example: {"en": "Your email id"} |
placeholder | JSON | Placeholder text in multiple languages. Language keys are ISO 639-1 codes (two-letter codes). en is mandatory. Example: {"en": "Enter your email id here"} |
searchable | boolean | Indicates if this field is searchable using schema_criteria search parameter |
keyword_searchable | boolean | Indicates if this field is searchable using keyword search parameter |
ui | JSON | A dictionary of key-value pairs to support rendering of the field in frontend UI. Supported keys: order , readonly , disabled , hidden . See below UI rendering. |
UI rendering
{"order": 1, "readonly": false, "disabled": false, "hidden": false }
where order
is for display order of the field, readonly
is to make the field read-only, disabled
is non-selectable read-only, hidden
is to render as hidden field
Asset Schema - Get
Retrieve an Asset Schema definition.
# Retrieve Asset Schema Definition using FileSpin Schema ID.
curl -H "X-FileSpin-Api-Key:API_KEY" \
https://app.filespin.io/api/v1/assetschemas/SCHEMA_ID
HTTP REQUEST
GET https://app.filespin.io/api/v1/assetschemas/{SCHEMA_ID}
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP QUERY PARAMETERS
Parameter | Type | Description |
---|---|---|
SCHEMA_ID | integer | (optional) Asset Schema id. Default Asset Schema id is 0 (built-in schema). |
HTTP Response
HTTP Status code and JSON response with Asset Schema definition. See Asset Schema JSON Format.
Asset Schema - Get All
# Retrieve all Asset Schema Definitions
curl -H "X-FileSpin-Api-Key:ASSET_KEY" \
https://app.filespin.io/api/v1/assetschemas
Retrieve all Asset Schema definitions available.
HTTP REQUEST
GET https://app.filespin.io/api/v1/assetschemas
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP RESPONSE
HTTP Status code and JSON response like the one shown in the code sample to the right.
{
"status": "OK",
"data": [ {Asset Schema JSON} ]
}
Parameter | Type | Description |
---|---|---|
status | string | "OK" or "ERROR" |
data | JSON | List of {Asset Schema JSON} definitions as specified in Asset Schema JSON |
Asset Schema - Create
Create a new Asset Schema definition
curl -X "POST" -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{ASSET_SCHEMA_JSON}' \
https://app.filespin.io/api/v1/assetschema
Create a new Asset Schema definition.
HTTP REQUEST
POST https://app.filespin.io/api/v1/assetschema
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
REQUEST PARAMETERS
Pass {ASSET_SCHEMA_JSON}
in request body. See Asset Schema JSON for the JSON format. Note that when creating Asset Schema id
should not be provided.
HTTP RESPONSE
Response JSON
{
"id": 27
}
HTTP Status code and JSON response like the one shown in the code sample to the right.
Parameter | Type | Description |
---|---|---|
id | integer | ID of new Asset Schema created. |
Asset Schema - Update
Update an existing Asset Schema definition.
Update an existing Asset Schema Definition using.
curl -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{ASSET_SCHEMA_JSON}' \
https://app.filespin.io/api/v1/assetschema
HTTP REQUEST
POST https://app.filespin.io/api/v1/assetschema
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
REQUEST PARAMETERS
Include id
of Asset Schema to be updated in {ASSET_SCHEMA_JSON}
request payload as below:-
{
"id": 26,
"name": {
"en": "My Asset Schema"
},
"status": "ACTIVE",
"schema": {
"$id": "https://app.filespin.io/api/v1/json-schema/Asset/CustomMetadata.v1.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "My Asset Metadata",
"required": [],
"properties": {
"email": {
"title": "An Email",
"type": "string",
"format": "email",
"minLength": 5,
"maxLength": 200,
"filespin_properties": {
"title": {
"en": "an email"
},
"hint": {
"en": "an email"
},
"placeholder": {
"en": "an email"
},
"searchable": true,
"keyword_searchable": false,
"ui": {
"order": 4,
"readonly": false,
"disabled": false,
"hidden": false
}
}
}
}
}
}
See Asset Schema JSON for the JSON format.
HTTP RESPONSE
Response JSON
{
"id": 27
}
HTTP Status code and JSON response like the one shown in the code sample to the right.
Parameter | Type | Description |
---|---|---|
id | integer | ID of new Asset Schema created. |
Asset Collection API
Asset Collections provide a robust method for managing assets and collaborating with other users. Collections can be private to a user or can be shared within a user group.
Asset Collection JSON Format
Asset Collection has the below JSON structure.
{
"id": 21,
"user_id": 45,
"name": "My Collection",
"description": "An example description",
"last_update": "2022-01-24T09:11:05Z",
"assets": ["3b5123160c474720931292c33eb46c52"],
"group_access": false,
"user_name": "John Doe",
"user_email": "john@example.org",
"extended_result": {}
}
Parameter | Type | Description |
---|---|---|
id | integer | Collection ID |
name | string | Collection name |
description | string | Collection description |
last_update | date | When the collection was updated last, ISO 8601 datetime value |
assets | JSON | List of asset IDs |
group_access | boolean | true if assets can be accessed by other users in the user group, false otherwise |
user_id | integer | Collection creator ID |
user_name | string | Collection creator name |
user_email | Collection creator email | |
extended_result | JSON | Like {"ASSET_ID": ASSET_JSON} } where ASSET_JSON is in the standard Asset JSON format |
Asset Collection - Get
Retrieve a Collection. When no Collection ID is passed, the API returns the Default Basket Collection.
get basket (Default collection)
curl -H "X-FileSpin-Api-Key:API_KEY" \
https://app.filespin.io/api/v1/assetcollection
get a collection by id
curl -H "X-FileSpin-Api-Key:API_KEY" \
https://app.filespin.io/api/v1/assetcollection/2
HTTP REQUEST
GET https://app.filespin.io/api/v1/assetcollection/{id}[?load_assets=y]
If the optional URL parameter load_assets=y
, the response will contain the entire Asset Data for each asset under extended_result
key.
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP RESPONSE
Respone JSON as shown.
API response JSON
{
"status": "OK",
"data": {
"id": 21,
"user_id": 45,
"name": "SELECTED_ASSETS",
"description": "",
"last_update": "2022-01-24T09:11:05Z",
"assets": ["3b5123160c474720931292c33eb46c52"],
"group_access": false,
"user_name": "John Doe",
"user_email": "john@example.org",
"extended_result": {}
}
}
Parameter | Type | Description |
---|---|---|
status | string | "OK" or "ERROR" |
data | JSON | Collection in Asset Collection JSON format |
Asset Collection - Get All
Retrieve Collections upto a maximum of 30. For retrieving additional collections, use the Collection Search API with pagination.
# get all collections
curl -H "X-FileSpin-Api-Key:API_KEY" \
https://app.filespin.io/api/v1/assetcollections
HTTP REQUEST
GET https://app.filespin.io/api/v1/assetcollections
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP RESPONSE
Collections API response JSON looks like below:-
{
"status": "OK",
"data": {
"total_collections": 1,
"collections": [
{COLLECTION_JSON}
]
}
}
Parameter | Type | Description |
---|---|---|
status | string | "OK" or "ERROR" |
data->total_collections | integer | total number of collections, includes private and group collections user has access to |
data->collections | JSON | List of Collections in Asset Collection JSON format |
Asset Collection - Search
Search and retrieve Collections with pagination. Use the total_collections
and limit
to calculate offset
to paginate.
Search asset collections
curl -X "POST" -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{
"keyword": "test",
"private_only": false,
"last_update_range": {"start": "2022-03-18T01:01:01Z", "end": "2022-04-24T01:01:01Z"},
"sort_by": ["group_access ASC", "name ASC", "last_update DESC"],
"offset": 0,
"limit": 30
}' \
https://app.filespin.io/api/v1/collections
HTTP REQUEST
POST https://app.filespin.io/api/v1/assetcollections
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
REQUEST JSON
The request payload JSON keys are as below.
Parameter | Type | Description |
---|---|---|
keyword (optional) | string | keyword to search with. Keyword will match any word in Collection name . Defaults to empty string (equivalent to * wildcard) |
private_only (optional) | boolean | true if only private collections should be returned. Defaults to false |
last_update_range (optional) | JSON | Like {"start": "2022-03-18T01:01:01Z", "end": "2022-04-24T01:01:01Z"} where the dates are ISO 8601 datetime format values |
sort_by (optional) | JSON | Example: ["group_access ASC", "name ASC", "last_update DESC"] where group_access ,name , last_update are the only allowed sort fields. ASC is for ascending natural sort order,DESC is for descending natural sort order. To sort by group_access , then name and then by last_update , list them in sequence as in the example. |
offset (optional) | integer | offset for paging. Defaults to 0 |
limit (optional) | integer | Page limit. Defaults to 30. Maximum is 30. |
HTTP RESPONSE
Same as /api/v1/collections response above.
Asset Collection - Create
Create new Asset Collection
curl -X "POST" -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Test Collection",
"public": false,
"assets": ["b3ad7854e1ad4ce8a8c83272447f980b","caf2b5f2e80a40729e32489ee65ef0d8"]
}' https://app.filespin.io/api/v1/assetcollection
HTTP REQUEST
POST https://app.filespin.io/api/v1/assetcollection
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
REQUEST PARAMETERS
Parameter | Type | Description |
---|---|---|
name | string | Collection name. Defaults Collection {timestamp} |
assets | JSON | List of asset ids. Defaults to empty list |
description (optional) | string | Collection description. Defaults to empty string |
group_access (optional) | boolean | true or false . Defaults to false |
HTTP RESPONSE
Collection in Asset Collection JSON
format
Asset Collection - Duplicate
Duplicate an Asset Collection
Duplicate an asset collection
curl -X "POST" -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{
"source_id": 1,
"name": "My Collection",
"description": "a description",
"group_access": false
}' https://app.filespin.io/api/v1/assetcollection
HTTP REQUEST
POST https://app.filespin.io/api/v1/assetcollection
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
REQUEST PARAMETERS
Parameter | Type | Description |
---|---|---|
source_id | number | Source Collection id to duplicate |
name (optional) | string | Collection name. Defaults to Source Collection Name formatted as Copy of {Source Collection Name} @ {timestamp} |
description (optional) | string | Collection description. Defaults to source collection description |
group_access (optional) | boolean | true or false . Defaults to false |
HTTP RESPONSE
Collection in Asset Collection JSON format.
Asset Collection - Update
Update existing Asset Collection for name, assets and privacy.
update a collection by id (id provided in URL)
# update a collection by id (id provided in URL)
curl -X "PATCH" -H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Test Collection - API update",
"description": "example description",
"additions": ["26f6bc383a2c499c9b6eb4015755c0e1","1f2a84d6bf5c47dfa39c47b44032a86d","19d8a0d7efbe40f3b93485371df39697"],
"deletions": ["1f2a84d6bf5c47dfa39c47b44032a86d"],
"group_access": false
}' https://app.filespin.io/api/v1/assetcollection/1
HTTP REQUEST
PATCH https://app.filespin.io/api/v1/assetcollection/{id}
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
REQUEST PARAMETERS
Parameter | Type | Description |
---|---|---|
id | number | Collection id |
name (optional) | string | Collection name |
description (optional) | string | Collection description |
group_access (optional) | boolean | true or false . Defaults to false |
additions (optional) | JSON | List of asset ids to add to collection |
deletions (optional) | JSON | List of asset ids to remove from collection |
Note:
- only Collection creator can change Collection name, description and group_access. Attempts by other other users to update these fields will be ignored.
- If the collection has group_access set to true, other users in group can add or remove assets in collection
HTTP RESPONSE
The updated collection is returned.
Note that extended_result
will not be returned in the response.
Asset Collection - Replace assets
Replace all existing Assets in a Collection
replace collection assets with new asset list
curl -X "PUT" \
-H "X-FileSpin-Api-Key:API_KEY" -H "Content-Type: application/json" \
-d '{
"assets": ["b3ad7854e1ad4ce8a8c83272447f980b"]
}' https://app.filespin.io/api/v1/assetcollection/1
HTTP REQUEST
PUT https://app.filespin.io/api/v1/assetcollection/{id}
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
REQUEST PARAMETERS
Parameter | Type | Description |
---|---|---|
id | number | Collection id |
assets | JSON | List of Collection id to be updated |
HTTP RESPONSE
Standard HTTP Codes
Asset Collection - Clear assets
Clear all Assets from a Collection by putting an empty list of assets.
remove collection assets
curl -X "PUT"
-H "X-FileSpin-Api-Key:API_KEY" \
-H "Content-Type: application/json" -d '{
"assets": []
}' https://app.filespin.io/api/v1/assetcollection/1
HTTP REQUEST
PUT https://app.filespin.io/api/v1/assetcollection/{id}
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
REQUEST PARAMETERS
Parameter | Type | Description |
---|---|---|
id | number | Collection id |
assets | JSON | List of Collection id to be updated |
HTTP RESPONSE
Standard HTTP Codes
Asset Collection - Delete
Delete a Collection
delete an asset collection
curl -X "DELETE"
-H "X-FileSpin-Api-Key:API_KEY" \
https://app.filespin.io/api/v1/assetcollection/2
HTTP REQUEST
DELETE https://app.filespin.io/api/v1/assetcollection/{id}
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP RESPONSE
Standard HTTP Codes
Asset Collection - Download
Download assets in a Collection as a zip file or retrieve a downloadable URL.
get a link to downloadable zip file
curl -X "GET" \
-H "X-FileSpin-Api-Key:API_KEY" \
https://app.filespin.io/api/v1/assetcollection/2/download?as_url=y
start a zip file download immediately
curl -X "GET" \
-H "X-FileSpin-Api-Key:API_KEY" \
https://app.filespin.io/api/v1/assetcollection/2/download
HTTP REQUEST
GET https://app.filespin.io/api/v1/assetcollection/{id}/download[?as_url=y]
Set optional URL parameter as_url=y
to retrieve a URL for a downloadable zip file instead of immediate download. as_url
defaults to n
.
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP RESPONSE
If as_url
parameter is set to y
, the response body contains the download URL.
If as_url
parameter is not set to, download will start immediately. Download will be a zip file with Content-Disposition
header set to attachment; filename="download.zip"
.
User API
APIs to manage users and user settings.
Admin User - Activation
Newly signed-up Admin users will receive an activation email that takes them through the activation process.
Once an admin user is signed-up, they can login to create users more users within their user group. An Admin user can also create users using User API.
User JSON Format
All User API responses use the following User JSON format.
{
"id": "USER_ID",
"access_id": "ACCESS_ID",
"apikey": "API_KEY",
"email": "user@example.org",
"first_name": "FIRST NAME",
"last_name": "LAST NAME",
"enabled": true,
"invite_status": "REGISTERED",
"role_id": "ROLE_ID",
"group_id": "GROUP_ID",
"locale": "en_US",
"permissions": [
],
"role_name": "MANAGER",
"uploadKey": "UPLOADKEY",
"group_asset_access": true,
"addons": ["STORYBOARD", "AUDIO_SUBTITLES"]
}
Key | Value | Description |
---|---|---|
id | number | User id |
access_id | string | Access id, used for signing requests for CDN APIs |
apikey | string | API Key. Used for making API request. Do not share |
string | User email. Must be a valid and accessible email. | |
apikey | string | API Key. Used for making API requests. |
first_name | string | First name of user |
last_name | string | Last name of user |
enabled | boolean | true is user is enabled. false is disabled |
invite_status | string | REQUESTED = Login not activated yet. REGISTERED = activated and ready for use. |
role_id | number | Role id (see Users & Roles section for details) |
group_id | string | User group ID |
locale | string | Default User locale |
permissions | List | List of Permissions. Permissions are string tokens that define what actions a user is allowed to perform. Permissions are determined by User Role (see Users & Roles section for details) |
role_name | string | Role name (built-in) |
uploadKey | string | Upload Key for use in FileSpin Picker for file uploads. Note that a USER role will not be allowed to upload files even if they have a valid Upload Key. |
group_asset_access | boolean | If true allows this user access to assets created by all users within the user group. If false , they can only see their own assets |
addons | List | Addons available for the User. Note that even if an addon is available, they may not have permission to use it or may not have it enabled. |
User - Get
A user can retrieve their own data using this API or User Administrator can retrieve a user within their user group.
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP REQUEST
GET https://app.filespin.io/api/v1/users/{user_id}
RESPONSE JSON
As defined in User JSON Format section above.
User - Get All
User Administrator can retrieve all users within their user group. A maximum of 30 users can be retrieved in one request. Use the total_users
and offset
parameter to retrieve more users.
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
GET HTTP REQUEST
Get upto 30 users.
GET https://app.filespin.io/api/v1/users
Get one user by passing the user_id
.
GET https://app.filespin.io/api/v1/users/{user_id}
POST HTTP REQUEST
Retrieve more users usingoffset
parameter. Can also be used with filtering criteria such as email
, first_name
, etc.
POST https://app.filespin.io/api/v1/users
REQUEST JSON
{
"email": "user@example.org",
"first_name": "FIRST NAME",
"last_name": "LAST NAME",
"enabled_only": false,
"offset": 0
}
Parameter | Type | Description |
---|---|---|
string | Wildcards are not allowed, however partial email string such as user@example will be matched. |
|
first_name | string | Wildcards are not allowed, partial string will be matched |
last_name | string | Wildcards are not allowed, partial string will be matched |
enabled_only | boolean | set true to only retrieve enabled users |
offset | number | defaults to 0 . The record number to start from when retrieving users. Calculate this using total_users and the count of actual users retrieved in the request |
RESPONSE JSON
{
"status": "OK",
"total_users": 60,
"count": 30,
"users": [
{USER_DATA_JSON}
]
}
Key | Value | Description |
---|---|---|
status | string | "OK" if request was successfully received, "ERROR" if request cannot be processed |
total_users | number | total users in the user group |
count | number | users in the response |
users | List | List of User JSON |
User - Create
User Administrator can create a user.
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP REQUEST
POST https://app.filespin.io/api/v1/users/new
REQUEST JSON
{
"email": "user@example.org",
"first_name": "FIRST NAME",
"last_name": "LAST NAME",
"password": "PASSWORD",
"role_id": 2,
"template_user_id": 1,
"enabled": true,
"group_asset_access": true,
"notification_email": true
}
Parameter | Type | Description |
---|---|---|
string | Wildcards are not allowed, however partial email string such as user@example will be matched. |
|
first_name | string | Wildcards are not allowed, partial string will be matched |
last_name | string | Wildcards are not allowed, partial string will be matched |
password | string | Set new user's password. Must be 8 to 32 chars long |
role_id | number | use a pre-defined role id, see above. |
template_user_id | number (optional) | the user_id whose settings should be copied for the new user. Defaults to caller's user id |
enabled | boolean (optional) | Set status of the new user. If set to false , user will be created but will remain disabled until the admin enables them. Defaults to true |
group_asset_access | boolean (optional) | If set to true , user have access to all assets created by users in the user group. Defaults to false |
notification_email | boolean (optional) | Set to true to send an email to user informing of their new account. The email will include a temporary login password which they'll be asked to change. Defaults to false |
User - Update
User can update their own data. User Administrator can update a user within the user group.
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
POST HTTP REQUEST
PATCH https://app.filespin.io/api/v1/users
or
POST https://app.filespin.io/api/v1/users
REQUEST JSON
All request parameters are optional for PATCH/POST request
{
"email": "user@example.org",
"first_name": "FIRST NAME",
"last_name": "LAST NAME",
"role_id": 2,
"old_password": "OLDPASSWORD",
"new_password": "NEWPASSWORD"
}
Parameter | Type | Description |
---|---|---|
string | Email id. Should be a vaid email. | |
first_name | string | First name |
last_name | string | Last name |
role_id | number | Only User Administrator can update this. For Role Ids see Users & Roles section |
old_password | string | Must be provided if caller is self-updating their own password |
new_password | string | Must be provided if caller is self-updating their own password. Must be atleast 7 characters |
User Settings - Get
HTTP REQUEST
GET https://app.filespin.io/api/v1/user/settings
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP RESPONSE
{
"status": "OK",
"data": {
"watermark": {
"watermarkFile": "/api/v1/user/watermark/42",
"watermarkPlacement": "top-left",
"watermarkScale": 0.1
},
"storage": {
"originals_root": "MY_BUCKET-orig",
"originals_root_folder": "my/files",
"derivatives_root": "MY_BUCKET-deriv",
"derivatives_root_folder": "my/files",
"transcodes_root": "MY_BUCKET-trans",
"transcodes_root_folder": "my/files",
"originals_root_ok": true,
"derivatives_root_ok": true,
"transcodes_root_ok": true,
"originals_root_geo": "eu-west-1",
"derivatives_root_geo": "eu-west-1",
"transcodes_root_geo": "eu-west-1"
},
"auth": {
"upload_key": "a8cf2507c0334c04ac0b41ecf251ca11",
"access_id": "IZJTAMBQGAYDAMBQGAYDAMBQGAYDANJQ",
"api_key": "2cbb94afed5a491ea048f628b13ec2e3",
"dropbox_app_key": "",
"dropbox_app_secret": "",
"authorized_domains": "mysite.org,mysite.com"
},
"webhook": {
"web_urls": "https://mysite.com/receive_filespin_callback",
"callback_events": {
"file-saved": false,
"file-processed": true,
"file-data-updated": false,
"file-deleted": true,
"file-undeleted": true,
"addon-processed": true
}
},
"image": {
"conversions": [
{
"key": "500x500WEB",
"value": {
"format": "jpg",
"watermark": false,
"enabled": true,
"public": false,
"height": 500,
"width": 500,
"optimize": true,
"dpi": 72
}
},
{
"key": "deepzoom",
"value": {
"format": "jpg",
"public": true,
"watermark": false,
"enabled": true,
"height": null,
"width": null,
"optimize": true,
"dpi": 72
}
}
],
"on_demand_image_private": false
},
"video": {
"video_transcode_test_mode": false,
"transcodes": {
"360p-video": {
"enabled": false,
"aspect": "pad",
"upscale": true,
"public": false,
"padding": "ff0000",
"width": 640,
"height": 360,
"watermark": false
},
"360p-wm-video": {
"enabled": false,
"aspect": "pad",
"upscale": true,
"public": true,
"padding": "000000",
"width": 640,
"height": 360,
"watermark": true
},
"480p-video": {
"enabled": true,
"aspect": "pad",
"upscale": true,
"public": false,
"padding": "000000",
"width": 854,
"height": 480,
"watermark": false
},
"480p-wm-video": {
"enabled": true,
"aspect": "pad",
"upscale": true,
"public": true,
"padding": "000000",
"width": 854,
"height": 480,
"watermark": true
},
"720p-video": {
"enabled": true,
"aspect": "pad",
"upscale": true,
"public": false,
"padding": "000000",
"width": 1280,
"height": 720,
"watermark": false
},
"720p-wm-video": {
"enabled": false,
"aspect": "pad",
"upscale": true,
"public": true,
"padding": "000000",
"width": 1280,
"height": 720,
"watermark": true
},
"1080p-video": {
"enabled": false,
"aspect": "pad",
"upscale": true,
"public": false,
"padding": "000000",
"width": 1920,
"height": 1080,
"watermark": false
},
"1080p-wm-video": {
"enabled": false,
"aspect": "pad",
"upscale": true,
"public": true,
"padding": "000000",
"width": 1920,
"height": 1080,
"watermark": true
},
"hls-video": {
"enabled": false,
"aspect": "pad",
"upscale": true,
"public": true,
"padding": "000000",
"watermark": false,
"width": 1920,
"height": 1080
}
},
"preview": {
"video_preview_name": "preview",
"video_preview_public": true,
"video_preview_start": 0,
"video_preview_length": 5,
"video_preview_preset": "480p-wm-video",
"video_preview_enabled": true,
"video_preview_aspect": "pad",
"video_preview_padding": "ff0000",
"video_preview_upscale": true
},
"thumbnails": {
"video_default": {
"width": 640,
"height": 480
},
"storyboard": {
"enabled": true,
"mode": "number",
"mode_value": 5,
"width": 480,
"height": 360,
"public": true,
"aspect": "pad",
"padding": "ff0000",
"upscale": true
}
}
},
"database": {
"db_url": "mysql://",
"db_export_events": {
"file-saved": true,
"file-processed": true,
"file-data-updated": true,
"file-deleted": true,
"file-undeleted": true,
"addon-processed": false
}
},
"cdn": {
"image_cdn": "mycdn.filespin.io",
"video_cdn": "mycdn.filespin.io"
},
"addons": {
"COLOR_INFO": {
"title": "Dominant Colors for Images",
"description": "Dominant Colors for Images",
"added": true,
"enabled": true
},
"CLIP_PATH": {
"title": "JPG to PNG using Clipping path",
"description": "JPG to PNG using Clipping path",
"added": true,
"enabled": true
},
"IMAGE_ANALYSIS": {
"title": "ML-based Image auto-tagging",
"description": "ML-based Image auto-tagging",
"added": true,
"enabled": true
},
"STORYBOARD": {
"title": "Video Storyboard",
"description": "Video Storyboard",
"added": true,
"enabled": true
},
"AUDIO_SUBTITLES": {
"title": "Multilingual Audio Subtitles",
"description": "Multilingual Audio Subtitles",
"added": false,
"enabled": false
}
}
}
}
User Settings - Update
Update user settings by sending a PATCH
HTTP request with partial settings to update. The JSON payload follows the same structure as GET
request response. Only keys below are valid.
storage
, auth
, webhook
, database
, image
, video
,addons
Request payload format for each key above is in the following sections.
HTTP REQUEST
PATCH https://app.filespin.io/api/v1/user/settings
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP RESPONSE
Standard HTTP error codes.
Storage update
Update storage
by sending below payload. All keys are mandatory.
{
"key": "storage",
"value": {
"originals_root": "MY-S3-BUCKET",
"originals_root_folder": "folder/path",
"derivatives_root": "MY-S3-BUCKET",
"derivatives_root_folder": "folder/path",
"transcodes_root": "MY-S3-BUCKET",
"transcodes_root_folder": "folder/path"
}
}
Auth update
Update auth
by sending below payload. All keys are mandatory.
{
"key": "auth",
"value": {
"upload_key": "c2c94d0eddc3446184f3dd3f7a6ad6cf",
"authorized_domains": "filespin.io, myapp.example.org",
"dropbox_app_key": "dropbox_app_key",
"dropbox_app_secret": "dropbox_app_secret",
"api_key": "c2f93d0eddc3446184f3dd3f7a6ad6fc"
}
}
- Key values can be empty strings.
upload_key
andapi_key
must be RFC4122 compliant hex value of UUID4 (that is, only alphanumeric characters are allowed,-
is not allowed).authorized_domains
- Controls domain names allowed for thisupload_key
used in File Picker. Empty value here will allow all domains. A maximum of ten domains are allowed, naked domains (like filespin.io) will authorize all subdomains.
Webhook update
Update webhook
by sending below payload. All keys are mandatory.
{
"key": "webhook",
"value": {
"web_urls": "https://myapp.example.org/receiver, https://myapp-backup.example.org/receiver",
"callback_events": {
"file-saved": true,
"file-processed": true,
"file-data-updated": true,
"file-deleted": true,
"file-undeleted": true,
"addon-processed": false
}
}
}
web_urls
can be an empty string. A maximum of three URLs will be accepted (sent as a single comma seperated string).callback_events
accepts the keys listed in Webhooks Events section
Database update
Update database
by sending below payload. All keys are mandatory.
{
"key": "database",
"value": {
"db_url": "mysql://USER:PASSWORD@DB_HOST/DATABASE"
}
}
db_url
can be an empty string- All events listed in Webhooks Events section are auto-enabled for DB export
Image update
Update image
by sending below payload. All keys are mandatory.
{
"key": "image",
"value": {
"is_on_demand_private": false,
"conversions": [
{
"key": "500x500WEB",
"value": {
"format": "jpg",
"watermark": false,
"enabled": false,
"public": false,
"height": 500,
"width": 500,
"dpi": 72
}
},
{
"key": "deepzoom",
"value": {
"watermark": false,
"enabled": false,
"public": true
}
}
]
}
}
deepzoom
is a special key withinconversions
. Fordeepzoom
only these keys can be updated:watermark
,enabled
,public
. Other key values will be ignored
- A maximum of 5 conversions is allowed to be added/updated (including
deepzoom
)
Video update
Update video
by sending below payload. All keys are mandatory except storyboard
(storyboard
is needed only when Video Storyboard addon is enabled).
{
"key": "video",
"value": {
"video_transcode_test_mode": true,
"thumbnails": {
"video_default": {
"height": 480,
"width": 640
},
"storyboard": {
"enabled": true,
"mode": "number",
"mode_value": 5,
"width": 480,
"height": 360,
"public": true,
"aspect": "pad",
"padding": "000000",
"upscale": true
}
},
"preview": {
"video_preview_public": true,
"video_preview_start": "00:00:03.001",
"video_preview_length": 5,
"video_preview_preset": "480p-wm-video",
"video_preview_enabled": true,
"video_preview_aspect": "pad",
"video_preview_padding": "000000",
"video_preview_upscale": true
},
"transcodes": {
"360p-video": { "enabled": true, "public": false, "aspect": "pad", "padding": "000000", "upscale": true },
"360p-wm-video": { "enabled": true, "public": true, "aspect": "pad", "padding": "000000", "upscale": true },
"480p-video": { "enabled": true, "public": false, "aspect": "pad", "padding": "000000", "upscale": true },
"480p-wm-video": { "enabled": true, "public": true, "aspect": "pad", "padding": "000000", "upscale": true },
"720p-video": { "enabled": true, "public": false, "aspect": "pad", "padding": "000000", "upscale": true },
"720p-wm-video": { "enabled": true, "public": true, "aspect": "pad", "padding": "000000", "upscale": true },
"1080p-video": { "enabled": true, "public": false, "aspect": "pad", "padding": "000000", "upscale": true },
"1080p-wm-video": { "enabled": true, "public": true, "aspect": "pad", "padding": "000000", "upscale": true },
"hls-video": { "enabled": true, "public": true, "aspect": "pad", "padding": "000000", "upscale": true, "watermark": true }
}
}
}
aspect
specifies how the output video will be filled if it's aspect does not fit the requested size. It can be one of:pad
,preserve
,scale
,crop
padding
specifies the HEX color code (without the # prefix) to use for padding a video is aspect ispad
storyboard->mode
andstoryboard->mode_value
keys specifies how the storyboard images will be captured. It can be one of:number
(Extractmode_value
images over entire video, such as when mode_value is 5, it'll extract 5 images over the entire video evenly spaced)second
(Extract an image everymode_value
second over entire video)keyframes
(Extract keyframes over entire video,mode_value
will be ignored)
video_preview_start
specifies the strating time as either a second (like 5), or as%H:%M:%S.%f
wheref
is the frame to start.
Addons update
Update addons
by sending below payload. All addons provided in GET /user/settings
API must be supplied.
{
"key": "addons",
"value": {
"COLOR_INFO": {
"added": true,
"enabled": true
},
"CLIP_PATH": {
"added": true,
"enabled": true
},
"STORYBOARD": {
"added": true,
"enabled": true
}
}
}
added
specifies whether the user has added this available addon to their accountenabled
specifies whether this addon has been activated by user
Watermark update
There are two steps to update watermark. STEP 1
is to upload a new watermark which is optional. STEP 2
is to update the watermark placement and scaling and optionally confirm the file uploaded in STEP 1
as the new watermark.
STEP 1(optional): Upload watermark file
Upload a image as watermark using multipart/form-data
HTTP POST
Note that the uploaded file is not set as Watermark immediately and must be confirmed via another API call.
HTTP REQUEST
POST https://app.filespin.io/api/v1/user/settings/watermark
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP RESPONSE
Contains the uploaded File key watermarkFileKey
that must be sent for confirmation in STEP 2.
{ "url": "http://app.filespin.io/tempurl/image.jpg", "watermarkFileKey":
"FILE_KEY", }
STEP 2: Update Watermark options and confirm new watermark file
Watermark Placement and Scaling and optionally the newly uploaded file from STEP 1 can be updated as below.
HTTP REQUEST
PATCH https://app.filespin.io/api/v1/user/my/files
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
REQUEST JSON
{
"key": "watermark",
"value": {
"watermarkFileKey": watermarkFileKey,
"watermarkPlacement": watermarkPlacement,
"watermarkScale": watermarkScale
}
}
Parameter | Type | Description |
---|---|---|
watermarkFileKey (optional) | string | use watermarkFileKey returned by watermark file upload API call |
watermarkPlacement | string | center , top-left , top-right , bottom-left or bottom-right |
watermarkScale | number | between 0 and 1, like 0.1, 0.5, 0.9, etc. A value of 0.1 would place a watermark that is not larger than 10% in width and height of the target image |
User Notifications - Get
Get the notifications API. Notifications are system messages to a user to provide information such as asset events, etc.
Notifications are limited to latest 100.
HTTP REQUEST
GET https://app.filespin.io/api/v1/user/notifications
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP RESPONSE
Standard HTTP code and JSON payload as below.
{
"notifications": [
{
"id": 2,
"message": "Collection updated by joe@example.org",
"url": "/collection/1",
"disposal": "ON_ACK",
"timestamp": "2022-05-14T07:08:49Z"
},
{
"id": 1,
"message": "Welcome! New notifications will appear here.",
"url": null,
"disposal": "ON_READ",
"timestamp": "2022-05-15T07:08:15Z"
}
]
}
Parameter | Details |
---|---|
id | Notification id, used for disposing |
message | Notification text |
url | Any associated URL |
disposal | What should be done with the message. See below |
timestamp | ISO 8601 datetime indicating when the notification was issued |
Notifications have two disposals listed below.
Disposal type | Details |
---|---|
ON_READ |
Can be disposed automatically |
ON_ACK |
User acknowledgement required |
User Notifications - Delete
Delete notifications API.
HTTP REQUEST
POST https://app.filespin.io/api/v1/user/notifications
REQUEST JSON PAYLOAD
List of notification ids.
[1, 2, 3]
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
HTTP RESPONSE
Standard HTTP codes.
Jobs API
Jobs API provides status of all user initiated jobs in FileSpin.
Jobs List - Get
/jobs
API returns the list of of a jobs initiated by caller.
The following section provide the specification for API request/response
HTTP REQUEST
HTTP GET https://app.filespin.io/api/v1/jobs[?offset=0&limit=10]
URL Parameter | Value | Description |
---|---|---|
offset (optional) | integer | Defaults to 0. The offset paging results. Use limit and total value in first call response to paginate |
limit (optional) | integer | Defaults to 30. The number of jobs to return |
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
RESPONSE JSON
The API call will return with a JSON response as below.
{
"count": 15,
"limit": 30,
"offset": 0,
"total": 15,
"jobs": [
]
}
key | Value | Description |
---|---|---|
count | integer | The number of jobs returned in this response |
offset | integer | Defaults to 0. The offset for job records |
limit | integer | Defaults to 30. The number of jobs to return |
total | integer | The total number of jobs initiated by the caller |
jobs | JSON | The list of job JSON as specified in Job Status - Get |
Job Status - Get
/jobs/{job_id}
API returns the status of a job.
The following section provide the specification for API request/response
HTTP REQUEST
HTTP GET https://app.filespin.io/api/v1/jobs/{job_id}
Use your API Key to send the API request JSON as below:-
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
RESPONSE JSON
The API call will return with a JSON response as below.
{
"status": "COMPLETED",
"message": "",
"job_id": 1234,
"creator_id": 272,
"requested_at": "2017-04-20T16:08:02Z",
"completed_at": "2017-04-20T16:08:02Z",
"job_steps": {
},
"input": {},
"callback": {},
"type": "VIDEO_TRANSCODE"
}
Key | Value | Description |
---|---|---|
status | string | Can be "QUEUED", "IN_PROGRESS", "COMPLETED", "ERROR" |
message | string | On "ERROR" status, this will contain the error message that can be used to diagnose the error |
job_id | integer | the job ID to track the job |
creator_id | integer | id of the user who initiated the job |
requested_at | string | ISO 8601 datetime, time at which the job request was received |
completed_at | string | ISO 8601 datetime, time at which the job completed |
job_steps | JSON | the job steps and step completion timestamps. This is useful for monitoring progress. The steps will vary depending on the job type. |
input | JSON | the API request JSON that created this job |
callback | JSON | the callback JSON issued if job completed. If job is not completed yet, this will be an empty dictionary |
type | string | the job type. Only "VIDEO_TRANSCODE" supported at this time |
Steps for Video Transcode Job
The job_steps for VIDEO_TRANSCODE
job type is as below:-
{
"transcodes": {
"480p-video": {
"status": "COMPLETED",
"percent_complete": 100,
"started_at": "2023-07-18T15:09:24Z",
"finished_at": "2023-07-18T15:09:28Z",
"message": ""
}
},
"addons": {
"storyboard": {
"status": "COMPLETED",
"percent_complete": 100,
"started_at": "2023-07-18T15:06:12Z",
"finished_at": "2023-07-18T15:08:46Z",
"message": ""
}
},
"preprocess": {
"status": "COMPLETED",
"percent_complete": 100,
"started_at": "2023-07-18T15:09:24Z",
"finished_at": "2023-07-18T15:09:25Z",
"message": "Downloaded & verified integrity of input file test.mov"
},
"postprocess": {
"status": "COMPLETED",
"percent_complete": 100,
"started_at": "2023-07-18T15:09:26Z",
"finished_at": "2023-07-18T15:09:28Z",
"message": "Completed uploading outputs"
}
}
Key | Value | Description |
---|---|---|
status | string | Can be "QUEUED", "IN_PROGRESS", "COMPLETED", "ERROR" |
message | string | On "ERROR" status, this will contain the error message that can be used to diagnose the error |
percent_complete | integer | job progress as percentage value |
started_at | string | ISO 8601 datetime, time at which the step processing was started |
finished_at | string | ISO 8601 datetime, time at which the step completed |
CDN API
The prefetch
and purge
CDN APIs provide the ability to selectively manage CDN asset cache.
CDN Asset Prefetch
This API provides prefetch for CDN assets. You can use this to pre-cache video assets. If you have more than a few assets to pre-cache, we recommend that you batch them in one API call.
Note:
- API payload can have upto 1000 asset URLs in one batch
- Cache expiry can range from 12 hours to 30 days (720 hours)
- The asset_urls parameter should start with /video or /conversion
- If the CDN Asset URL is not public, it must be a signed URL part - see Signing URLs
Using your API Key send a request as below:-
HTTP REQUEST
HTTP POST https://app.filespin.io/api/v1/cdn/prefetch
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
REQUEST JSON
The request body should be a JSON as below.
{
"asset_urls": ["/video/8e563c1435e643b19fea2d42f2f73948/720p-wm-video.mp4"],
"cache_expiry": 12
}
Example CDN prefetch request
curl -X "POST" "https://app.filespin.io/api/v1/cdn/prefetch" \
-H "X-FileSpin-Api-Key: 0de9d8e207974dc7b29c76372890e4ca" \
-H "Content-Type: application/json; charset=utf-8" \
-d $'{
"asset_urls": [
"/video/8e563c1435e643b19fea2d42f2f73948/480p-wm-video.mp4",
"/video/8e563c1435e643b19fea2d56f2f73948/720p-wm-video.mp4?expiry=1510659108&accessId=IZJTAMBQGAYDAMBQGAYDAMBQDBYDAMBR&signature=dwtRLuuL0PSmC-ZoIsh5zerMguc%3D"
],
"cache_expiry": 168
}'
Key | Value | Description |
---|---|---|
asset_urls | list | List of asset URLs parts. Maximum of 1000 URLs. These URLs can be Video Streaming URLs. |
cache_expiry | integer | Number of hours this asset should be cached. Must be from 12 to 720. |
CDN Asset Purge
This API provides purge option for CDN assets. You can use this to purge cached video assets. If you have more than a few assets to purge, we recommend that you batch them in one API call.
Note:
- API payload can have upto 1000 asset URLs in one batch
- The asset_urls parameter should start with /video or /conversion
- If the CDN Asset URL is not public, it must be a signed URL part - see Signing URLs
Using your API Key send a request as below:-
HTTP REQUEST
HTTP POST https://app.filespin.io/api/v1/cdn/purge
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
RESPONSE JSON
The request body should be a JSON as below.
{
"asset_urls": ["/video/8e563c1435e643b19fea2d42f2f73948/720p-wm-video.mp4"]
}
Example CDN purge request
curl -X "POST" "https://app.filespin.io/api/v1/cdn/purge" \
-H "X-FileSpin-Api-Key: 0de9d8e207974dc7b29c76372890e4ca" \
-H "Content-Type: application/json; charset=utf-8" \
-d $'{
"asset_urls": [
"/video/8e563c1435e643b19fea2d42f2f73948/480p-wm-video.mp4",
"/video/8e563c1435e643b19fea2d56f2f73948/720p-wm-video.mp4?expiry=1510659108&accessId=IZJTAMBQGAYDAMBQGAYDAMBQDBYDAMBR&signature=dwtRLuuL0PSmC-ZoIsh5zerMguc%3D"
]
}'
Key | Value | Description |
---|---|---|
asset_urls | list | List of asset URLs parts. Maximum of 1000 URLs. These URLs can be Video Streaming URLs. |
Note:
- If the requested asset is not public, these must be signed URLs parts (see cURL example).
- The asset_urls parameter should start with /video or /conversion
Addons & Addon API
FileSpin provides many addons that can be added and used within a user account. These addons provide special and custom processing such as video/audio subtitles, image auto-tags, etc.
Image Editor Addon
FileSpin provides an Image Editor with rich image editing capabilities. The Image Editor can be used in web-based applications.
Image Auto-Tags
FileSpin provides an Add-on for auto-tagging images and capturing analysis metadata such as Labels, Logos, Dominant colors, Web Detection, etc.
Once the add-on is activated, images uploaded are automatically analysed and tag data is captured by FileSpin. Add-on processing can also be initiated for an image by using the Image Processing API with image_analysis
process key.
Auto-tags captured for an asset is automatically added to FileSpin to provide keyword search.
You can make use of /process
API and /reprocess
Batch API to create autotags.
Addon key for process and reprocess API: image_analysis
Also, once processing completes, Asset Data JSON will contain process state for the addon as below:
{
"addons_info": {
"IMAGE_ANALYSIS": {
"available": true
}
}
}
Retrieve Auto-tags
API to retrieve an image asset's auto-tag data.
HTTP REQUEST
GET https://app.filespin.io/api/v1/assets/{ASSET_ID}/addons/image_analysis
HTTP HEADER
X-FileSpin-Api-Key:API_KEY
Where API_KEY should be replaced with your API Key
REQUEST PARAMETERS
Parameter | Description |
---|---|
ASSET_ID | File's unique FileSpin ID, 32 character alphanumeric UUID |
RESPONSE JSON
{
"labelAnnotations": [
{
"score": 0.8699386,
"data": "alabel"
}
],
"bestGuessLabels": [
{
"label": "red elephant",
"languageCode": "en"
}
]
}
Parameter | Description |
---|---|
labelAnnotations | List of labels with confidence score (0 = least confident, 1= very confident) |
bestGuessLabels | Best guess summary of the image |
Image Clipping Path
FileSpin provides Clipping Path Add-On for JPG images to automatically generate on-demand transparent PNG images after applying clipping path described within a JPG image. This allows dynamic background color for images based on page specific styles.
Once the add-on is activated, transparent PNG on-demand images are automatically generated for uploaded images. For any valid JPG image with Clipping Path data embedded within, Clipping Path processing can be initiated using the Image Processing API with smart_imaging
process key.
You can make use of /process
API and /reprocess
Batch API.
Addon key for process and reprocess API: smart_imaging
Also, once processing completes, Asset Data JSON will contain process state for the addon as below:
{
"addons_info": {
"CLIPPIPNG_PATH_JPG2PNG_ODI": {
"available": true
}
}
}
Image Color Palette
FileSpin provides Color Palette Add-on for analysing images and capturing dominant color and palette information.
Once the add-on is activated, images uploaded are automatically analysed and analysis data is captured by FileSpin.
To retrieve color data for an image use the Asset Get Data API and check for ColorPalette
within metadata
.
You can make use of /process
API and /reprocess
Batch API.
Addon key for process and reprocess API: color_info
Also, once processing completes, Asset Data JSON will contain process state for the addon as below:
{
"addons_info": {
"DOMINANT_COLOR_INFO": {
"available": true
}
}
}
Tools & Integrations
FileSpin provides Smart Uploaders, Webhook integrations and Database export mechanisms to integrate your applications.
Teleport
The FileSpin Teleport is a native application that provides both a dashboard and APIs to enable you to manage and upload assets. One of its key features is the ability to continuously monitor specific folders (Watched Folders, a.ka. Hot Folders) and upload files in the background, providing a reliable and efficient way to upload assets while automatically managing bandwidth usage and seamlessly handling any connectivity loss.
To begin using the FileSpin Teleport, you can contact the FileSpin Support team, who will provide you with instructions on how to download and install the Teleport, as well as guide you on setting up the Watched Folders to monitor for new files. Once installed, you can access the Teleport dashboard to manage and monitor your assets.
If you need further assistance, the FileSpin Support team will be available to help you with any questions or issues that may arise related to both the Teleport dashboard and APIs.
Teleport API
The FileSpin Teleport is a native application that provides a reliable and efficient way to upload assets by continuously monitoring specific folders, known as Watched Folders, while automatically managing bandwidth usage and handling connectivity loss seamlessly. In addition to the dashboard interface, the Teleport exposes APIs that allow programmatic access to its features.
First-time Login & Activation
To get started with Teleport, visit the Teleport Dashboard and login using your FileSpin Cloud Login. The login will be validated against the FileSpin Cloud account. Once logged in, you will be able to use Teleport without having to login again.
Asset Archival Policy
On successful upload of hot-folder asset to the Cloud, these assets are archived. Assets are archived for 30 days by default. This can be changed by the IT administrator. Once an asset is archived, it will be available in read-only mode and cannot be updated via Teleport API.
Please note the following limitations for archived assets:
/data
- Asset Get Data API will returnARCHIVED
status for archived assets. This is a special status available only for archived assets./update
Asset Update Data API cannot be used for assets that have been archived/conversions
- Asset Get Conversion API cannot be used for assets that have been archived- Archived assets will be completely deleted after the period specified in archival policy
Using Teleport API
The Teleport API is follows the same semantics as the FileSpin Cloud API for supported APIs. Please see below for APIs supported by Teleport.
/search
- Search AssetsHTTP POST {FILESPIN_TELEPORT_HOST}/api/v1/assets/search
- Search for assets that are currently available in hot-folders and archive. For more details refer to Asset Search.
/conversions{?resize=300,300}
- On-demand Image TransformationsHTTP GET {FILESPIN_TELEPORT_HOST}/api/v1/assets/{ASSET_ID}/conversions
- To retrieve display images with on-demand transformations. Please refer to On-demand Image Transformations.
/data
- Asset Get DataHTTP GET {FILESPIN_TELEPORT_HOST}/api/v1/assets/{ASSET_ID}/data
- Retrieve an Asset's data that includes Core metadata, Custom metadata, conversions and addon details. For more details refer to Asset Get Data.
- API will return
ARCHIVED
status for archived assets
/upload
- Asset UploadHTTP POST {FILESPIN_TELEPORT_HOST}/api/v1/assets/new/content/original/upload (multipart/form-data)
- Upload a file to Teleport's default hot-folder. For more details refer to Asset Upload.
/update
- Asset Update DataHTTP POST {FILESPIN_TELEPORT_HOST}/api/v1/assets/{ASSET_ID}/update
- Save custom JSON data with an asset. For more details refer to Asset Update Data.
- API cannot be used for assets that have been archived
/conversions
- Asset Get ConversionHTTP GET {FILESPIN_TELEPORT_HOST}/api/v1/assets/{ASSET_ID}/conversions/{conversion_name}
- Retrieve a specific conversion of an Asset. For more details refer to Asset Get Conversion.
/content/{conversion_name}
- Asset Add ConversionHTTP POST {FILESPIN_TELEPORT_HOST}/api/v1/assets/{ASSET_ID}/content/{conversion_name}
- Upload and add a custom conversion file to an Asset. For more details refer to Asset Add Conversion.
- API cannot be used for assets that have been archived
/content/{conversion_name}/download
- Asset Download Conversion- HTTP Request:
GET {FILESPIN_TELEPORT_HOST}/api/v1/assets/{ASSET_ID}/content/{conversion_name}/download
- Details: Retrieve the original file or a pre-defined image conversion or a video transcode. HTTP Range header can also be used to retrieve large file as multiple parts. For more details refer to Asset Download.
- HTTP Request:
Teleport User Guide
This Guide is intended for FileSpin Teleport Administrators who are responsible for managing the application using the on-premise Web Dashboard.
The on-premise Web Dashboard interface is accessible via any modern browser within the network that FileSpin Teleport is deployed.
Access to the application requires a valid FileSpin Cloud user account with Administrator
role.
FileSpin Teleport provides the ability to:-
- create and manage
Watched Folders
and upload schedules - manage upload policies
- monitor progress of ongoing upload jobs and job status
Configuring Watched Folders
The Watched Folder
feature enables automatic upload of files (Push to Cloud ) by monitoring a specific folders and sending the files
to FileSpin Cloud automatically. The files that have been successfully sent to the cloud are either deleted from the local folder or moved to an archive folder based on the upload policy.
To mark one or more folders as Watched folders:-
- click on the "Add Watched Folder" button
- in the dialog that opens, provide scheduling information and the addon services to enable for the folder
- Addon Services are deployment specific. Examples: Face Recognition, Image Background Removal, etc
At any time, you can modify Watched Folder
settings or remove a folder being a Watched Folder
.
Creating a job manually
In addition to using the Watched Folder
feature, you can also create an upload job manually by clicking on the "New Job" button in the Teleport dashboard. This feature allows you to manually select the folders to upload.
Setting Upload Policy
The Teleport dashboard also provides the option to set the upload policy, which determines how the Teleport will handle file uploads.
Webhooks
Webhooks are web application URLs (such as https://www.example.org/my-hook) that you specify in your Settings profile for FileSpin service to provide automatic callback notification of events such as asset uploads, updates, etc.
You save multiple webhooks in your settings profile to receive these callback notifcations.
Asset Events
Webhook callbacks are issued for the following asset events:-
Event | Description |
---|---|
file-saved | When a file is stored in your storage after user uploads a file through File Picker or through Upload API |
file-processed | When image and video conversions are processed for a file as part of upload workflow or via Image or Video Conversion API |
file-data-updated | When custom data is attached to a file using FileSpin.update method of File Picker or using Update File Data API |
file-deleted | When image conversions, video transcodes or the original file is deleted using Delete API |
file-undeleted | When the original file is undeleted using Undelete API |
addon-processed | An addon has completed processing |
Webhook data format
The events and their webhook callback data format is as listed below:-
Event | Data format |
---|---|
file-saved | Asset Data Format |
file-processed | Asset Data Format |
file-data-updated | Asset Data Format |
file-deleted | See below |
file-undeleted | See below |
addon-processed | Asset Data Format |
On-demand image (ODI) is available for assets after they are processed the first time. Availability of ODI for an asset is indicated with the ON_DEMAND_IMAGE
key in addons_info
of Asset Data JSON.
"addons_info": {
"ON_DEMAND_IMAGE": {
"available": true
}
}
Successful "file-deleted" event - Example data
{
"event": "file-deleted",
"id": "d78aa1a301ef4a2fbd8fa0cffd835b79",
"keys": ["deepzoom"],
"status": "OK",
"statusMsg": ""
}
Unsuccessful "file-deleted" event - Example data
{
"event": "file-deleted",
"id": "d78aa1a301ef4a2fbd8fa0cffd835b79",
"keys": ["deepzoom"],
"status": "ERROR",
"message": "S3 Permission denied",
"errors": {
"deepzoom": "S3 Permission denied"
}
}
Successful "file-undeleted" event - Example data
{
"event": "file-undeleted",
"id": "d78aa1a301ef4a2fbd8fa0cffd835b79",
"keys": ["original"],
"status": "OK",
"message": ""
}
Unsuccessful "file-undeleted" event - Example data
{
"event": "file-undeleted",
"id": "d78aa1a301ef4a2fbd8fa0cffd835b79",
"keys": ["original"],
"status": "ERROR",
"message": "Undeletion error"
}
Unlike the other events, file-deleted
and file-undeleted
events only provide details about the deletion/undeletion and not the complete file details.
The data format for file-deleted
and file-undeleted
are as shown in the code sample to the right.
JSON Parameters
Key | Value | Description |
---|---|---|
id | string | file id |
event | string | file-deleted or file-undeleted |
keys | JSON | list of keys sent in original request for deletion |
status | string | "OK" if call was successful, "MAYBE" if FileSpin.io is uncertain (check the statusMsg in this case), "ERROR" if call could not be fully completed. If "ERROR" is returned, "errors" will contain specific error details for each failed key |
message | string | Additional details about status |
errors | JSON | Contains the keys that failed and specific error message. See sample response. |
Database Export
MySQL export
FileSpin can export Asset data to your MySQL database. To use this feature, create a table named FILE_DATA_V2 table shown below in your database and update your account settings to point to this database.
CREATE TABLE `FILE_DATA_V2` (
`status` varchar(11) DEFAULT NULL,
`event` varchar(30) DEFAULT NULL,
`user_id` int(11) NOT NULL,
`update_user_id` int(11) NOT NULL,
`id` char(32) NOT NULL,
`name` varchar(200) NOT NULL,
`size` int(11) DEFAULT NULL,
`content_type` varchar(100) DEFAULT NULL,
`checksum` char(40) DEFAULT NULL,
`upload_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`provider` varchar(50) DEFAULT NULL,
`data` text,
`key` varchar(100) NOT NULL,
`bucket` varchar(500) NOT NULL,
`storage_type` varchar(30) DEFAULT NULL,
`conversions` varchar(2000) DEFAULT NULL,
`public` tinyint(1) DEFAULT NULL,
UNIQUE KEY `file_id` (`id`),
KEY `file_name` (`name`),
KEY `user_id` (`user_id`),
KEY `mime_type` (`content_type`),
KEY `status` (`status`)
) CHARSET=utf8;
The table structure corresponds to Asset Data format used across FileSpin APIs and Webhook callback payload.
Service Limits
Type | Limit |
---|---|
Users, User Groups | Upto 200 users in one user group. Upto 10 user groups. To increase these limits, please contact Support. |
Assets | No limit |
Image resizing | Upto 30 MB source image. To setup resizing of images larger than 30 MB, please contact Support. |
Video transcoding | Upto 15 GB. To setup transcoding of larger videos, please contact Support. |
Image formats (source) | Standard image formats: jpg, png, bmp, tiff, gif, webp, etc. RAW formats: raf, cr2, iiq, mos, raw, rw2, tif, fff, 3fr, nef and many more |
Video formats (source) | 3GP, AAC, AVI, FLV, MOV, MPEG-2, MP4, WMV, etc. |
Release notes
July 2023
Cloud Uploads - Dropbox now allows users to upload an entire folder from Dropbox to FileSpin. Additionally, the hard limit on number of Dropbox files shown is removed, a Load more
button allows user to progressively load more files from Dropbox.
Job API has been extended to allow retrieval of video transcode Jobs and comprehensive Job progress. For developer docs visit Jobs API
section.
May 2023
/trim option for on-demand images that allows you to trim the image to remove transparent pixels from the edges of the image. Performance improvements for on-demand image processing.
Mar 2023
Teleport on-premise software that allows batch asset migration from on-premise locations and on-premise processing of assets.
Jan 2023
Web Image Editor a new web based image editor that allows you to edit images in the browser. This editor is available in the Filespin Picker and Filespin Connector. Also available as a javascript component to embed in your applications.
Dec 2022
Asset Metadata Schema API a full-featured API for managing Asset Metadata Schema. This API allows you to create, update, delete and retrieve Asset Metadata Schema. For developer docs visit Asset Schema
section.
Mar 2022
Headless DAM: New User Management API release
Mar 2022
Headless DAM: New Collections API release
Jan 2022
Headless DAM: Picker, Connector release at js.filespin.io domain
Mar 2021
Addon: Automatic Video Subtitles with multiple languages including automatic WebVTT generation, WebVTT editor and CDN delivery of subtitles for video player embeds.
Feb 2021
File Picker 2.0 released with versatile Image editor, additional APIs for more control, improved user experience.
Dec 2020
Performance improvements for global users Global platform upgrade that enhances API and CDN performance for all users.
Sep 2020
Addon: Advanced Image Corrections pipeline addon Based on ML-pipelines.
June 2020
Platform feature: ML-based image processing pipelines released Platform feature that adds ability to deploy custom ML processing pipelines.
27 Mar 2020
Processing status of On-demand image for an asset after upload. We have introduced a new key within "Common File Data Format" called ON_DEMAND_IMAGE that will indicate the processing status of On-demand Image. It will be set in the payload on every webhook callback for an asset and /data API call response.
17 Feb 2020
Download option for Image and Video CDN asset delivery released. The additional URL parameters can be used to allow downloadable delivery of assets via image and Video CDN. The parameters allow you to set the name of downloaded file.
25 Sep 2019
Additional debug messages on file transformation failures.
webp support for background colors. For supported browsers, webp format images will be automatically returned for dynamic image sizing, also includes correct handling of background color param.
20 May 2019
New UI features and updates released. Easily manage Addons within the UI. Lot of minor bug fixes and improvements.
Dominant color addon released. Retrieve dominant color information for an image asset.
Clipping Path JPG2PNG addon released. Apply Clipping path embedded in a JPG to create transparent PNG on-demand image. This allows dynamic background color for images based on page specific styles.
12 Mar 2019
New UI features released. New UI features that allow list view of assets along with UI preferences for styling views released.
Dropped support for Instagram Uploads. We have dropped support for Instagram cloud uploads.
27 Sep 2018
filespin.js - FileSpin.delete() API released. This new filespin.js API allows you to delete a user upload from the frontend javascript immediately after an upload.
Dropped support for Instagram Uploads. We have dropped support for Instagram cloud uploads.
Sep 2018
Asset Metadata Schema is released. This is a major feature that introduces the ability to assign a JSON Schema for Asset metadata. This feature enables powerful metadata management and search capabilities to help users manage and find assets more quickly and easily. For developer docs visit Asset Schema
section.
Dropped support for Facebook Uploads. We have dropped support for Facebook cloud uploads.
17 Sep 2018
Webhooks with Configurable Events. This new options allows you to selective enable the events for which Webhook callbacks should be made. For developer docs visit Webhooks
Asset Events section.
30 July 2018
Instant Download is released. This feature allows users to start downloading asset collections instantly without delays. Whether the collection has a few files or a hundred files, download will start instantly.
5 Feb 2018
Image Analysis add-on for images released. This allows automatic image tagging and search.