The endpoints, the keys, the limits. Reference for the AI image endpoints — generate, remove, expand — with auth, CORS, and rate limits.
Morph exposes a set of AI-powered image endpoints at api.morph.cool. These endpoints power Artboard's AI features and can be used by developers building integrations.
https://api.morph.coolAll requests use HTTPS. HTTP requests are rejected.
Authentication
AI image endpoints (generate, remove, expand) do not require authentication for basic use. They are rate-limited by IP address. Endpoints that modify user data (conversions, bell, leaderboard) require a JWT token passed as a Bearer token in the Authorization header.
Authorization: Bearer <jwt_token>
Rate Limits
All endpoints are rate-limited to prevent abuse. Exceeding the limit returns a 429 status with a JSON error.
- Artboard AI endpoints — 10 requests per minute per IP (KV-backed).
- Conversion logging — requires authentication, no separate IP limit.
- Error reporting — 30 requests per minute per IP.
- Waitlist — 10 requests per minute per IP.
Generate Image
POST /artboard/generate
Text-to-image generation and inpainting. Send a canvas image with a mask to fill in selected regions based on a text prompt. Also supports a describe mode that returns a text description of the image.
| Field | Type | Description |
|---|---|---|
| prompt | string | Text description of what to generate. Not required in describe mode. |
| canvasImagerequired | string | Base64-encoded PNG of the canvas content. |
| maskImage | string | Base64-encoded PNG of the selection mask. White = area to fill. Required for inpainting, not needed for describe. |
| mode | string | Set to "describe" for image description mode. Omit for generation. |
Generation response:
{
"result": "<base64_png_string>"
}
Describe response:
{
"result": "A detailed text description of the image content."
}
Validation: In describe mode, the PNG must be at least 64×64 pixels. Smaller images return a REGION_TOO_SMALL error.
Object Remove
POST /artboard/remove
AI-powered object removal. Paint over an object in the mask and the model fills the area with contextually appropriate content.
| Field | Type | Description |
|---|---|---|
| canvasImagerequired | string | Base64-encoded PNG of the canvas. |
| maskImagerequired | string | Base64-encoded PNG mask. White = area to remove. |
Response:
{
"result": "<base64_png_string>"
}
Generative Expand
POST /artboard/expand
Expand the canvas in a given direction. The AI fills the new area with content that matches the existing image. Uses edge pixel extension for context.
| Field | Type | Description |
|---|---|---|
| canvasImagerequired | string | Base64-encoded PNG of the canvas. Must be 64–4096px on each side. |
| directionrequired | string | One of: left, right, top, bottom, all. |
| expandPxrequired | number | Pixels to expand. Range: 64–512. |
| prompt | string | Optional text prompt to guide the generated content. |
Response:
{
"result": "<base64_png_string>"
}
Validation: The source image must be 64–4096px on each side. The expanded canvas must not exceed 4096px in either dimension. Violations return REGION_TOO_SMALL or CANVAS_TOO_LARGE errors.
Error Responses
All endpoints return JSON error responses with an error field:
{
"error": "RATE_LIMITED"
}
Common error codes:
- RATE_LIMITED — too many requests. Wait and retry.
- REGION_TOO_SMALL — image dimensions below 64×64px minimum.
- CANVAS_TOO_LARGE — expanded canvas exceeds 4096px limit.
- MISSING_FIELDS — a required field was not provided.
Notes
- AI model — all inpainting endpoints use Stable Diffusion v1.5 via Cloudflare Workers AI. Inference steps are capped at 20.
- Image format — all images must be base64-encoded PNGs.
- Privacy — images are processed in-memory and are not stored, logged, or used for model training.
- CORS — endpoints accept requests from
morph.cool,www.morph.cool, andlocalhost:5173. - Timeout — the client should set a 30-second timeout. Server-side processing rarely exceeds 15 seconds.