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{
"id": "img_xxx",
"task_id": "img_xxx",
"object": "image.task",
"status": "queued",
"progress": 50,
"created_at": 123,
"completed_at": 123,
"result": {
"created": 1777080000,
"task_id": "img_xxx",
"data": [
{
"url": "/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>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "<string>"
}
}画像 / gpt-image-2
画像タスクを取得
画像生成タスクのステータスと結果を照会します。
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{
"id": "img_xxx",
"task_id": "img_xxx",
"object": "image.task",
"status": "queued",
"progress": 50,
"created_at": 123,
"completed_at": 123,
"result": {
"created": 1777080000,
"task_id": "img_xxx",
"data": [
{
"url": "/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>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "<string>"
}
}非同期画像タスクを送信した後、
task_id を使用してタスクのステータスを照会します。新規実装では /v1/tasks/{task_id} を優先して使用してください。
リクエスト
curl "https://api-direct.dimilinks.com/v1/tasks/img_xxx" \
-H "Authorization: Bearer $DIMILINKS_API_KEY"
処理中のレスポンス
{
"id": "img_xxx",
"task_id": "img_xxx",
"object": "image.task",
"status": "in_progress",
"progress": 50,
"created_at": 1777080000
}
成功時のレスポンス
{
"id": "img_xxx",
"task_id": "img_xxx",
"object": "image.task",
"status": "succeeded",
"progress": 100,
"created_at": 1777080000,
"completed_at": 1777080060,
"result": {
"created": 1777080000,
"data": [
{
"url": "/p/img/img_xxx/0?exp=1777166400000&sig=...",
"file_id": "file_xxx"
}
]
}
}
画像 URL の形式
タスクが成功したらresult.data[].url を読み取ります。このフィールドには、相対パス、完全な HTTP(S) URL、または data:image/...;base64,... 形式の Data URL が入る場合があります。
Data URL はエラーでもログ内容でもなく、画像データそのものです。Web ページではそのまま表示できます。スクリプトでファイルとして保存する場合は、先に base64 をデコードしてください。
失敗時のレスポンス
{
"id": "img_xxx",
"task_id": "img_xxx",
"object": "image.task",
"status": "failed",
"progress": 100,
"created_at": 1777080000,
"completed_at": 1777080060,
"error": {
"code": "upstream_error",
"message": "アップストリームからエラーが返されました"
}
}
ステータス
| ステータス | 意味 | 呼び出し元での推奨対応 |
|---|---|---|
queued | 処理待ち | ポーリングを続けます。 |
in_progress | 生成中 | ポーリングを続けます。 |
succeeded | 完了 | result.data[].url を表示します。 |
failed | 失敗 | エラー情報を表示し、ユーザーが再試行できるようにします。 |
旧エンドポイント
GET /v1/images/tasks/{task_id} は旧クライアント向けに維持されています。新規実装では 2 種類の照会構造を混在させないでください。
旧エンドポイントのレスポンス例:
{
"task_id": "img_xxx",
"status": "success",
"conversation_id": "conv_xxx",
"created": 1777080000,
"finished_at": 1777080060,
"error": "",
"credit_cost": 123,
"data": [
{
"url": "/p/img/img_xxx/0?exp=1777166400000&sig=...",
"file_id": "file_xxx"
}
]
}
承認
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
パスパラメータ
レスポンス
Image or video task