Upload media
Upload one media file with multipart form data. The returned media ID can then be attached to posts.
Upload one media file with multipart form data. The returned media ID can then be attached to posts.
Authorization
ApiKeyAuth AuthorizationBearer <token>
PublishQ API key sent as Authorization: Bearer pq_live_....
In: header
Request Body
multipart/form-data
TypeScript Definitions
Use the request body type in TypeScript.
file*string
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" \ -F file="string"{
"id": "f6370ca1-1f47-4f68-be72-c1206913b326",
"type": "IMAGE",
"url": "https://cdn.publishq.com/uploads/images/f6370ca1-1f47-4f68-be72-c1206913b326.png",
"source": "UPLOAD",
"created_at": "2026-03-28T16:25:41.000Z",
"usageCount": 3
}{
"error": {
"title": "Bad Request",
"status": 400,
"code": "validation_failed",
"message": "Request validation failed",
"instance": "/api/v1/media",
"details": {
"errors": [
{
"path": "mediaTypes.0",
"message": "Invalid option: expected one of \"IMAGE\"|\"VIDEO\"",
"code": "invalid_value"
}
]
}
}
}{
"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"
}
}{
"error": {
"title": "Error",
"status": 413,
"code": "file_too_large",
"message": "File size too large. Maximum size is 100MB.",
"instance": "/api/v1/media"
}
}{
"error": {
"title": "Unsupported Media Type",
"status": 415,
"code": "unsupported_file_type",
"message": "Unsupported file type",
"instance": "/api/v1/media"
}
}{
"error": {
"title": "Too Many Requests",
"status": 429,
"code": "rate_limit_exceeded",
"message": "Too Many Requests",
"instance": "/api/v1/media",
"details": {
"retryAfter": 60
}
}
}