API reference
Create a persistent image task
/v1/image-tasksThe valid quote_id and Idempotency-Key must match. The task executes once in the background and is settled; generated results are not stored automatically. Do not blindly resend unknown or billing_review tasks. Requests are limited to 128 KiB and unknown fields are rejected. Settled edit/upscale results provide a result URL requiring Bearer authentication; detail and list responses do not embed Base64. If the outcome is unknown, query the original task and never regenerate automatically.
From quote to result
Prepare usable inputs first, obtain a quote, and after explicit confirmation submit quote_id with the original parameters. Quotes do not lock assets. If a user deletes an asset before confirmation, creation may fail; correct the input and obtain a new quote.
Applications should retain both the business request key and task ID. Recover with the original key after a client disconnect; do not regenerate because the status is unknown. For partial success, inspect each result and its saving status separately before deciding whether to download. See Asynchronous tasks and idempotency.
You can also select recoverable mode at the standard image generation endpoint: send Prefer: respond-async and Idempotency-Key. This public extension accepts the current price directly and reuses task queries and file storage. This endpoint still requires quote_id. See Image generation.
Authentication and permissions
Use your current GloopAPI key. Available models, capabilities and permissions depend on its catalog and the endpoint documentation.
Authorization: Bearer $GLOOP_API_KEYAuthentication schemes: BearerAuth
Request
Request headers
Idempotency-KeystringRequiredRetain the original request intent with the same key. After a network interruption, query recovery first; never blindly resend unknown states.
- Minimum length
1- Maximum length
191
Request body · application/json
- Type
- object
- Required fields
model- Additional properties
- false
- Description
- Defaults to generation. Editing requires prompt and references. Upscaling requires one reference image and scale, and does not accept prompt. Editing and upscaling require n=1. Specifications must come from the capability catalog for the selected operation. background_remove removes the background from one image without a prompt and returns a transparent PNG; it does not accept scale, creativity, moderation options, or generation specifications. Use references for uploaded assets, files, or safe HTTPS images.
Request body required
modelstringRequiredPublic model ID from the current key's catalog.
- Maximum length
191
promptstringOptionalGeneration: required, nonempty, and at most 32000 UTF-8 bytes. Editing: required and nonempty, limited by the model's max_prompt_characters and capped at 32768 Unicode characters. Upscaling and background removal: omit or leave empty.
sizestringOptionalChoose a supported size. Aspect-ratio models use it to select proportions, without guaranteeing exact pixel dimensions.
nintegerOptionalOmitted or 0 values normalize to 1. The actual maximum is max_n from image-models; do not treat the global maximum as a model capability.
- Default value
1- Minimum
1- Maximum
6
referencesarrayOptionalSelect only one of file_id, asset_id, or url per item; actual quantity is governed by max_references.
- Maximum items
14
references child fields (1)
[]objectOptional[] child fields (3)
oneOf branch 1
Required in this branch: file_id
oneOf branch 2
Required in this branch: asset_id
oneOf branch 3
Required in this branch: url
source_task_idstringOptionalOptional source task belonging to the same key, for provenance only; does not replace references.
- Maximum length
64
quote_idstringOptionalMust be valid and match the request when creating a task; ignored in quote requests.
moderationstringOptionalModels supporting this capability default to
moderation=auto;lowrequests unblurred output without bypassing model restrictions. Models without this capability reject an explicit moderation parameter. Use the actual public model ID; a name suffix does not change model behavior.- Enum
["auto","low"]
operationstringOptional- Default value
"generate"- Enum
["generate","edit","upscale","background_remove"]
scaleintegerOptionalUpscaling only. Requests exceeding 16,777,216 target pixels are rejected; the scale is not reduced automatically.
- Enum
[2,4]
creativitynumberOptional- Default value
0.01- Minimum
0- Maximum
0.02
output_formatstringOptionalEditing only; defaults to png.
- Enum
["png","jpeg","jpg","webp"]
resolutionstringOptionalSelect values from the model's operation_options. When tiers are available, resolution/quality must be specified explicitly. Configurations without prices cannot be used.
qualitystringOptionalSelect values from the model's operation_options. When tiers are available, resolution/quality must be specified explicitly. Configurations without prices cannot be used.
aspect_ratiostringOptionalSelect values from the model's operation_options. When tiers are available, resolution/quality must be specified explicitly. Configurations without prices cannot be used.
Responses and errors
HTTP 202
Persistent image task created successfully
application/json
- Type
- object
- Required fields
modelpromptsizenreferencesidstatuscreated_atupdated_atreserved_quotafinal_quotabilling_statusresults
modelstringRequiredPublic model ID from the current key's catalog.
promptstringRequiredGeneration prompt.
sizestringRequiredChoose a supported size. Aspect-ratio models use it to select proportions, without guaranteeing exact pixel dimensions.
nintegerRequiredRequested output image count, still constrained by the selected model's maximum.
referencesarrayRequiredList of reference images for generation.
references child fields (1)
[]objectOptional[] child fields (3)
oneOf branch 1
Required in this branch: file_id
oneOf branch 2
Required in this branch: asset_id
oneOf branch 3
Required in this branch: url
source_task_idstringOptionalPublic source task ID, for provenance only.
quote_idstringOptionalPublic quote ID; must satisfy price and request binding on creation.
idstringRequiredPublic identifier of this object, used for its corresponding detail path.
statusstringRequiredunknown is not automatically resubmitted; reserved billing may still be pending.
- Enum
["queued","dispatching","running","succeeded","partial_succeeded","failed","unknown","deleted"]
created_atintegerRequiredCreation time in Unix seconds.
updated_atintegerRequiredLast update time in Unix seconds.
reserved_quotaintegerRequiredReserved quota in platform quota units, not a USD amount.
final_quotaintegerRequiredFinal charge in platform quota units; null means not yet determined.
billing_statusstringRequiredReservation/settlement/refund status; check separately from task and archival status.
error_codestringOptionalPublic error code usable for branching logic.
error_messagestringOptionalUser-facing description processed through public error classification.
resultsarrayRequiredGenerated output item. New results are not stored automatically; each historical file has its own storage state.
results child fields (1)
[]objectOptional[] child fields (7)
file_idstringOptionalPublic ID of a managed file for the same account and key.
storage_statusstringOptionalHistorical file archive status. New generated results are not stored automatically; use the provider results directly.
storage_errorstringOptionalPublic category for file archival failure.
expires_atintegerOptionalExpiration in Unix seconds; 0 means no fixed expiration.
urlstringOptionalAccess URL for a result or reference; signed URLs are only valid briefly.
b64_jsonstringOptionalImage Base64 string; do not request it as a URL.
revised_promptstringOptionalRevised prompt returned by the service, if any.
billingobjectOptionalCaller USD charge converted using the task’s frozen quota scale. final_amount is present only after settlement or refund; a missing amount does not mean zero cost.
billing child fields (4)
currencystringRequired- Enum
["USD"]
reserved_amountstringRequiredReserved USD amount as a decimal string.
final_amountstringOptionalFinal USD charge after settlement or refund. Omitted while settlement is pending.
maximum_amountstringOptionalCertified maximum USD wallet charge under the frozen image quote. Missing means no maximum is certified; reserved_amount alone is not a maximum.
HTTP 400
Invalid request fields or parameters.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional
HTTP 401
The key is missing, invalid, expired, or revoked.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional
HTTP 403
Insufficient IP, account, model, or tool permissions.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional
HTTP 404
Object/capability unavailable, or feature switch disabled.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional
HTTP 409
Idempotency/quote conflict, object not ready, or still referenced.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional
HTTP 429
Request/queue rate limit.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional
HTTP 500
Internal authentication or data storage failure.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional
HTTP 503
Service, pricing, or storage unavailable.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional