The get_image_result
endpoint allows you to retrieve the final result of a image generation task that was processed asynchronously. By providing the task ID returned from the create_images
endpoint when async
was set to true
, you can check the status of the task and obtain the generated images once the task is complete.
API Endpoint
To retrieve the image generation result, send a GET
request to the following URL:
GET https://api.genaifactory.ai/v1/get_image_result/{task_id}
Headers
Ensure that your request includes the following header:
Name
Type
Required
Description
formacloud-api-key
string
Yes
API key required for authenticating your request.
Path Parameters
Name
Type
Required
Description
task_id
string
Yes
The ID of the task you received when you initially made the asynchronous request.
Response Body
Success Response (Status Code 200)
If the task has completed successfully, the response will include the generated images:
Name
Type
Required
Description
images
array of strings
Yes
A list of URLs pointing to the generated images in PNG format. Each URL corresponds to a generated image.
svg_images
array of strings
Yes
A list of URLs pointing to the generated images in SVG format. Each URL corresponds to a generated image.
Pending Response (Status Code 201)
If the task is still in queue, the response will indicate that the task does not start:
Name
Type
Required
Description
status
string
Yes
A message indicating that the task is still processing.
tasks_ahead_count
int
Yes
The number of tasks ahead of it will be returned from the time a task is created until it is executed
Running Response (Status Code 202)
If the task is still in progress, the response will indicate that the task is not yet complete:
Name
Type
Required
Description
status
string
Yes
A message indicating that the task is still processing.
images
array of strings
No
A list of URLs pointing to the generated images in PNG format. Each URL corresponds to a generated image. The images are currently retained for a maximum duration of one month.
svg_images
array of strings
No
A list of URLs pointing to the generated images in SVG format. Each URL corresponds to a generated image. The images are currently retained for a maximum duration of one month.
Failure Response (Status Code 4XX)
If there is an issue with the request, such as an invalid task ID, the response will include an error message:
Name
Type
Required
Description
error
string
Yes
A descriptive error message indicating what went wrong with the request.
images
array of strings
No
A list of URLs pointing to the generated images in PNG format. Each URL corresponds to a generated image.
svg_images
array of strings
No
A list of URLs pointing to the generated images in SVG format. Each URL corresponds to a generated image.
Example Request
Example Successful Response
Example Pending Response
Example Failure Response