Task Result
curl --request GET \
--url https://api.novita.ai/v3/async/task-result \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>'import requests
url = "https://api.novita.ai/v3/async/task-result"
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'}
};
fetch('https://api.novita.ai/v3/async/task-result', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.novita.ai/v3/async/task-result",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.novita.ai/v3/async/task-result"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.novita.ai/v3/async/task-result")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novita.ai/v3/async/task-result")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"extra": {
"seed": "<string>",
"enable_nsfw_detection": true,
"debug_info": {
"request_info": "<string>",
"submit_time_ms": "<string>",
"execute_time_ms": "<string>",
"complete_time_ms": "<string>"
}
},
"task": {
"task_id": "<string>",
"status": "<string>",
"reason": "<string>",
"task_type": "<string>",
"eta": 123,
"progress_percent": 123
},
"images": [
{
"image_url": "<string>",
"image_url_ttl": 123,
"image_type": "<string>"
}
],
"videos": [
{
"video_url": "<string>",
"video_url_ttl": "<string>",
"video_type": "<string>"
}
],
"audios": [
{
"audio_url": "<string>",
"audio_url_ttl": "<string>",
"audio_type": "<string>",
"audio_metadata": {
"text": "<string>",
"start_time": {},
"end_time": {}
}
}
]
}Task
Task Result
GET
/
v3
/
async
/
task-result
Task Result
curl --request GET \
--url https://api.novita.ai/v3/async/task-result \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>'import requests
url = "https://api.novita.ai/v3/async/task-result"
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'}
};
fetch('https://api.novita.ai/v3/async/task-result', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.novita.ai/v3/async/task-result",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.novita.ai/v3/async/task-result"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.novita.ai/v3/async/task-result")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novita.ai/v3/async/task-result")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"extra": {
"seed": "<string>",
"enable_nsfw_detection": true,
"debug_info": {
"request_info": "<string>",
"submit_time_ms": "<string>",
"execute_time_ms": "<string>",
"complete_time_ms": "<string>"
}
},
"task": {
"task_id": "<string>",
"status": "<string>",
"reason": "<string>",
"task_type": "<string>",
"eta": 123,
"progress_percent": 123
},
"images": [
{
"image_url": "<string>",
"image_url_ttl": 123,
"image_type": "<string>"
}
],
"videos": [
{
"video_url": "<string>",
"video_url_ttl": "<string>",
"video_type": "<string>"
}
],
"audios": [
{
"audio_url": "<string>",
"audio_url_ttl": "<string>",
"audio_type": "<string>",
"audio_metadata": {
"text": "<string>",
"start_time": {},
"end_time": {}
}
}
]
}This API is used to retrieve images, audio, or video results from v3 asynchronous tasks using the
response
task_id.
Request Headers
string
required
Enum:
application/jsonstring
required
Bearer authentication format, for example: Bearer {{API Key}}.
Query Parameters
string
required
Returned in the 200 response of v3 asynchronous APIs.
Response
object
Show properties
Show properties
string
A seed is a number from which Stable Diffusion generates noise, making generation deterministic. Using the same seed and set of parameters will produce identical images each time, minimum -1.
boolean
When set to true, NSFW detection will be enabled, incurring an additional cost of $0.0015 for each generated image.
object
Task information.
Show properties
Show properties
string
Task ID.
string
Indicates the current status of a task. This parameter allows you to filter results based on the following status categories:
Enum:
TASK_STATUS_QUEUED: The task is queued and awaiting processing. TASK_STATUS_SUCCEED: The task has been processed successfully. TASK_STATUS_FAILED: The task failed during processing. TASK_STATUS_PROCESSING: The task is currently being processed.Enum:
TASK_STATUS_QUEUED, TASK_STATUS_SUCCEED, TASK_STATUS_FAILED, TASK_STATUS_PROCESSINGstring
Provides the reason for a task’s failure. This parameter specifies the explanation or error message associated with tasks that did not succeed. Utilizing this filter can aid in diagnosing issues and implementing corrective actions for failed processes.
string
Specifies the type of task.
number
Specifies the estimated time of completion for tasks, measured in seconds. This parameter is particularly relevant for video-type tasks, providing a forecast of how long it will take to complete the task based on current processing parameters and system load. This information can be vital for planning and resource management in environments with time-sensitive video processing requirements.
number
Progress of task completion in percentage. This feature is currently available only for:
1. Video Generator APIs;
2. Text-to-Image API and Image-to-Image API.
1. Video Generator APIs;
2. Text-to-Image API and Image-to-Image API.
object[]
Contains information about images associated with image-type tasks. This parameter provides detailed data on each image processed or generated during the task, such as file paths, metadata, or any image-specific attributes. It is returned only for tasks that involve image operations, facilitating enhanced tracking and management of image data.
object[]
Contains information about videos associated with video-type tasks. This parameter provides detailed data on each video processed or generated during the task, such as file paths, metadata, or any video-specific attributes. It is returned only for tasks that involve video operations, facilitating enhanced tracking and management of video data.
object[]
Contains information about audios associated with audio type tasks. This parameter provides detailed data on each audio processed or generated during the task, such as file paths, metadata, or any image-specific attributes. It is returned only for tasks that involve audio operations, facilitating enhanced tracking and management of audio data.
Show properties
Show properties
Example
requestcurl --location --globoff 'https://api.novita.ai/v3/async/task-result?task_id={{Novita-TaskID}}' \
--header 'Authorization: Bearer {{API Key}}'
{
"extra": {
"seed": "158881667",
"enable_nsfw_detection": false,
"debug_info": {
"request_info": "",
"submit_time_ms": "",
"execute_time_ms": "",
"complete_time_ms": ""
}
},
"task": {
"task_id": "830d9c90-d53f-4c5a-8009-xxx",
"status": "TASK_STATUS_SUCCEED",
"reason": "",
"task_type": "TXT_TO_IMG",
"eta": 0,
"progress_percent": 0
},
"images": [
{
"image_url": "https://faas-output-image.s3.ap-southeast-1.amazonaws.com/prod/xxx",
"image_url_ttl": 3600,
"image_type": "jpeg",
"nsfw_detection_result": {}
}
],
"videos": [],
"audios": []
}
Last modified on December 24, 2024
Was this page helpful?
⌘I