apps/docs/content/guides/manage/console/actions-overview.mdx
An Identity and Access Management system is a highly interactive environment. ZITADEL includes a powerful feature called Actions, which allows you to programmatically react to specific events within the system.
Actions allow you to define custom scripts (JavaScript) that are executed based on specific triggers (Flows). This enables advanced customization, such as modifying tokens, calling external APIs during login, or customizing authentication flows.
The Actions architecture consists of three main components:
ZITADEL interprets your Action scripts as JavaScript.
The script of an action must contain a function that matches the Action's name. ZITADEL calls this function at runtime.
The function receives two primary objects:
ctx (Context): Provides readable information about the current request (User, Request Info, etc.).api (API): Provides methods to mutate state (Set Claims, Deny Access, etc.).Example: If your action is named doSomething, your script must look like this:
function doSomething(ctx, api){
// read from ctx and manipulate with api
}
You can use the following built-in modules inside your JavaScript code:
Stuck customizing ZITADEL actions? Find samples for setting OIDC claims, SAML attributes, extending JIT provisioning data, calling external APIs, and more in this repository.
To add an action, navigate to your Organization's top navigation and select Actions. Click the New button and provide:
Merely creating an Action does not run it. You must create a Flow to define when it runs.
Example Scenario: You create an External Authentication Flow with a Post Authentication trigger. Now, whenever a user authenticates via an external IDP (like Google or Azure AD), your Action is triggered immediately after the authentication step but before the session is finalized.
Trigger types define the point during the execution of a request. Each trigger defines which readable information (ctx) and mutable properties (api) are passed into the called function.
Currently, ZITADEL supports the following flows: