Get Task Status

This API retrieves the status and details of a specific task using its unique task_id.

API Endpoint

GET https://api.genaifactory.ai/v1/task/{task_id}

Headers

Name
Type
Required
Description

formalcloud-api-key

string

Yes

API key for authentication

Request Parameters

Name
Type
Required
Description

task_id

integer

Yes

The unique identifier of the task.

Example Request

curl --location 'http://api.genaifactory.ai/v1/task/333' \
--header 'formacloud-api-key:  to replace' \
--data ''

Response

Returns a JSON object containing the status, input, output, and details of the requested task.The response will vary based on the task status:

  • Success Response (Status Code 200): Indicates the task completed successfully. The response includes the final output and all relevant task details.

  • Running Response (Status Code 202): Indicates the task is still in progress. The response includes partial details and status updates.

  • Pending Response (Status Code 201): Indicates the task has been created but has not started execution yet. The response includes the task identifier and basic metadata.

  • Failure Response (Status Code 4XX): Indicates an error occurred during task execution or validation. The response includes an error message and details explaining the failure.

Field
Type
Description

created_at

string

The timestamp when the task was created.

finished_at

string

The timestamp when the task was completed.

input_data

array

An array containing the input data for the task.

language_code

string

The language code detected for the input data.

output_data

array

An array containing the output data of the task, if available.

task_id

integer

The unique identifier for the task.

task_status

string

The current status of the task (CREATED, RUNNING, SUCCESS, or FAILED).

task_type

string

The type of task created.

Input Data (input_data)

Field
Type
Description

type

string

The type of the input (e.g., text).

text

object

Contains the input text content.

Output Data (output_data)

Field
Type
Description

type

string

The type of the output (e.g., audio).

url

string

The URL to access the generated output.

length

float

The duration of the output in seconds.

Example Response

{
    "created_at": "Sat, 16 Nov 2024 05:24:47 GMT",
    "finished_at": "Sat, 16 Nov 2024 05:26:03 GMT",
    "input_data": [
        {
            "text": {
                "content": "To resolve this issue, you can run the command as the root user in the Dockerfile. By default, the Docker build process executes commands as root, so this is often a configuration or permissions issue in the Docker environment. Below are several ways to address the issue"
            },
            "type": "text"
        }
    ],
    "language_code": "en",
    "output_data": [
        {
            "length": 17.31918367346939,
            "type": "audio",
            "url": "https://cdn.genaifactory.ai/gen_ai_factory/temp/audio/2024/11/16/0bcc4bc2128142d3b483eddbc1f32a07.mp3"
        }
    ],
    "task_id": 333,
    "task_status": "SUCCESS",
    "task_type": "TTS"
}

Last updated