PublishQPublishQ

Preview media folder deletion

GET
/media/folders/delete-preview

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
AuthorizationBearer <token>

PublishQ API key sent as Authorization: Bearer pq_live_....

In: header

Query Parameters

path*string

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
    }
  }
}