Upload an image
Upload an image, video, or PDF with POST /uploads and use the returned URL in your post.
Uploads an image, video, or PDF. Put the returned URL in your post content or use it as the cover image.
Request
| Item | Value |
|---|---|
| Method · path | POST /uploads |
| Permission | Write only (write) or higher |
Request fields
Send as multipart/form-data.
| Part | Required | Description |
|---|---|---|
file |
Required | One file to upload. Up to 50 MB |
| Type | Accepted formats |
|---|---|
| Image | jpg jpeg png gif webp avif svg ico |
| Video | mp4 webm mov |
| Document | pdf |
Example
curl -X POST https://api-open.weekerp.com/blog/v1/uploads \
-H "Authorization: Bearer wk_live_xxxxxxxx" \
-F "file=@cover.png"
Response
You get 201 with the file details.
{
"url": "https://…/cover.png",
"resourceType": "image",
"contentType": "image/png",
"size": 182044
}
Put the returned url in the Markdown content () or in the post's thumbnail.
- Weekerp decides the file name and location. Uploading a file with the same name doesn't overwrite the earlier file.
- Uploads count toward the key's Uploads per day limit. Failed uploads don't count.
- If an image is already hosted somewhere else, you can put that URL straight into the content without uploading.
Common errors
| HTTP | code | Fix |
|---|---|---|
| 400 | upload_empty_file |
The file is empty |
| 400 | upload_invalid_extension |
Check that the format is accepted |
| 400 | upload_file_too_large |
Reduce the file to 50 MB or less |
| 429 | daily_image_limit_exceeded |
You've used today's upload limit. Try again tomorrow |
| 503 | image_service_unavailable |
Try again in a moment |
For the full list of errors, see Error format in Publish posts with the blog API.