# Endpoints

Browse directory location

Return the folders and files in the given location

Method: POST

Endpoint: /media-library/browse

Body

PropertyTypeDescription
locationstringThe location to browse

Response

array<File|Folder>

# Uploads

Upload File

Method: POST

Endpoint: /media-library/upload

Body

PropertyTypeRequiredDescription
filefiletrueThe file to be uploaded
locationstringfalse The location in which the file will be saved. A folder will be created if it does exist. If your folder already exists, it's preferred to provide its ID. If using a path name, make sure the location does not include the package's storage path nor your workspace.

Response

File

Example


axios.post('/media-library/upload', { file }).then(function (response) {
  console.log(response.data);
});

Upload Attachment

Method: POST

Endpoint: /media-library/attachment

Body

PropertyTypeRequiredDescription
filefiletrueThe attachment file to be uploaded

Response

Attachment

Purge an attachment

Method: DELETE

Endpoint: /media-library/attachment/{url|attachment-id}

Response

Attachment

# File Management

Update File

Method: POST

Endpoint: /media-library/update/{file-id}

Body

PropertyTypeDescription
namestringThe file resource name; not the filename
descriptionstringUpdates the file's description
privatebooleanUpdates the file's privacy

Response

File

Move File

Move file into the provided location.
Location is the combination of the directory location and name.
If the folder does not exist, one is created. If a folder ID is provided and it doesn't exist, the operation fails.

Method: POST

Endpoint: /media-library/move/{file-id}

Body

PropertyTypeDescription
locationstring The location to move the file to. The folder ID or path. It's preferred to provide IDs, otherwise make sure the location does not include the package's storage path nor your workspace.

Response

File

Delete File

Method: DELETE

Endpoint: /media-library/delete/{file-id}

Body

FieldTypeDescription
forcebooleanForce delete the file

Response

File

Get downloadable link

Method: POST

Endpoint: /media-library/downloadable-link/{file-id}

Body

PropertyTypeDescription
ttlintegerIn seconds. For private files; the ttl from the time of request the url is valid for

Response

FieldTypeDescription
urlstringA url to download the file

Get file shareable link

Method: POST

Endpoint: /media-library/share/{file-id}

Body

PropertyTypeDescription
namestringThe name of the resource. Defaults to the file or folder name
descriptionstringThe description of the resource
publicbooleanWhether the shared content is public
access_emailsarrayIf not public, a list of emails that may authenticate to access content
access_keysarrayRequired if not public. A list of access codes. Each code must be at least 6-digits
access_typeenumIndicate if the access is a token or secret. Values: `token`, `secret`. The default is `token`
expires_atstring (ISO 8601)Sets an expiry on the resource
can_removebooleanIndicate whether shared files/folders may be deleted
can_uploadbooleanIf sharing a folder, whether files may be uploaded
can_uploadbooleanIf sharing a folder, whether files may be uploaded
max_downloadsintegerLimit max downloads
allowed_upload_typesarrayLimit uploadable mime types

Response

FieldTypeDescription
idstringThe shared content resource ID
urlstringA url to share with external

# Folder Management

Create Folder

Method: POST

Endpoint: /media-library/folder/create

Body

PropertyTypeDescription
namestringThe folder resource name
locationstring The location folder ID or path to place the folder. If a path is provided, parent folders may be created if they dont exists. If creating a subfolder, it's preferred to provide its ID. Otherwise make sure the location does not include the package's storage path nor your workspace.
descriptionstringUpdates the folder's description
privatebooleanUpdates the folder's privacy

Response

Folder

Update Folder

Method: POST

Endpoint: /media-library/folder/update/{folder-id}

Body

PropertyTypeDescription
namestringThe folder resource name
descriptionstringUpdates the folder's description
privatebooleanUpdates the folder's privacy

Response

Folder

Move Folder

Move folder into the provided location.
Location is the combination of the directory location and name.
If the folder does not exist, one is created. If a folder ID is provided and it doesn't exist, the operation fails.

Method: POST

Endpoint: /media-library/folder/move/{folder-id}

Body

PropertyTypeDescription
locationstring The location to move the folder to. The location folder ID or path. It's preferred to provide IDs, otherwise make sure the location does not include the package's storage path nor your workspace.

Response

Folder

Delete Folder

Method: DELETE

Endpoint: /media-library/folder/delete/{folder-id}

Body

FieldTypeDescription
forcebooleanForce delete the folder

Response

Folder

Get folder shareable link

Method: POST

Endpoint: /media-library/folder/share/{file-id}

Body

PropertyTypeDescription
namestringThe name of the resource. Defaults to the file or folder name
descriptionstringThe description of the resource
publicbooleanWhether the shared content is public
access_emailsarrayIf not public, a list of emails that may authenticate to access content
access_keysarrayRequired if not public. A list of access codes. Each code must be at least 6-digits
access_typeenumIndicate if the access is a token or secret. Values: `token`, `secret`. The default is `token`
expires_atstring (ISO 8601)Sets an expiry on the resource
can_removebooleanIndicate whether shared files/folders may be deleted
can_uploadbooleanIf sharing a folder, whether files may be uploaded
can_uploadbooleanIf sharing a folder, whether files may be uploaded
max_downloadsintegerLimit max downloads
allowed_upload_typesarrayLimit uploadable mime types

Response

FieldTypeDescription
idstringThe shared content resource ID
urlstringA url to share with external