> ## 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.

# 取得 World 狀態

> 取得 World Labs Marble 世界生成任務的狀態與結果

輪詢此端點以檢查 World Labs Marble 生成任務的狀態。如果建立回應中包含 `poll_url`，請優先呼叫該完整 URL。

## 路徑參數

<ParamField path="id" type="string" required>
  世界生成任務 ID。
</ParamField>

## 回應

<ResponseField name="id" type="string">
  公開任務 ID。
</ResponseField>

<ResponseField name="task_id" type="string">
  非同步任務識別別名。
</ResponseField>

<ResponseField name="operation_id" type="string">
  上游 World Labs 操作 ID。
</ResponseField>

<ResponseField name="status" type="string">
  任務狀態：`pending`、`processing`、`completed`、`failed` 或 `timeout`。
</ResponseField>

<ResponseField name="world_id" type="string">
  生成完成後的上游 World Labs 世界 ID。
</ResponseField>

<ResponseField name="world_marble_url" type="string">
  生成完成後返回的 Marble 世界 URL。
</ResponseField>

<ResponseField name="model_url" type="string">
  主要生成世界或模型 URL 的別名。
</ResponseField>

<ResponseField name="glb_url" type="string">
  可用時返回的碰撞網格 GLB URL。
</ResponseField>

<ResponseField name="pano_url" type="string">
  可用時返回的全景圖 URL。
</ResponseField>

<ResponseField name="thumbnail_url" type="string">
  可用時返回的縮圖 URL。
</ResponseField>

<ResponseField name="caption" type="string">
  上游為生成世界返回的 caption。
</ResponseField>

<ResponseField name="cost" type="object">
  可用時返回的上游 operation 費用詳情，包括 `total_credits`。
</ResponseField>

<ResponseField name="error" type="string">
  任務失敗時的錯誤訊息。
</ResponseField>

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

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

  task_id = "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

  while True:
      response = requests.get(
          f"https://api.tokenlab.sh/v1/worlds/generations/{task_id}",
          headers={"Authorization": "Bearer sk-your-api-key"},
      )
      result = response.json()
      if result["status"] in ["completed", "failed", "timeout"]:
          print(result)
          break
      time.sleep(10)
  ```

  ```javascript JavaScript theme={null}
  const taskId = 'ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
  const response = await fetch(`https://api.tokenlab.sh/v1/worlds/generations/${taskId}`, {
    headers: { Authorization: 'Bearer sk-your-api-key' }
  });

  const result = await response.json();
  console.log(result.status, result.world_marble_url);
  ```
</RequestExample>
