List Generations
Retrieves a list of all generations for a specific user with pagination support.
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).
- User Id (String) - User ID whose generations to list (get from Get User Details node).
Options
- API Key - Leonardo AI API key (optional if using Connection ID).
- Offset (String) - Number of items to skip for pagination. Default: 0.
- Limit (String) - Maximum number of items to return per request. Default: 10.
Outputs
- Generations (Array) - List of generation objects, each containing:
- Generation ID
- Status
- Prompt used
- Model information
- Created timestamp
- Generated images (if complete)
How It Works
The List Generations node retrieves a paginated list of generations for a user. When executed, the node:
- Validates the user ID is not empty
- Builds the API request URL with optional pagination parameters
- Sends the request to Leonardo AI API
- Returns an array of generation objects
Requirements
- Valid Leonardo AI API key (via Connection ID or credentials)
- Valid user ID (typically from Get User Details node)
Error Handling
The node will return specific errors in the following cases:
- Empty user ID - "User ID cannot be empty. Please provide a valid user ID."
- API error - "Failed to list generations. API error
{{status}}:{{details}}"
Usage Examples
List Recent Generations
Get the 10 most recent generations:
- Use Get User Details to get the user ID
- Use List Generations with the user ID
- Keep Offset: 0 and Limit: 10 (defaults)
- Process the returned array of generations
Paginate Through All Generations
Retrieve all generations with pagination:
- Set Limit: 50 (max per page)
- Start with Offset: 0
- Call List Generations
- If you get 50 results, there may be more:
- Increment Offset by 50
- Call again with new Offset
- Repeat until you get fewer than 50 results
Filter Recent Generations
Get and filter generations from the last 24 hours:
// After calling List Generations
const generations = $.generations;
const oneDayAgo = Date.now() - (24 * 60 * 60 * 1000);
const recentGenerations = generations.filter(gen => {
const createdTime = new Date(gen.created_at).getTime();
return createdTime > oneDayAgo;
});
Count Completed Generations
Count how many generations are complete:
const generations = $.generations;
const completedCount = generations.filter(gen =>
gen.status === 'COMPLETE'
).length;
Usage Notes
- Use pagination (offset and limit) to handle large numbers of generations
- Default limit is 10 - increase for better performance when retrieving many items
- The user ID is typically obtained from the Get User Details node
- Results are ordered by creation time (newest first)
- Each generation object includes its current status
- Combine with filtering to find specific generations by prompt, model, or date
- Useful for auditing generation history or building generation dashboards
- Consider caching results if you need to reference them multiple times