API Reference

DOCS · API REFERENCE

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.

Base URL: https://api.morph.cool
All 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.

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.

FieldTypeDescription
promptstringText description of what to generate. Not required in describe mode.
canvasImagerequiredstringBase64-encoded PNG of the canvas content.
maskImagestringBase64-encoded PNG of the selection mask. White = area to fill. Required for inpainting, not needed for describe.
modestringSet 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.

FieldTypeDescription
canvasImagerequiredstringBase64-encoded PNG of the canvas.
maskImagerequiredstringBase64-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.

FieldTypeDescription
canvasImagerequiredstringBase64-encoded PNG of the canvas. Must be 64–4096px on each side.
directionrequiredstringOne of: left, right, top, bottom, all.
expandPxrequirednumberPixels to expand. Range: 64–512.
promptstringOptional 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:

Notes

Open Morph