Retrieve Image History

The image_history endpoint allows you to query the history of image creation, including the input parameters, creation time, and response results (both successful and failed) within a specified period. This endpoint supports pagination to navigate through large sets of historical data.

API Endpoint

To retrieve the image creation history, send a GET request to the following URL:

GET https://api.genaifactory.ai/v1/image_history

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.

Query Parameters

You can use the following query parameters to specify the time period, pagination, and other details for retrieving the image history:

Name

Type

Required

Description

start

string

No

The start date of the history retrieval period in UTC (e.g., 2023-01-01T00:00:00Z).

end

string

No

The end date of the history retrieval period in UTC (e.g., 2023-01-31T23:59:59Z).

page_size

int

No

The maximum number of records to retrieve per page (default: 10).

page

int

No

The page number to retrieve (default: 1).

task_types

string

No

A comma-separated list of task types to filter results (e.g., POSTER,IMG_WITHOUT_TEXT). Supported values include task types such as POSTER, IMG_WITHOUT_TEXT, and REDRAW_IMAGE. If not provided, the default is POSTER,IMG_WITHOUT_TEXT.

Response Body

The response will include a list of image creation records, each containing the following details:

Name

Type

Required

Description

create_time

string

Yes

The time when the image was created, in UTC.

input_parameters

object

Yes

The input parameters used for creating the image, including struct_content, logo_url, main_image_url, and image_count.

response_result

object

Yes

The response result of the image creation, including the success or failure response.

Example Request two

curl -G 'https://api.genaifactory.ai/v1/image_history' \
-H 'formacloud-api-key: abc123' \
--data-urlencode "start=2023-01-01T00:00:00Z&end=2023-01-31T23:59:59Z&page_size=10&page=1"


curl --location 'https://api.genaifactory.ai/v1/image_history?page_size=2&page=1&task_types=REDRAW_IMAGE' \
--header 'formacloud-api-key: abc123' \
--data ''

Example Response two

Success Response (Status Code 200)

{
    "history": [
        {
            "creation_time": "2025-01-07T21:06:26.632791+00:00",
            "input_parameters": {
                "image": "https://cdn.genaifactory.ai/gen_ai_factory/temp/image/2025/1/7/a32840a4846e48658b3d36378c6992a3.jpg",
                "mask": "https://replicate.delivery/pbxt/M0gpLCYdCLbnhcz95Poy66q30XW9VSCN65DoDQ8IzdzlQonw/kill-bill-mask.png",
                "prompt": "formacloud"
            },
            "response_result": {
                "created_at": "2025-01-07 21:06:26.632791 +00:00",
                "finished_at": "2025-01-07 21:06:41.584666 +00:00",
                "images": [
                    "https://cdn.genaifactory.ai/gen_ai_factory/temp/image/2025/1/7/57f04b22c19549bb95c548dc388bfb68.png"
                ],
                "images_model_names": [],
                "poster_imgs": [
                    "https://cdn.genaifactory.ai/gen_ai_factory/temp/image/2025/1/7/57f04b22c19549bb95c548dc388bfb68.png"
                ],
                "poster_svg_imgs": [
                    null
                ],
                "started_at": "2025-01-07 21:06:26.828427 +00:00",
                "svg_images": [
                    null
                ]
            },
            "task_id": 6928
        },
        {
            "creation_time": "2025-01-07T20:45:50.173454+00:00",
            "input_parameters": {
                "image": "https://cdn.genaifactory.ai/gen_ai_factory/temp/image/2025/1/7/c26c9814f7e4428c971b8c3a63bd8890.jpg",
                "mask": "https://replicate.delivery/pbxt/M0gpLCYdCLbnhcz95Poy66q30XW9VSCN65DoDQ8IzdzlQonw/kill-bill-mask.png",
                "prompt": "movie poster says \\\"moonveil\\\"\""
            },
            "response_result": {
                "created_at": "2025-01-07 20:45:50.173454 +00:00",
                "error": "Error generating image: Cannot connect to host api.bfl.ml:443 ssl:default [Connect call failed ('74.241.144.241', 443)]",
                "finished_at": "2025-01-07 20:45:57.575906 +00:00",
                "images": [],
                "images_model_names": [],
                "poster_imgs": [],
                "poster_svg_imgs": [],
                "started_at": "2025-01-07 20:45:50.328150 +00:00",
                "status": "The task encountered an error and did not complete successfully.",
                "svg_images": []
            },
            "task_id": 6927
        }
    ],
    "pagination": {
        "current_page": 1,
        "total_pages": 9,
        "total_records": 18
    }
}

Failure Response (Status Code 4XX)

{
    "error": "Invalid date range",
}

Last updated