Apiframe: retrieve your first API-generated image
Follow an image job through completion, save the output and account for common failures.
Before you start
Prepare an Apiframe account, an HTTP client and a private key. Check model cost and balance; keep the key out of browser code and public repositories. This guide is documentation-based, not a QAILT hands-on test.
Prepare a minimal request
Original QAILT sample JSON body: {"model":"gpt-image-2","prompt":"An abstract travel journal cover, blue and sand geometric shapes, no text or brand"}. The model comes from the checked quickstart; verify availability in your account before submitting.
In your HTTP client, select POST and the generation URL shown below. Set X-API-Key to your own key and Content-Type to application/json. Place the JSON in the request body, not in the URL. Do not share screenshots that reveal the key. QAILT has not executed this sample request.
Submit and follow the job
- Send POST https://api.apiframe.ai/v2/images/generate with X-API-Key, Content-Type: application/json, and a body containing prompt and model. The quickstart uses gpt-image-2.
- Save the returned jobId. QUEUED means the task is waiting, not that an image exists.
- Request GET https://api.apiframe.ai/v2/jobs/{jobId} using the same key. Wait for COMPLETED; inspect error if the state is FAILED.
- On success, open a URL from result.images and save the file. Visually check that the output matches your request.
When an output is missing
For HTTP 402, check credits. For 429, honour Retry-After. Retrying a network request should retain its Idempotency-Key to prevent duplicate generation. CDN storage lasts three months, so save important outputs. Fall back to GET polling if webhook delivery fails.



