Skip to main content

Endpoint

POST /api/generateImage
Generates an AI image based on a text prompt. The endpoint processes your prompt and returns image data that can be displayed or stored.

Request body

prompt
string
required
The text description of the image you want to generate. Be descriptive for best results.

Response

textData
string
The generated image data returned from the AI model. This typically contains the image URL or base64-encoded image data.

Example request

curl -X POST https://your-domain.com/api/generateImage \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A serene mountain landscape at sunset with pine trees"
  }'

Example response

{
  "textData": "https://example.com/generated-image-url.png"
}

Error codes

400
error
Bad request - The prompt parameter is missing or invalid
500
error
Internal server error - The image generation service failed to process the request

Build docs developers (and LLMs) love