# API Endpoints
Browse directory location
Return the folders and files in the given location
Method: POST
Endpoint: /media-library/browse
Body
| Property | Type | Description |
|---|---|---|
| location | string | The location to browse |
| filesOnly | boolean | Only include files in results |
| type | string | File types to include |
| mime | string | File mime types to include |
| private | boolean | Include files or folders with privacy true or false. |
Response
array<File|Folder># Uploads
Upload File
Method: POST
Endpoint: /media-library/upload
Body
| Property | Type | Required | Description |
|---|---|---|---|
| file | UploadedFile | true | The file to be uploaded |
| location | string | false | 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. |
| name | string | false | Name the uploaded file |
| description | string | false | Set a description for the uploaded file |
| private | boolean | false | Set the privacy for the uploaded file |
Response
FileExample
axios.post("/media/upload", { file }).then(function(response) {
console.log(response.data);
});
Upload Attachment
Method: POST
Endpoint: /media-library/attachment
Body
| Property | Type | Required | Description |
|---|---|---|---|
| file | UploadedFile | true | The attachment file to be uploaded |
Response
AttachmentPurge 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
| Property | Type | Description |
|---|---|---|
| name | string | The file resource name; not the filename |
| description | string | Updates the file's description |
| private | boolean | Updates the file's privacy |
Response
FileMove 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
| Property | Type | Description |
|---|---|---|
| location | string | 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
FileDelete File
Method: DELETE
Endpoint: /media-library/delete/{file-id}
Body
| Field | Type | Description |
|---|---|---|
| force | boolean | Force delete the file |
Response
FileGet downloadable link
Method: POST
Endpoint: /media-library/downloadable-link/{file-id}
Body
| Property | Type | Description |
|---|---|---|
| ttl | integer | In seconds. For private files; the ttl from the time of request the url is valid for |
Response
| Field | Type | Description |
|---|---|---|
| url | string | A url to download the file |
| filename | string | Filename of the download |
| mimetype | string | Mimetype of the download |
Get file shareable link
Method: POST
Endpoint: /media-library/shareable-link/{file-id}
Body
| Property | Type | Description |
|---|---|---|
| name | string | The name of the resource. Defaults to the file or folder name |
| description | string | The description of the resource |
| public | boolean | Whether the shared content is public |
| access_emails | array | If not public, a list of emails that may authenticate to access content |
| access_keys | array | Required if not public. A list of access codes. Each code must be at least 6-digits |
| access_type | enum | Indicate if the access is a token or secret. Values: `token`, `secret`. The default is `token` |
| expires_at | string (ISO 8601) | Sets an expiry on the resource |
| can_remove | boolean | Indicate whether shared files/folders may be deleted |
| can_upload | boolean | If sharing a folder, whether files may be uploaded |
| can_upload | boolean | If sharing a folder, whether files may be uploaded |
| max_downloads | integer | Limit max downloads |
| allowed_upload_types | array | Limit uploadable mime types |
Response
| Field | Type | Description |
|---|---|---|
| id | string | The shared content resource ID |
| url | string | A url to share with external |
# Folder Management
Create Folder
Method: POST
Endpoint: /media-library/folder/create
Body
| Property | Type | Description |
|---|---|---|
| name | string | The folder resource name |
| location | string | 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. |
| description | string | Updates the folder's description |
| private | boolean | Updates the folder's privacy |
Response
FolderUpdate Folder
Method: POST
Endpoint: /media-library/folder/update/{folder-id}
Body
| Property | Type | Description |
|---|---|---|
| name | string | The folder resource name |
| description | string | Updates the folder's description |
| private | boolean | Updates the folder's privacy |
Response
FolderMove 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
| Property | Type | Description |
|---|---|---|
| location | string | 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
FolderDelete Folder
Method: DELETE
Endpoint: /media-library/folder/delete/{folder-id}
Body
| Field | Type | Description |
|---|---|---|
| force | boolean | Force delete the folder |
Response
FolderGet folder shareable link
Method: POST
Endpoint: /media-library/shareable-link/folder/{file-id}
Body
| Property | Type | Description |
|---|---|---|
| name | string | The name of the resource. Defaults to the file or folder name |
| description | string | The description of the resource |
| public | boolean | Whether the shared content is public |
| access_emails | array | If not public, a list of emails that may authenticate to access content |
| access_keys | array | Required if not public. A list of access codes. Each code must be at least 6-digits |
| access_type | enum | Indicate if the access is a token or secret. Values: `token`, `secret`. The default is `token` |
| expires_at | string (ISO 8601) | Sets an expiry on the resource |
| can_remove | boolean | Indicate whether shared files/folders may be deleted |
| can_upload | boolean | If sharing a folder, whether files may be uploaded |
| can_upload | boolean | If sharing a folder, whether files may be uploaded |
| max_downloads | integer | Limit max downloads |
| allowed_upload_types | array | Limit uploadable mime types |
Response
| Field | Type | Description |
|---|---|---|
| id | string | The shared content resource ID |
| url | string | A url to share with external |