Imagifly Developer docs
HTTP API

Image generation

Submit image tasks, poll results and read the image model catalog.

Submit a task

POST /api/v1/images/generations

Request body

FieldTypeRequiredDescription
modelstringYesImage model ID from the model catalog.
promptstringYesWhat to draw.
negativePromptstringNoWhat to avoid.
ratiostringNoAspect ratio, default Auto. Examples: 1:1, 16:9, 9:16, 4:3, 3:4.
qualitystringNostandard or high.
resolutionTierstringNo1k or 2k; supported only by some models.
stepsnumber | stringNoReasoning steps, or the presets low, standard, high.
referenceImagesarrayNoReference images, each { "base64": "..." }.

Reference image rules:

  • Base64 only (a data:image/png;base64, prefix is accepted); URLs are not.
  • Maximum 10MB per image after decoding.
  • The count limit is model-specific; read referenceImageLimit from the model list.
  • If the chosen model does not support references, the server switches to a fallback model that does. settings.model in the response is the model that actually ran.

Example

curl -X POST https://imagifly.net/api/v1/images/generations \
  -H "Authorization: Bearer $IMAGIFLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "Minimalist poster of a mountain at dawn, warm gradient sky",
    "ratio": "16:9",
    "quality": "high"
  }'

Response 202 Accepted

{
  "ok": true,
  "generation": {
    "id": "gen_2f1c9a...",
    "status": "generating",
    "cost": 12,
    "size": "1536x864",
    "imageCount": 1
  },
  "settings": {
    "model": "gpt-image-2",
    "ratio": "16:9",
    "resolutionTier": null,
    "steps": null
  }
}
FieldDescription
generation.idTask ID used for polling.
generation.costCredits charged for this task.
generation.sizeOutput size that was chosen.
generation.imageCountNumber of images; always 1.
settingsNormalized parameters that actually applied.

Poll a task

GET /api/v1/images/generations/{id}
{
  "ok": true,
  "generation": {
    "id": "gen_2f1c9a...",
    "status": "success",
    "error": null,
    "durationMs": 18420,
    "imageUrls": ["https://imagedelivery.net/.../public"]
  }
}
FieldDescription
statusgenerating, success or failed.
errorFailure reason; null on success.
durationMsTask duration in milliseconds.
imageUrlsImage URLs on success; an empty array otherwise.

A missing task, or one owned by another account, returns 404 GENERATION_NOT_FOUND.

Model catalog

GET /api/v1/images/models
{
  "ok": true,
  "models": [
    {
      "id": "gpt-image-2",
      "label": "GPT Image 2",
      "credits": 12,
      "resolutionTiers": ["1k", "2k"],
      "resolutionQuality": "high",
      "defaultResolutionTier": "1k",
      "supportsSteps": false,
      "referenceImageLimit": 4
    }
  ]
}

Treat the response as the source of truth: prices, tiers and limits change as models are updated. credits is the base price; options such as resolution, quality and steps can change the final charge.

Notes

  • ratio accepts Auto plus the ratios a model supports; unsupported values are rejected with 400 INVALID_IMAGE_REQUEST.
  • Prompt content is also checked by the model provider. A prompt rejected by the provider produces a failed task with an explanatory error, not an HTTP error on submit.
  • Submit a new task to retry; there is no retry endpoint.

On this page