Prerequisites
Before you begin, ensure you have:- Ruby 3.0+ installed
- The
zitadel-clientgem installed (see installation guide) - A Zitadel account and instance URL
- API credentials (we’ll cover how to get these)
Getting Your Credentials
You need credentials to authenticate with Zitadel. Choose one of the following methods:- Personal Access Token (Easiest)
- Service Account (Recommended for Production)
- Client Credentials
Your First Integration
Let’s create a complete example that authenticates and creates a user.Complete Example with All Authentication Methods
Here’s a complete script demonstrating all three authentication methods:complete_example.rb
More Examples
Retrieve User by ID
List All Users
Update User Email
Get General Settings
Error Handling
Always handle errors appropriately:Configuration and Debugging
Enable debug mode to see detailed HTTP logs:Advanced Configuration
Customize the SDK behavior:Next Steps
Now that you’ve made your first API calls, explore more features:Authentication Guide
Deep dive into authentication methods and best practices
API Reference
Explore all available API methods and models
User Management
Learn advanced user management techniques
Error Handling
Handle errors gracefully in production
Common Issues
Authentication Failed (401)
Authentication Failed (401)
Problem:
ApiError: Unauthorized (401)Solutions:- Verify your token/credentials are correct
- Check that the token hasn’t expired
- Ensure the service account has necessary permissions
- Confirm your instance URL is correct
Permission Denied (403)
Permission Denied (403)
Problem:
ApiError: Forbidden (403)Solutions:- Grant necessary roles to your service account
- Check organization context (some operations require org scope)
- Verify the resource exists and you have access
User Already Exists
User Already Exists
Problem:
ApiError: User already existsSolution: Use a unique username or email. The example uses SecureRandom.hex to generate unique values.Connection Timeout
Connection Timeout
Problem:
Timeout::Error or connection errorsSolutions:- Check your network connectivity
- Verify firewall settings
- Increase timeout:
config.timeout = 60 - Confirm your Zitadel instance URL is reachable
Getting Help
If you encounter issues:- Check the GitHub Issues
- Ask in the Zitadel Discord Community
- Review Zitadel Documentation
- Enable debug logging to see detailed error messages