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

# Generation Status

> Check the status of a try-on generation and retrieve the result

Returns the current status of a generation. When `COMPLETED`, the response includes a temporary URL to the result image. Poll every 2s until status is `COMPLETED` or `FAILED`.

## Path Parameters

<ParamField path="id" type="string" required>
  The `generationId` from [Create Try-On](/tryon-api/endpoints/create-try-on).
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.genlook.app/tryon/v1/generations/cm8gen456xyz" \
    -H "x-api-key: gk_your_api_key"
  ```

  ```ts Node SDK (waitFor — recommended) theme={null}
  import { Genlook, GenerationFailedError } from "@genlook/api";

  const client = new Genlook({ apiKey: process.env.GENLOOK_API_KEY! });

  // Replaces the typical polling loop. Throws GenerationFailedError on FAILED,
  // GenerationTimeoutError if it doesn't terminate within `timeoutMs`.
  const result = await client.generations.waitFor("cm8gen456xyz", {
    timeoutMs: 180_000,
    pollIntervalMs: 2_000,
    onStatus: (s) => console.log(s.status),
  });
  console.log(result.resultImageUrl);
  ```

  ```ts Node SDK (single read) theme={null}
  const status = await client.generations.retrieve("cm8gen456xyz");
  if (status.status === "COMPLETED") {
    console.log(status.resultImageUrl);
  } else if (status.status === "FAILED") {
    console.error(status.errorCode, status.errorMessage);
  }
  ```
</RequestExample>

## Response

<ResponseField name="generationId" type="string" required>
  The generation ID.
</ResponseField>

<ResponseField name="status" type="string" required>
  One of: `PENDING`, `PROCESSING`, `COMPLETED`, `FAILED`.
</ResponseField>

<ResponseField name="resultImageUrl" type="string">
  Temporary URL to the result image. Only present when status is `COMPLETED`.
</ResponseField>

<ResponseField name="errorMessage" type="string">
  Human-readable error description. Only present when status is `FAILED`.
</ResponseField>

<ResponseField name="errorCode" type="string">
  Stable error code (e.g. `PRODUCT_IMAGE_FETCH_FAILED`) when the failure was raised as a typed error. Use this — not the message text — to switch on failure type. Absent for untyped/internal failures. See the [Errors catalog](/tryon-api/errors).
</ResponseField>

<ResponseField name="createdAt" type="string" required>
  ISO 8601 timestamp.
</ResponseField>

<ResponseField name="updatedAt" type="string" required>
  ISO 8601 timestamp of the last status change.
</ResponseField>

<ResponseExample>
  ```json Pending theme={null}
  {
    "generationId": "cm8gen456xyz",
    "status": "PENDING",
    "createdAt": "2026-03-30T10:00:00.000Z",
    "updatedAt": "2026-03-30T10:00:00.000Z"
  }
  ```

  ```json Completed theme={null}
  {
    "generationId": "cm8gen456xyz",
    "status": "COMPLETED",
    "resultImageUrl": "https://storage.googleapis.com/...",
    "createdAt": "2026-03-30T10:00:00.000Z",
    "updatedAt": "2026-03-30T10:00:15.000Z"
  }
  ```

  ```json Failed theme={null}
  {
    "generationId": "cm8gen456xyz",
    "status": "FAILED",
    "errorCode": "PRODUCT_IMAGE_FETCH_FAILED",
    "errorMessage": "Failed to fetch product image 'https://cdn.example.com/missing.jpg': getaddrinfo ENOTFOUND cdn.example.com",
    "createdAt": "2026-03-30T10:00:00.000Z",
    "updatedAt": "2026-03-30T10:00:05.000Z"
  }
  ```
</ResponseExample>

## Common failure causes

A `FAILED` status usually means one of:

* The product image URL returned an error or could not be reached.
* The customer or product image was rejected during pre-processing.
* The AI pipeline returned an unrecoverable error.

When the failure is typed, `errorCode` is a stable enum value from the [Errors catalog](/tryon-api/errors) — switch on this rather than the human-readable `errorMessage`. Most failures are safe to retry.
