Retrieve task
curl --request GET \
--url https://api-direct.dimilinks.com/v1/tasks/{task_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-direct.dimilinks.com/v1/tasks/{task_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-direct.dimilinks.com/v1/tasks/{task_id}', 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-direct.dimilinks.com/v1/tasks/{task_id}",
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: Bearer <token>"
],
]);
$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-direct.dimilinks.com/v1/tasks/{task_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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-direct.dimilinks.com/v1/tasks/{task_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-direct.dimilinks.com/v1/tasks/{task_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"task_id": "task_xxx",
"status": "NOT_START",
"progress": "50%",
"created_at": 123,
"platform": "openai",
"fail_reason": "<string>",
"finished_at": 123,
"data": {
"created": 123,
"task_id": "task_xxx",
"status": "success",
"data": [
{
"url": "https://lmage2.dimilinks.com/p/img/img_xxx/0?exp=1777166400000&sig=...",
"file_id": "file_xxx"
}
]
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "<string>"
}
}Images / gpt-image-2
Retrieve image task
Retrieve the status and result of an image generation task.
GET
/
tasks
/
{task_id}
Retrieve task
curl --request GET \
--url https://api-direct.dimilinks.com/v1/tasks/{task_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-direct.dimilinks.com/v1/tasks/{task_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-direct.dimilinks.com/v1/tasks/{task_id}', 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-direct.dimilinks.com/v1/tasks/{task_id}",
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: Bearer <token>"
],
]);
$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-direct.dimilinks.com/v1/tasks/{task_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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-direct.dimilinks.com/v1/tasks/{task_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-direct.dimilinks.com/v1/tasks/{task_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"task_id": "task_xxx",
"status": "NOT_START",
"progress": "50%",
"created_at": 123,
"platform": "openai",
"fail_reason": "<string>",
"finished_at": 123,
"data": {
"created": 123,
"task_id": "task_xxx",
"status": "success",
"data": [
{
"url": "https://lmage2.dimilinks.com/p/img/img_xxx/0?exp=1777166400000&sig=...",
"file_id": "file_xxx"
}
]
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "<string>"
}
}After submitting an asynchronous image task, use the returned public
Use only
task_id to retrieve its status. Public task IDs use the task_ prefix; the image pool’s internal img_ ID cannot be used for retrieval.
Request
curl "https://api-direct.dimilinks.com/v1/tasks/task_xxx" \
-H "Authorization: Bearer $DIMILINKS_API_KEY"
In-progress response
{
"task_id": "task_xxx",
"status": "IN_PROGRESS",
"progress": "50%",
"fail_reason": "",
"created_at": 1777080000,
"finished_at": 0,
"data": {
"task_id": "task_xxx",
"status": "in_progress",
"data": []
}
}
Successful response
{
"task_id": "task_xxx",
"status": "SUCCESS",
"progress": "100%",
"fail_reason": "",
"created_at": 1777080000,
"finished_at": 1777080060,
"data": {
"created": 1777080000,
"task_id": "task_xxx",
"status": "success",
"data": [
{
"url": "https://lmage2.dimilinks.com/p/img/img_xxx/0?exp=1777166400000&sig=...",
"file_id": "file_xxx"
}
]
}
}
Image URL formats
After the task succeeds, readdata.data[].url. The outer data is the saved generation response, and its data field contains the image records.
If the URL starts with /p/img/, prefix it with https://lmage2.dimilinks.com before displaying or downloading it. A complete https://lmage2.dimilinks.com/p/img/... URL can be used directly; its signature and expiration are embedded, so no Bearer token is required.
Failed response
{
"task_id": "task_xxx",
"status": "FAILURE",
"progress": "100%",
"fail_reason": "The upstream provider returned an error",
"created_at": 1777080000,
"finished_at": 1777080060
}
Status values
| Status | Meaning | Recommended caller action |
|---|---|---|
NOT_START / SUBMITTED / QUEUED | Waiting to be processed | Continue polling. |
IN_PROGRESS | Generating | Continue polling. |
SUCCESS | Completed | Display data.data[].url. |
FAILURE | Failed | Display fail_reason and allow the user to retry. |
GET /v1/tasks/{task_id} for image task retrieval. Do not call the removed /v1/images/tasks/{task_id} route or treat an internal img_xxx image ID as the public task ID.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Response
Image or video task
- Option 1
- Option 2
Example:
"task_xxx"
Available options:
NOT_START, SUBMITTED, QUEUED, IN_PROGRESS, SUCCESS, FAILURE Pattern:
^[0-9]{1,3}%$Example:
"50%"
Example:
"openai"
Show child attributes
Show child attributes