Skip to content

AI

POST /api/v1/projects/{id}/ai/images

Generates an image from a text prompt (or edits an existing one). Body: prompt (required), optional imageUrl to edit an existing PNG/JPEG. Returns { base64, filename } — the generated image as base64 plus a suggested filename.

Terminal window
curl -X POST "https://www.frontend.co/api/v1/projects/$ID/ai/images" \
-H "Authorization: Bearer $FRONTEND_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "prompt": "hero image of a mountain at sunrise" }'
const { base64, filename } = await client.ai.generateImage(projectId, {
prompt: 'hero image of a mountain at sunrise',
})

To save the result into the project’s media library, upload it via the Media endpoints.