> ## 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 virtual try-on generation job

Poll this endpoint until status is `COMPLETED` or `FAILED`. Recommended interval: every 2 seconds, max 60 attempts.

## Path Parameters

<ParamField path="id" type="string" required>
  The `jobId` from the create generation response.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://your-store.myshopify.com/apps/proxy_genlook-x/public/generation/gen_xyz789abc"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(`/apps/proxy_genlook-x/public/generation/${jobId}`);
  const status = await response.json();
  ```
</RequestExample>

## Response

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

<ResponseField name="status" type="string" required>
  `PENDING` | `PROCESSING` | `COMPLETED` | `FAILED`
</ResponseField>

<ResponseField name="resultImageKey" type="string">
  Storage key of the generated image. Present when `COMPLETED`.
</ResponseField>

<ResponseField name="resultImageUrl" type="string">
  Temporary signed URL of the generated image. Present when `COMPLETED`.
</ResponseField>

<ResponseField name="errorMessage" type="string">
  Error description. Present when `FAILED`.
</ResponseField>

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

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

<ResponseExample>
  ```json Completed theme={null}
  {
    "generationId": "gen_xyz789abc",
    "status": "COMPLETED",
    "resultImageKey": "generations/gen_xyz789abc.jpg",
    "resultImageUrl": "https://storage.googleapis.com/bucket-name/generations/gen_xyz789abc.jpg?X-Goog-Signature=...",
    "createdAt": "2024-01-15T10:30:00Z",
    "updatedAt": "2024-01-15T10:32:15Z"
  }
  ```

  ```json Failed theme={null}
  {
    "generationId": "gen_xyz789abc",
    "status": "FAILED",
    "errorMessage": "Failed to process image: Invalid image format",
    "createdAt": "2024-01-15T10:30:00Z",
    "updatedAt": "2024-01-15T10:30:45Z"
  }
  ```

  ```json Pending theme={null}
  {
    "generationId": "gen_xyz789abc",
    "status": "PENDING",
    "createdAt": "2024-01-15T10:30:00Z",
    "updatedAt": "2024-01-15T10:30:00Z"
  }
  ```
</ResponseExample>

## Polling Example

```javascript theme={null}
async function pollGeneration(jobId) {
  for (let i = 0; i < 60; i++) {
    const res = await fetch(`/apps/proxy_genlook-x/public/generation/${jobId}`);
    const data = await res.json();

    if (data.status === 'COMPLETED') return data;
    if (data.status === 'FAILED') throw new Error(data.errorMessage);

    await new Promise(r => setTimeout(r, 2000));
  }
  throw new Error('Generation timeout');
}
```

<Note>
  Most try-ons finish in 10 to 20 seconds. Allow up to 60 seconds before treating a generation as unusually slow.
</Note>
