Files API
Upload, download, and manage files and folders. Get storage usage statistics.
Endpoints
/api/v1/files/listList user files. Optional params: folderId (filter by folder, use "root" for root level), conversationId, sortBy ("uploadedAt", "size", "fileName"), sortOrder ("asc", "desc"), limit, offset. Returns {files[], total}.
Parameters
conversationId | string | Filter by conversation ID |
folderId | string | Filter by folder ID. Use "root" for root level |
sortBy | string | Sort field: "uploadedAt", "size", or "fileName" |
sortOrder | string | Sort order: "asc" or "desc" |
limit | number | Max files to return (1-100, default: 50) |
offset | number | Number of files to skip for pagination |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/files/list \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"conversationId": "example",
"folderId": "example",
"sortBy": "example"
}'/api/v1/files/getGet a specific file by ID
Parameters
fileId | stringrequired | File ID from list |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/files/get \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"fileId": "example"
}'/api/v1/files/getDownloadUrlGet a presigned download URL for a file (1 hour expiry)
Parameters
fileId | stringrequired | File ID from list |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/files/getDownloadUrl \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"fileId": "example"
}'/api/v1/files/deleteDelete a file (move to trash)
Parameters
fileId | stringrequired | File ID to delete |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/files/delete \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"fileId": "example"
}'/api/v1/files/renameRename a file
Parameters
fileId | stringrequired | File ID to rename |
newName | stringrequired | New file name |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/files/rename \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"fileId": "example",
"newName": "example"
}'/api/v1/files/moveMove a file to a different folder
Parameters
fileId | stringrequired | File ID to move |
folderId | stringrequired | Target folder ID, or null for root |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/files/move \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"fileId": "example",
"folderId": "example"
}'/api/v1/files/listFoldersList folders. Optional param "parentId" (null for root level folders). Returns array with id, name, parentId.
Parameters
parentId | string | Parent folder ID, or null for root level |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/files/listFolders \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"parentId": "example"
}'/api/v1/files/createFolderCreate a new folder
Parameters
name | stringrequired | Folder name |
parentId | string | Parent folder ID, or null for root |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/files/createFolder \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "example",
"parentId": "example"
}'/api/v1/files/renameFolderRename a folder
Parameters
folderId | stringrequired | Folder ID to rename |
newName | stringrequired | New folder name |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/files/renameFolder \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"folderId": "example",
"newName": "example"
}'/api/v1/files/deleteFolderDelete an empty folder
Parameters
folderId | stringrequired | Folder ID to delete. Folder must be empty. |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/files/deleteFolder \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"folderId": "example"
}'/api/v1/files/getUsageGet storage stats. No params. Returns {totalSize (bytes), fileCount}.
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/files/getUsage \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{}'