Preview media folder deletion
Count what deleting a folder would remove: its files and subfolders at every level, and the files that are kept because a draft or scheduled post still uses them. Show these numbers to the user, then send fileCount to Delete media folder. Answers 404 when no folder has that path.
Authorization
ApiKeyAuth PublishQ API key sent as Authorization: Bearer pq_live_....
In: header
Query Parameters
Path of the folder.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X GET "https://publishq.com/api/v1/media/folders/delete-preview?path=Channel+A%2FShorts"{
"path": "Channel A",
"fileCount": 12,
"subfolderCount": 2,
"keptCount": 1
}{
"error": {
"title": "Bad Request",
"status": 400,
"code": "validation_failed",
"message": "Folder name cannot be empty",
"instance": "/api/v1/media"
}
}{
"error": {
"title": "Unauthorized",
"status": 401,
"code": "missing_auth",
"message": "Missing Authorization header",
"instance": "/api/v1/posts"
}
}{
"error": {
"title": "Not Found",
"status": 404,
"code": "media_folder_not_found",
"message": "There is no folder \"Channel A/Shorts\"",
"instance": "/api/v1/media"
}
}{
"error": {
"title": "Too Many Requests",
"status": 429,
"code": "rate_limit_exceeded",
"message": "Too Many Requests",
"instance": "/api/v1/media/folders/delete-preview",
"details": {
"retryAfter": 60
}
}
}Rename media folder POST
Rename a folder. Its files and subfolders keep their place inside it. Answers 404 when no folder has that path, and 409 when a folder with the new name already exists at the same level, so two folders are never merged by accident.
Delete media folder POST
Delete a folder with every file in it and in its subfolders, from the media library and from storage. This cannot be undone. Files a draft or scheduled post still uses are kept, so that post can still publish. Call Preview media folder deletion first and send its `fileCount` as `expectedFileCount`: if the folder changed since, nothing is deleted and the response is 409 with the new counts.