PublishQPublishQ

Rename media folder

POST
/media/folders/rename

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

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