Documentation Index
Fetch the complete documentation index at: https://mintlify.com/zitadel/zitadel/llms.txt
Use this file to discover all available pages before exploring further.
Authentication Methods
ZITADEL API uses OAuth 2.0 for authentication and authorization. All API requests must include a valid access token in theAuthorization header:
- JWT Profile (Recommended for service accounts)
- Personal Access Tokens (PAT) (Quick testing and scripts)
- Client Credentials (Standard OAuth 2.0 flow)
JWT Profile Authentication
JWT Profile is the recommended method for authenticating service accounts. It uses public-key cryptography for secure, rotatable credentials.How It Works
- Create a service account in ZITADEL
- Generate a JSON key file containing the private key
- Create and sign a JWT assertion
- Exchange the JWT for an access token
- Use the access token to call ZITADEL APIs
Setting Up JWT Profile
Step 1: Create a Service Account
Using the ZITADEL Console:- Navigate to Users → Service Accounts
- Click New
- Enter a name and username
- Select JWT as the access token type
- Click Create
Step 2: Generate a Key
- In the service account details, go to Keys
- Click New
- Select an expiration date
- Click Add and download the JSON key file
Step 3: Create a JWT Assertion
Create a JWT with the following structure: Header:iss(issuer): Service account user ID from the key filesub(subject): Service account user ID from the key fileaud(audience): Your ZITADEL instance URLiat(issued at): Current Unix timestamp (must not be older than 1 hour)exp(expiration): Unix timestamp when the JWT expireskid(key ID): Key ID from the key file (in header)
Step 4: Exchange JWT for Access Token
Send a POST request to the token endpoint:Example: Python
Personal Access Tokens (PAT)
Personal Access Tokens provide a simpler authentication method ideal for testing, scripts, and development.Creating a PAT
Via ZITADEL Console
- Navigate to your service account
- Go to Personal Access Tokens
- Click New
- Set an expiration date
- Click Add
- Copy the token immediately (you cannot retrieve it later)
Via API
You can also create PATs programmatically:Using a PAT
Simply include the PAT in the Authorization header:Client Credentials Flow
The Client Credentials flow is a standard OAuth 2.0 method for machine-to-machine authentication.Setting Up Client Credentials
- Create an application in ZITADEL (type: API)
- Configure authentication method as Client Secret or JWT
- Note the
client_idandclient_secret
Obtaining an Access Token
Required Scopes
For ZITADEL API access, include these scopes:openid: Required for OIDCurn:zitadel:iam:org:project:id:zitadel:aud: Grants access to ZITADEL management APIs
email: Access to email addressprofile: Access to profile informationoffline_access: Request a refresh token
Authorization and Permissions
Authentication confirms identity; authorization determines what actions are permitted.Permission Model
ZITADEL uses a role-based permission system:- Instance-level: Permissions across the entire instance (e.g.,
iam.write) - Organization-level: Permissions within a specific organization (e.g.,
org.write) - Resource-level: Permissions on specific resources (e.g.,
user.write)
Common Permissions
| Permission | Description |
|---|---|
authenticated | Any authenticated user |
user.read | Read user information |
user.write | Create and modify users |
org.read | Read organization information |
org.write | Create and modify organizations |
org.create | Create new organizations |
- The access token’s grants
- The resource being accessed
- The user’s assigned roles
Token Introspection
To validate and inspect an access token:Security Best Practices
- Rotate credentials regularly: Update keys and tokens periodically
- Use appropriate token lifetimes: Shorter for higher security, longer for convenience
- Store secrets securely: Never commit keys or tokens to version control
- Use JWT Profile for production: More secure than PATs with key rotation support
- Implement token refresh: Handle token expiration gracefully
- Limit scope: Request only the scopes your application needs
- Monitor usage: Track API usage and watch for anomalies
Next Steps
Quickstart Guide
Make your first authenticated API call