Skip to main content
GET
/
tasks
/
{task_id}
Retrieve task
curl --request GET \
  --url https://dimilinks.com/v1/tasks/{task_id} \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://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://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://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://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://dimilinks.com/v1/tasks/{task_id}")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://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",
  "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>"
}
}
Video and image tasks share /v1/tasks/{task_id}. After submitting /v1/videos/generations, retrieve the returned task_id and poll this endpoint.

Request

curl "https://dimilinks.com/v1/tasks/video_xxx" \
  -H "Authorization: Bearer $DIMILINKS_API_KEY"

In-progress response

{
  "data": {
    "id": "video_xxx",
    "task_id": "video_xxx",
    "status": "processing",
    "progress": 35,
    "created_at": 1777080000
  }
}

Successful response

After the task reaches completed, retrieve the resulting video from /v1/videos/{task_id}/content with Bearer authentication.
{
  "data": {
    "id": "video_xxx",
    "task_id": "video_xxx",
    "status": "completed",
    "progress": 100,
    "created_at": 1777080000,
    "completed_at": 1777080300
  }
}
curl -L "https://dimilinks.com/v1/videos/video_xxx/content" \
  -H "Authorization: Bearer $DIMILINKS_API_KEY" \
  -o video.mp4
If your product displays videos to end users, proxy this download through your server: use the key to retrieve the video, then deliver it under your own authentication so the DimiLinks key is never exposed to the browser.

Failed response

{
  "data": {
    "id": "video_xxx",
    "task_id": "video_xxx",
    "status": "failed",
    "progress": 100,
    "created_at": 1777080000,
    "completed_at": 1777080300,
    "error": {
      "code": "upstream_error",
      "message": "Video generation failed. Please try again later."
    }
  }
}

Status values

StatusMeaningRecommended caller action
queued, pending, submittedWaiting to be processedContinue polling
processing, in_progress, runningGeneratingContinue polling
completed, successCompletedRetrieve /v1/videos/{task_id}/content
failed, error, cancelledFailedDisplay the error and allow the user to retry

Polling recommendations

  • Poll every three to five seconds, slightly less frequently than for image tasks.
  • Poll an individual task for at most ten minutes. After the timeout, tell the user the task failed and allow a retry.
  • Stop polling immediately on 404; the task ID is probably incorrect or does not belong to the current key.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

task_id
string
required

Response

Image or video task

id
string
Example:

"img_xxx"

task_id
string
Example:

"img_xxx"

object
string
Example:

"image.task"

status
enum<string>
Available options:
queued,
in_progress,
succeeded,
failed
progress
integer
Required range: 0 <= x <= 100
created_at
integer
completed_at
integer
result
object
error
object