Skip to main content
All examples use the base URL https://api.hedra.com/web-app/public and require an X-API-Key header.
export HEDRA_API_KEY="your_api_key"

Generate an image from a text prompt

curl -X POST https://api.hedra.com/web-app/public/generations \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $HEDRA_API_KEY" \
  -d '{
    "type": "image",
    "text_prompt": "A golden retriever sitting in a field of sunflowers",
    "ai_model_id": "a66300b4-f76e-4c4a-ac41-b31694ff585e",
    "aspect_ratio": "16:9",
    "resolution": "1080p"
  }'

Required fields

FieldDescription
typeSet to "image"
text_promptThe text description of the image to generate
ai_model_idThe model to use (see GET /models for available image models)

Optional fields

FieldDescription
aspect_ratioe.g. "16:9", "9:16", "1:1"
resolutione.g. "540p", "720p", "1080p", "1440p (2K QHD)", "2160p (4K UHD)"
batch_sizeGenerate 1-8 variations at once (default: 1)
enhance_promptSet to true to automatically enhance the prompt

Poll for completion

The response includes a generation id. Poll until status is "complete":
curl https://api.hedra.com/web-app/public/generations/{generation_id}/status \
  -H "X-API-Key: $HEDRA_API_KEY"
When complete, the response includes an asset_id for the generated image.

Available image models

Use GET /models to list all models. Filter by "type": "image" to see image models with their supported resolutions and aspect ratios.
curl https://api.hedra.com/web-app/public/models \
  -H "X-API-Key: $HEDRA_API_KEY"