Get Variation
Retrieves details and status of a variation job, including the upscaled image when complete.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
Inputs
- Connection Id (String) - Connection ID from the Connect node (optional if API Key credentials are provided directly).
- Variation ID (String) - ID of the variation to retrieve (from Create Upscale node).
Options
- API Key - Leonardo AI API key (optional if using Connection ID).
Outputs
- Variation (Object) - Variation details including:
- Status (PENDING, COMPLETE, FAILED)
- Upscaled image URL when complete
- Variation type
- Timestamps
- Image metadata
How It Works
The Get Variation node retrieves information about a variation job. When executed, the node:
- Validates the variation ID is not empty
- Sends a request to Leonardo AI API to fetch variation details
- Returns the complete variation object with status and image URL
Requirements
- Valid Leonardo AI API key (via Connection ID or credentials)
- Valid variation ID from a Create Upscale node
Error Handling
The node will return specific errors in the following cases:
- Empty variation ID - "Variation ID cannot be empty. Please provide the ID of the variation to retrieve."
- API error - "Failed to get variation. API error
{{status}}:{{details}}" - Runtime error - "Failed to get variation:
{{details}}. Please verify the variation ID and try again."
Usage Examples
Check Upscale Status
Poll variation status until complete:
- Create Upscale and get variation ID
- Wait a few seconds (use Delay node)
- Get Variation to check status
- If status is "COMPLETE", extract image URL
- If "PENDING", wait and check again
Download Upscaled Image
Retrieve the upscaled image:
// After calling Get Variation
const variation = $.variation;
if (variation.status === 'COMPLETE') {
const imageUrl = variation.url;
// Download the upscaled image from URL
} else if (variation.status === 'PENDING') {
// Still processing - wait longer
} else if (variation.status === 'FAILED') {
// Upscaling failed - handle error
}
Wait for Upscale Completion
Automated waiting loop:
- Create Upscale
- Loop:
- Wait 5 seconds (Delay node)
- Get Variation
- Check status
- If COMPLETE, exit loop with image URL
- If FAILED, handle error
- If PENDING, continue loop
- Download completed image
Compare Original and Upscaled
Compare before and after:
// Get original generation
const generation = $.generation;
const originalUrl = generation.generated_images[0].url;
// Get upscaled variation
const variation = $.variation;
const upscaledUrl = variation.url;
// Compare dimensions and quality
console.log(`Original: \$\{originalUrl\}`);
console.log(`Upscaled: \$\{upscaledUrl\}`);
Batch Retrieve Upscales
Get multiple upscaled images:
const variationIds = [
'var-id-1',
'var-id-2',
'var-id-3'
];
const upscaledImages = [];
variationIds.forEach(varId => {
// Get Variation for each
// Extract URL if complete
// Add to upscaledImages array
});
Usage Notes
- Upscaling is asynchronous - poll this node to check status
- Recommended polling interval: every 5-10 seconds
- Status values: PENDING (processing), COMPLETE (ready), FAILED (error)
- Image URL is available only when status is COMPLETE
- The URL points to the high-resolution upscaled image
- Download the image promptly as URLs may be temporary
- Failed variations may include error details
- Typical upscaling time: 10-30 seconds
- Use in a loop to wait for completion
- The variation object contains the upscaled image metadata
- Original generation remains available separately
- Multiple calls with same variation ID return same result
- Useful for retrieving high-quality final outputs