Rename media folder
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.
Authorization
ApiKeyAuth PublishQ API key sent as Authorization: Bearer pq_live_....
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://publishq.com/api/v1/media/folders/rename" \ -H "Content-Type: application/json" \ -d '{ "path": "Channel A/Shorts", "name": "Reels" }'{
"path": "Channel A/Reels",
"movedCount": 12
}{
"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": "Forbidden",
"status": 403,
"code": "insufficient_scope",
"message": "Missing required scope: media:write",
"instance": "/api/v1/media/folders/rename"
}
}{
"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": "Conflict",
"status": 409,
"code": "media_folder_exists",
"message": "A folder named \"Reels\" already exists here. Folder names ignore capitals, so pick another name.",
"instance": "/api/v1/media"
}
}{
"error": {
"title": "Too Many Requests",
"status": 429,
"code": "rate_limit_exceeded",
"message": "Too Many Requests",
"instance": "/api/v1/media/folders/rename",
"details": {
"retryAfter": 60
}
}
}Move media POST
Move media files to a folder, or to the top level with `folderPath: null`. Moving files into a folder that does not exist yet creates it. Folder names ignore capitals, so a path that differs only in capitals from an existing folder is refused with 409. Posts use media ids, so moving a file never changes a post.
Preview media folder deletion GET
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.