Get User Details
Retrieves details of the authenticated Leonardo AI user account.
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).
Options
- API Key - Leonardo AI API key (optional if using Connection ID).
Outputs
- User Details (Object) - User account information including:
- User ID
- Username
- Subscription tier
- API credit balance
- Token usage statistics
- Account limits
- Other account metadata
How It Works
The Get User Details node retrieves the current user's account information. When executed, the node:
- Sends a request to Leonardo AI API using the authenticated connection
- Fetches complete user account details
- Returns the user details object
Requirements
- Valid Leonardo AI API key (via Connection ID or credentials)
- Active Leonardo AI account
Error Handling
The node will return specific errors in the following cases:
- API error - "Failed to get user details. API error
{{status}}:{{details}}" - Runtime error - "Failed to get user details:
{{details}}. Please verify your connection and try again." - Authentication failure - Error if API key is invalid
Usage Examples
Get User ID for List Generations
Retrieve user ID to list your generations:
- Connect to Leonardo AI
- Get User Details
- Extract user ID from output:
const userDetails = $.user_details;
const userId = userDetails.id; - Use user ID in List Generations node
Check API Credit Balance
Monitor your API credits before operations:
// After calling Get User Details
const userDetails = $.user_details;
const creditBalance = userDetails.tokenRenewalDate;
if (creditBalance < 100) {
console.log('Warning: Low API credits');
// Consider waiting for renewal or upgrading
}
Verify Account Tier
Check subscription level:
const userDetails = $.user_details;
const subscriptionTier = userDetails.subscriptionTier;
console.log(`Account Type: \$\{subscriptionTier\}`);
// Adjust workflow based on tier limits
if (subscriptionTier === 'FREE') {
// Use conservative generation settings
} else if (subscriptionTier === 'PRO') {
// Can use more advanced features
}
Display Account Info
Show account information in logs:
const userDetails = $.user_details;
console.log(`Username: \$\{userDetails.username\}`);
console.log(`User ID: \$\{userDetails.id\}`);
console.log(`Email: \$\{userDetails.email\}`);
console.log(`Subscription: \$\{userDetails.subscriptionTier\}`);
Workflow Initialization
Get account details at start of workflow:
- Connect to Leonardo AI
- Get User Details
- Store user ID in variable
- Check credit balance
- Proceed with generations if credits available
- Use stored user ID for listing operations
Monitor Usage
Track API usage:
const userDetails = $.user_details;
const usageData = userDetails.apiCreditBalance;
// Log usage statistics
// Alert if approaching limits
// Adjust generation frequency
Usage Notes
- This node requires minimal inputs - just authentication
- Returns comprehensive account information
- User ID is needed for listing generations
- Check credit balance before starting batch operations
- Subscription tier affects available features and limits
- Email and username help verify correct account
- Useful for workflow initialization and validation
- Can be called multiple times without side effects
- Account details update in real-time
- Consider caching user details if needed frequently
- The user details object structure may include additional fields
- Different subscription tiers have different limits
- Free tier has lower API credit allocation
- Pro/Enterprise tiers have higher limits and more features