Skip to main content
POST
GPT Image 2

Parameters and input modes

model and input are required. Pass prompt for text-to-image, or add image_urls to edit existing images.

Use cases

Submit any example to /api/v1/tasks/create_task and replace the prompt or reference URLs with your own.
Poll Query task with the returned task_id or set callback_url. Download completed images within 14 days.

Try in Playground

Set parameters and generate an image.

View pricing

View resolution tiers and billing rules.

Authorizations

Authorization
string
header
required

Sign in to APIstable, then create and copy a key from API Key management.

Send this HTTP header with every request:

Replace YOUR_API_KEY with the key you created.

Body

application/json
model
enum<string>
required

The APIstable model ID for this endpoint.

Available options:
gpt-image-2
Example:

"gpt-image-2"

input
object
required

Image generation parameters.

callback_url
string<uri>

Optional public HTTPS endpoint for signed completion callbacks; no redirects or private IPs.

Callbacks

POST
{$request.body#/callback_url}Webhook

Body

application/json

When the task succeeds or fails, APIstable sends a JSON POST to the callback_url supplied at creation. Verify the signature and return HTTP 2xx to acknowledge delivery.

Read data.status to determine the generation outcome. Partial success also reports succeeded: result.urls lists successful images and result.items reports each item status and charge. For a failed task, data.result is null and data.message contains the failure reason.

Use X-APIstable-Signature, X-APIstable-Timestamp, and X-APIstable-Event-Id to verify and deduplicate deliveries. See Webhook security.

Webhook payload example

code
integer
required
msg
string
required
Allowed value: "success"
data
object
required

Response

2XX

Webhook acknowledged.

Response

Accepted task. Poll the common task endpoint or use callback_url.

code
any
required
msg
any
required
data
object
required