Skip to main content
GET
/
public
/
generation
/
:id
curl "https://your-store.myshopify.com/apps/proxy_genlook-x/public/generation/gen_xyz789abc"
{
  "generationId": "gen_xyz789abc",
  "status": "PENDING",
  "createdAt": "2024-01-15T10:30:00Z",
  "updatedAt": "2024-01-15T10:30:00Z"
}
Retrieve the current status and result of a generation job. Poll this endpoint until the status is COMPLETED or FAILED.

Path Parameters

id
string
required
The generation job ID returned from the create generation endpoint.

Request

curl "https://your-store.myshopify.com/apps/proxy_genlook-x/public/generation/gen_xyz789abc"

Response

generationId
string
required
The generation job ID (same as the path parameter).
status
string
required
Current status of the generation. Possible values:
  • PENDING - Job created but not yet started
  • PROCESSING - Generation is in progress
  • COMPLETED - Generation finished successfully
  • FAILED - Generation failed with an error
resultImageUrl
string
URL of the generated try-on image. Only present when status is COMPLETED.
errorMessage
string
Error message describing what went wrong. Only present when status is FAILED.
createdAt
string
required
ISO 8601 timestamp when the generation job was created.
updatedAt
string
required
ISO 8601 timestamp when the generation status was last updated.
{
  "generationId": "gen_xyz789abc",
  "status": "PENDING",
  "createdAt": "2024-01-15T10:30:00Z",
  "updatedAt": "2024-01-15T10:30:00Z"
}

Polling Best Practices

Polling interval: Check status every 2 seconds. Don’t poll more frequently - it won’t speed up generation and wastes resources.
Maximum attempts: Limit polling to 60 attempts (2 minutes total). If generation takes longer, show a timeout message and allow retry.
Stop polling: Once status is COMPLETED or FAILED, stop polling immediately.

Example Polling Implementation

async function pollGenerationStatus(jobId, onStatusChange) {
  const maxAttempts = 60;
  const pollInterval = 2000; // 2 seconds
  
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
    const response = await fetch(
      `/apps/proxy_genlook-x/public/generation/${jobId}`
    );
    const status = await response.json();
    
    if (onStatusChange) {
      onStatusChange(status);
    }
    
    if (status.status === 'COMPLETED') {
      return status;
    }
    
    if (status.status === 'FAILED') {
      throw new Error(status.errorMessage || 'Generation failed');
    }
    
    // Wait before next poll
    await new Promise(resolve => setTimeout(resolve, pollInterval));
  }
  
  throw new Error('Generation timeout - please try again');
}

// Usage
try {
  const result = await pollGenerationStatus('gen_xyz789abc', (status) => {
    console.log(`Status: ${status.status}`);
  });
  console.log('Generated image:', result.resultImageUrl);
} catch (error) {
  console.error('Generation failed:', error.message);
}

Error Responses

{
  "message": "Generation not found"
}

Status Flow

The typical status progression:
  1. PENDING → Job created, waiting to start
  2. PROCESSING → Generation in progress (may take 10-60 seconds)
  3. COMPLETED → Success! resultImageUrl is available
  4. FAILED → Error occurred, check errorMessage
Most generations complete within 30-60 seconds. If polling exceeds 2 minutes, consider showing a timeout message and allowing the user to retry.