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

# Lấy trạng thái World

> Lấy trạng thái và kết quả của tác vụ sinh world World Labs Marble

Polling endpoint này để kiểm tra trạng thái tác vụ World Labs Marble. Nếu phản hồi tạo có `poll_url`, hãy ưu tiên gọi đúng URL đó.

## Tham số đường dẫn

<ParamField path="id" type="string" required>
  ID tác vụ world generation.
</ParamField>

## Phản hồi

<ResponseField name="id" type="string">
  ID tác vụ công khai.
</ResponseField>

<ResponseField name="task_id" type="string">
  Alias của định danh tác vụ bất đồng bộ.
</ResponseField>

<ResponseField name="operation_id" type="string">
  ID thao tác ở dịch vụ nguồn của World Labs.
</ResponseField>

<ResponseField name="status" type="string">
  Trạng thái tác vụ: `pending`, `processing`, `completed`, `failed` hoặc `timeout`.
</ResponseField>

<ResponseField name="world_id" type="string">
  ID thế giới ở dịch vụ nguồn của World Labs khi hoàn tất.
</ResponseField>

<ResponseField name="world_marble_url" type="string">
  URL world Marble đã sinh khi hoàn tất.
</ResponseField>

<ResponseField name="model_url" type="string">
  Alias cho URL world/model chính đã sinh.
</ResponseField>

<ResponseField name="glb_url" type="string">
  URL GLB của collider mesh nếu có.
</ResponseField>

<ResponseField name="pano_url" type="string">
  URL ảnh panorama nếu có.
</ResponseField>

<ResponseField name="thumbnail_url" type="string">
  URL thumbnail nếu có.
</ResponseField>

<ResponseField name="caption" type="string">
  Caption upstream cho world đã sinh.
</ResponseField>

<ResponseField name="cost" type="object">
  Chi tiết chi phí operation upstream khi có, bao gồm `total_credits`.
</ResponseField>

<ResponseField name="error" type="string">
  Thông báo lỗi khi tác vụ thất bại.
</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>
