Jimeng Official Format Query Task
curl --request POST \
--url https://www.token-nova.com/jm \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"req_key": "<string>",
"task_id": "<string>",
"req_json": "<string>"
}
'import requests
url = "https://www.token-nova.com/jm"
payload = {
"req_key": "<string>",
"task_id": "<string>",
"req_json": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({req_key: '<string>', task_id: '<string>', req_json: '<string>'})
};
fetch('https://www.token-nova.com/jm', 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://www.token-nova.com/jm",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'req_key' => '<string>',
'task_id' => '<string>',
'req_json' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.token-nova.com/jm"
payload := strings.NewReader("{\n \"req_key\": \"<string>\",\n \"task_id\": \"<string>\",\n \"req_json\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.token-nova.com/jm")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"req_key\": \"<string>\",\n \"task_id\": \"<string>\",\n \"req_json\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.token-nova.com/jm")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"req_key\": \"<string>\",\n \"task_id\": \"<string>\",\n \"req_json\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": 10000,
"data": {
"binary_data_base64": [],
"image_urls": null,
"status": "generating"
},
"message": "Success",
"request_id": "67fb9e82-126e-4c71-bb16-a3bb3789e3b7",
"status": 10000,
"time_elapsed": "35.381µs"
}
Jimeng Image
Jimeng Official Format Query Task
Use POST /jm to query the status and result of Jimeng official format tasks.
POST
https://www.token-nova.com
/
jm
Jimeng Official Format Query Task
curl --request POST \
--url https://www.token-nova.com/jm \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"req_key": "<string>",
"task_id": "<string>",
"req_json": "<string>"
}
'import requests
url = "https://www.token-nova.com/jm"
payload = {
"req_key": "<string>",
"task_id": "<string>",
"req_json": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({req_key: '<string>', task_id: '<string>', req_json: '<string>'})
};
fetch('https://www.token-nova.com/jm', 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://www.token-nova.com/jm",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'req_key' => '<string>',
'task_id' => '<string>',
'req_json' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.token-nova.com/jm"
payload := strings.NewReader("{\n \"req_key\": \"<string>\",\n \"task_id\": \"<string>\",\n \"req_json\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.token-nova.com/jm")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"req_key\": \"<string>\",\n \"task_id\": \"<string>\",\n \"req_json\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.token-nova.com/jm")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"req_key\": \"<string>\",\n \"task_id\": \"<string>\",\n \"req_json\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": 10000,
"data": {
"binary_data_base64": [],
"image_urls": null,
"status": "generating"
},
"message": "Success",
"request_id": "67fb9e82-126e-4c71-bb16-a3bb3789e3b7",
"status": 10000,
"time_elapsed": "35.381µs"
}
Jimeng Official Format Query Task
The task query API for Jimeng official format, used to query the status and result of image generation tasks.- The route entry is
POST /jm. ActionandVersionquery parameters are required in the URL.- Specify the task to query through
task_idin the Body. - Returns the task status (
generating,success,failed) and image download URLs.
Method and Path
POST /jm?Action=CVSync2AsyncGetResult&Version=2022-08-31
Request Example
curl -X POST "https://www.token-nova.com/jm?Action=CVSync2AsyncGetResult&Version=2022-08-31" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"req_key": "jimeng_t2i_v40",
"task_id": "67fb9e82-126e-4c71-bb16-a3bb3789e3b7",
"req_json": "{\"return_url\": true}"
}'
import requests
import json
resp = requests.post(
"https://www.token-nova.com/jm",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
"Accept": "application/json",
},
params={
"Action": "CVSync2AsyncGetResult",
"Version": "2022-08-31",
},
json={
"req_key": "jimeng_t2i_v40",
"task_id": "67fb9e82-126e-4c71-bb16-a3bb3789e3b7",
"req_json": json.dumps({"return_url": True}),
},
timeout=60,
)
print(resp.json())
Response Example
Generating
{
"code": 10000,
"data": {
"binary_data_base64": [],
"image_urls": null,
"status": "generating"
},
"message": "Success",
"request_id": "67fb9e82-126e-4c71-bb16-a3bb3789e3b7",
"status": 10000,
"time_elapsed": "35.381µs"
}
Generation Successful
{
"code": 10000,
"data": {
"binary_data_base64": [],
"image_urls": [
"https://example.com/generated-image-1.png",
"https://example.com/generated-image-2.png"
],
"status": "success"
},
"message": "Success",
"request_id": "67fb9e82-126e-4c71-bb16-a3bb3789e3b7",
"status": 10000,
"time_elapsed": "2.5s"
}
Generation Failed
{
"code": 10001,
"data": {
"binary_data_base64": [],
"image_urls": null,
"status": "failed"
},
"message": "Task failed",
"request_id": "67fb9e82-126e-4c71-bb16-a3bb3789e3b7",
"status": 10001,
"time_elapsed": "1.2s"
}
Authentication
Authorization: Bearer YOUR_API_KEY
Query Parameters
string
Operation type. Fixed value:
CVSync2AsyncGetResult (query result).string
API version. Fixed value:
2022-08-31.Body
string
required
Service identifier. Fixed value:
jimeng_t2i_v40.string
required
Task ID. The
task_id returned when the task was created.string
required
A JSON-serialized string. Currently supports watermark configuration and whether to return image links; this can be added in the response result. For example:
{"return_url": true}.Response
integer
Status code.
10000 indicates success.object
Response data container.
array
An array of Base64-encoded images.
array | null
An array of image URLs. Returned when
return_url: true is set in req_json.string
Task status. Possible values:
generating (generating), success (success), failed (failed).string
Status message.
string
Request ID.
integer
Status code.
string
Request duration.
