> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tokenlab.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Get 3D Model Status

> Retrieves the status and result of a 3D generation task

Poll this endpoint to check the status of your 3D model generation task.

<Info>
  If the create response included `poll_url`, prefer calling that exact URL for polling. `/v1/tasks/{id}` is the canonical fixed status endpoint for 3D jobs, and `id` / `task_id` should be treated as the same async task identity.

  If the task no longer exists or is no longer available in the public task record, TokenLab returns `async_task_not_found` with the message `Task not found or no longer available.`
</Info>

## Path Parameters

<ParamField path="id" type="string" required>
  The 3D generation task ID.
</ParamField>

## Response

<ResponseField name="id" type="string">
  Task ID.
</ResponseField>

<ResponseField name="task_id" type="string">
  Async task identifier alias when provided.
</ResponseField>

<ResponseField name="poll_url" type="string">
  Preferred polling URL when the create response supplies one.
</ResponseField>

<ResponseField name="status" type="string">
  Task status: `pending`, `processing`, `completed`, or `failed`.
</ResponseField>

<ResponseField name="progress" type="integer">
  Optional progress value. Returned only when a real progress value is available; use `status` to determine completion.
</ResponseField>

<ResponseField name="model_url" type="string">
  URL to download the 3D model file (when completed).
</ResponseField>

<ResponseField name="glb_url" type="string">
  URL to download the GLB format model (when available).
</ResponseField>

<ResponseField name="fbx_url" type="string">
  URL to download the FBX format model (when available).
</ResponseField>

<ResponseField name="error" type="string">
  Error message (when failed).
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.tokenlab.sh/v1/tasks/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
    -H "Authorization: Bearer sk-your-api-key"
  ```

  ```python Python theme={null}
  import requests
  import time

  task_id = "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
  poll_url = f"/v1/tasks/{task_id}"

  while True:
      response = requests.get(
          f"https://api.tokenlab.sh{poll_url}",
          headers={"Authorization": "Bearer sk-your-api-key"}
      )
      result = response.json()

      if result["status"] == "completed":
          print(f"3D Model URL: {result['model_url']}")
          break
      elif result["status"] == "failed":
          print(f"Error: {result['error']}")
          break

      time.sleep(5)  # Poll every 5 seconds
  ```

  ```javascript JavaScript theme={null}
  const taskId = 'ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
  const pollUrl = `/v1/tasks/${taskId}`;

  async function pollFor3DModel() {
    while (true) {
      const response = await fetch(
        `https://api.tokenlab.sh${pollUrl}`,
        { headers: { 'Authorization': 'Bearer sk-your-api-key' } }
      );

      const result = await response.json();

      if (result.status === 'completed') {
        console.log(`3D Model URL: ${result.model_url}`);
        return result.model_url;
      } else if (result.status === 'failed') {
        throw new Error(result.error);
      }

      await new Promise(r => setTimeout(r, 5000));
    }
  }
  ```

  ```go Go theme={null}
  package main

  import (
      "encoding/json"
      "fmt"
      "net/http"
      "time"
  )

  func main() {
      taskID := "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      pollURL := fmt.Sprintf("https://api.tokenlab.sh/v1/tasks/%s", taskID)

      for {
          req, _ := http.NewRequest("GET",
              pollURL, nil)
          req.Header.Set("Authorization", "Bearer sk-your-api-key")

          client := &http.Client{}
          resp, _ := client.Do(req)

          var result map[string]interface{}
          json.NewDecoder(resp.Body).Decode(&result)
          resp.Body.Close()

          if result["status"] == "completed" {
              fmt.Printf("3D Model URL: %s\n", result["model_url"])
              break
          } else if result["status"] == "failed" {
              fmt.Printf("Error: %s\n", result["error"])
              break
          }

          time.Sleep(5 * time.Second)
      }
  }
  ```

  ```php PHP theme={null}
  <?php
  $taskId = 'ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
  $pollUrl = "https://api.tokenlab.sh/v1/tasks/{$taskId}";

  while (true) {
      $ch = curl_init($pollUrl);

      curl_setopt_array($ch, [
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_HTTPHEADER => [
              'Authorization: Bearer sk-your-api-key'
          ]
      ]);

      $response = curl_exec($ch);
      curl_close($ch);

      $result = json_decode($response, true);

      if ($result['status'] === 'completed') {
          echo "3D Model URL: {$result['model_url']}\n";
          break;
      } elseif ($result['status'] === 'failed') {
          echo "Error: {$result['error']}\n";
          break;
      }

      sleep(5);
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Response (Completed) theme={null}
  {
    "id": "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "task_id": "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "poll_url": "/v1/tasks/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "status": "completed",
    "model_url": "https://cdn.example.com/3d/abc123.glb",
    "glb_url": "https://cdn.example.com/3d/abc123.glb",
    "fbx_url": "https://cdn.example.com/3d/abc123.fbx"
  }
  ```
</ResponseExample>
