Images
Upload and AI-generate cover images for MisarBlog articles.
Upload an Image
/blog/v1/images/uploadUploads an image to the MisarBlog CDN and returns a permanent URL for use in articles. Send as multipart/form-data. Authenticated with your API key (Authorization: Bearer mbk_...).
Request body
filebinarybodyrequiredImage file. Allowed types: JPEG, PNG, WebP, GIF. Maximum size 8 MB. The file's real content is verified against its declared type (magic-byte check).
Response fields
urlstringPermanent CDN URL of the uploaded image. Returned with 201 Created.
curl -X POST https://api.misar.io/blog/v1/images/upload \
-H "Authorization: Bearer mbk_YOUR_KEY" \
-F "file=@cover.jpg"{
"url": "https://supabase-blog.misar.io/storage/v1/object/public/article-images/abc123.jpg"
}Generate a Cover Image (AI)
/blog/v1/images/generateGenerates an AI cover image using a text prompt, stores it on the MisarBlog CDN, and returns the CDN URL. Authenticated with your API key.
Request body
promptstringbodyrequiredImage description. Truncated to 1000 chars before generation.
sizestringbodyOutput dimensions: 1024x1024 | 1792x1024 | 1024x1792 (default: 1024x1024). Any other value falls back to 1024x1024.
Response fields
urlstringPermanent CDN URL of the generated image. Returned with 201 Created. If the CDN upload step fails, the raw generated image URL is returned instead (with 200 OK).
{
"prompt": "A futuristic city skyline with glowing neon signs and flying cars at dusk",
"size": "1792x1024"
}{
"url": "https://supabase-blog.misar.io/storage/v1/object/public/article-images/gen-abc123.png"
}Errors
| Status | Description |
|---|---|
400 | Invalid JSON body or missing prompt |
401 | Invalid or missing API key |
402 | Insufficient credits (generate, when the universal wallet is enabled) |
413 | File exceeds the 8 MB limit (upload only) |
415 | Unsupported file type, or content does not match the declared type (upload only) |
502 | AI image generation failed (generate only) |
503 | Image generation is unavailable (generate only) |