Skip to content

APIs for Media ​

Get all media folders ​

http
GET /api/media/:workspaceId/folder

Request Body ​

No body required

Response ​

ts
type FolderResponse = {
  success: boolean;
  message: string;
  data: Data[];
};

type Data = {
  folder_id: string;
  folder_name: string;
  workspace_id: string;
  created_by: string;
  parent_folder_id: null | string;
  created_at: Date;
  item_count: number;
  sub_folders: Data[];
};

Create media folder ​

http
POST /api/media/:workspaceId/folder

Request Body ​

ts
type CreateFolder = {
  folder_name: string;
  parent_folder_id?: string;
};

Response ​

ts
type CreateFolder = {
  success: boolean;
  message: string;
  data: Data;
};

type Data = {
  folder_id: string;
  folder_name: string;
  workspace_id: string;
  created_by: string;
  parent_folder_id: null;
  created_at: Date;
};

Update Folder Name ​

http
PUT /api/media/:workspaceId/folder/:folderId

Request Body ​

ts
type UpdateFolderName = {
  folder_name: string;
};

Response ​

ts
type UpdateFolderNameResponse = {
  success: boolean;
  message: string;
  data: Data[];
};

type Data = {
  folder_id: string;
  folder_name: string;
  workspace_id: string;
  created_by: string;
  parent_folder_id: string;
  created_at: Date;
};

Delete Folder ​

http
DELETE /api/media/:workspaceId/folder/:folderId

Request Body ​

No body required

Response ​

ts
type DeleteFolderNameResponse = {
  success: boolean;
  message: string;
};

Export folder ​

http
GET /api/media/:workspaceId/folder/:folderId/export

Request Body ​

No body required

Response ​

Downloads a zip

Get all media files ​

http
GET /api/media/:workspaceId/files/:folderId

Request Body ​

No body required

Response ​

ts
type FileResponse = {
  success: boolean;
  message: string;
  data: Data[];
};

type Data = {
  file_id: string;
  folder_id: string;
  file_name: string;
  file_type: string;
  file_path: string;
  uploaded_by: string;
  created_at: Date;
  file_size: string;
};

Create File ​

http
POST /api/media/:workspaceId/file

Request Body ​

ts
type CreateFile = {
  folder_id: string;
  file_name: string;
  file_type: string;
  file_size: string;
};

Response ​

ts
type CreateFileResponse = {
  success: boolean;
  message: string;
  data: Data;
};

type Data = {
  file_id: string;
  folder_id: string;
  file_name: string;
  file_type: string;
  file_path: string;
  uploaded_by: string;
  created_at: Date;
  file_size: string;
};

Update file name ​

http
PUT /api/media/:workspaceId/file/:fileId

Request Body ​

ts
type UpdateFileName = {
  file_name: string;
};

Response ​

ts
type UpdateFileNameResponse = {
  success: boolean;
  message: string;
  data: Data[];
};

type Data = {
  file_id: string;
  folder_id: string;
  file_name: string;
  file_type: string;
  file_path: string;
  uploaded_by: string;
  created_at: Date;
  file_size: string;
};

Delete File ​

http
DELETE /api/media/:workspaceId/files/:fileId

Request Body ​

No body required

Response ​

ts
type DeleteFileResponse = {
  success: boolean;
  message: string;
};

Get folder and files by path ​

http
POST /api/media/:workspaceId/path get folder and files by path

Request Body ​

ts
type Path = {
  path: string[];
};

Response ​

ts
type Response = {
  success: boolean;
  message: string;
  data: Data[];
};

type Data = {
  folder_id: string;
  folder_name: string;
  workspace_id: string;
  created_by: string;
  parent_folder_id: null;
  created_at: Date;
  item_count: number;
};

export file ​

http
GET /api/media/:workspaceId/file/:folderId/:fileId/export

Request Body ​

No body required

Response ​

Downloads files

Move folders and file ​

http
PUT /api/media/:workspaceId/:id/move

Request Body ​

ts
type MoveFolderAndFile = {
  folderId: string;
  type: "file" | "folder";
};

Response ​

ts
type MoveFolderAndFileResponse = {
  success: boolean;
  message: string;
  data: Data[];
};

type Data = {
  folder_id: string;
  folder_name: string;
  workspace_id: string;
  created_by: string;
  parent_folder_id: string;
  created_at: Date;
};