Zitadel Actions v2 for custom login logic: when teams need code in the login path
Teams that run a self-hosted Zitadel instance often reach a rule that the standard login policies cannot express, such as blocking sign-ins from email domains they have not approved or assigning roles from an external system of record. For that logic, Actions v2 webhooks are the mechanism: they let the instance call an endpoint you control during an identity flow and act on the answer. Before writing any code, confirm that the rule truly needs to run inside the login path, because a check that can run after sign-in is simpler to operate. If it does belong there, the decision lives in code your team can review, test and version alongside the rest of your identity configuration, inside infrastructure you run.
Actions v2 has three building blocks that a planning document should keep apart. Request and response hooks sit at points in a flow where Zitadel asks an external service for a decision or data before it continues. Functions hold the logic that a hook or reaction invokes, so the same check can be reused across flows. Event reactions run after something has happened, such as a user being created, and suit follow-up work such as enrichment or notifications. Which hook types can change the outcome of a sign-in is a detail to confirm against the Zitadel documentation for your version, because it determines whether a rule can block access at all.
The work is planning, building and operating a service that your organization owns. Planning covers which rules belong in the login path, which data the service needs from your external systems, and what happens when the service is slow or unreachable, since a sign-in that waits on it inherits that failure. Building covers the endpoint itself, how Zitadel authenticates its calls to it, secret handling, and testing against the Zitadel release you run, which at the time of writing includes v4.19.5, released 15 October 2026. Operating covers logs, rotation of certificates and secrets, and keeping Actions v1 and Actions v2 coexisting during any move between them. Ask for a written list of the hook types in scope and their failure behavior before the scope is agreed.
How an Actions v2 hook sits in the login and event flow
The diagram starts with a user or application sending a sign-in or API request to Zitadel. During that request, Zitadel calls an HTTP endpoint that the client operates, and the endpoint returns a response that Zitadel uses to continue or change the flow. The endpoint and any external identity or HR system it calls sit inside the client's network, which is the trust boundary. A separate branch handles events: when Zitadel records an event, it calls an endpoint so the client can react. Check that only Zitadel can reach the endpoint, that its outbound calls stay within the boundary, and that the flow behaves predictably when the endpoint is slow or unavailable.
Request and response hooks run inside login, while events trigger separate reactions.
Running Actions v2 next to Actions v1 without double logic
The first goal is to make sure each login decision is made by exactly one component. An existing deployment may already run Actions v1 scripts, while a new deployment may start directly on Actions v2. In both cases, begin with an inventory of what each version does today. For every v1 script and every planned v2 target, record the trigger it fires on, the decision it makes (allow or deny a login, add a claim, assign a role from an external provider, enrich metadata), the external system it calls, and the scope it applies to, such as an instance or a single organization. Keep the current v1 script text alongside this list so the existing behavior is written down before anything changes. This inventory is the input to every decision that follows.
Next, decide which rules move. Sort each entry into one of three groups: rules that stay on v1 untouched, rules that move to v2 and are removed from v1 in the same change, and rules that are rewritten because the old logic does not fit the v2 hook. The double logic risk sits in the middle group. If a domain check exists in a v1 script and again in a v2 function, one component can deny a user that the other allows, or both can write the same claim with different values. Give each decision one owner and record that owner in the inventory. Confirm in the Zitadel documentation for your release how v1 and v2 are ordered relative to each other and whether both can be active on the same instance, because that answer determines whether a temporary overlap is possible at all.
Finally, test the combined behavior before cutover. Build a test matrix from the inventory that covers each decision: a user who should be allowed, a user who should be denied, a user whose external provider sends a role, and a user with missing attributes. Run those cases against a staging instance where v1 and v2 are both active, then confirm that each case produces one decision and one set of claims in the token or userinfo response. Check the logs and the event trail for each case so you can see which component acted. Keep the matrix after go-live, because it becomes the regression set for any later script change. Ask whoever maintains your staging environment to confirm how its ordering and release match production, since a staging instance on a different release can hide the overlap.
Which Actions v2 hook type fits each login decision
This table compares the Actions v2 hook types by the login decision each one suits, where it runs in the flow, whether it can change the result and the main risk to plan for. Check the risk column before designing a rule, because a hook that can deny access needs a clear fallback when its external call fails. Domain checks and role assignment need different hook types, so match each rule to the type that fits its timing.
| Hook type | Decision it suits | Flow position and outcome | Main risk to plan for |
|---|---|---|---|
| Request hook | Domain checks on sign-in or registration, such as allowing only approved email domains | Runs before the request completes. Can reject it and stop the login. | Blocking valid users when the rule is wrong or the check is unavailable |
| Response hook | Adding claims from external data to tokens or user info, such as roles or metadata | Runs as Zitadel builds the response. Can change the claims returned. | Tokens carrying stale or missing claims if the lookup fails or times out |
| Function | Role assignment from an external provider inside a defined flow | Runs inside a flow you select. Confirm which outcomes it can change in your version. | Silent role drift if the function fails without a visible error |
| Event reaction | Metadata enrichment after a user or grant changes | Runs after the event is stored. Cannot undo the change that caused it. | Metadata lagging behind identity changes after failed or delayed reactions |
| Actions v1 rules | Existing rules not yet moved to v2 during a migration | Runs at the trigger points configured for v1 rules. Confirm overlap with v2 hooks. | Two systems applying different rules to the same login |
Three login decisions teams move into Actions v2
Most custom login logic falls into four decisions: whether a sign-in is allowed, which roles it receives, what data goes into the token, and what happens after the user exists. Each one reads different inputs and fails differently, so settle the data and the failure behavior before writing any Actions v2 code. Confirm the hook points and their timing in the Zitadel documentation for your version.
Allow-listing sign-in by email domain
The decision is whether a hook refuses a sign-in or registration when the email domain is not on an approved list. The hook needs the email address, whether that address is verified, and the organization the user is entering, so the check applies to the correct tenant. Before building it, settle who owns the list, because customer administrators often expect to manage their own domains. Decide what happens to a user from an unlisted domain: block, send to manual review, or route to a different identity provider. Confirm in the documentation at which point in the flow a denial takes effect.
Mapping external groups to roles
The decision is which roles a user receives when an external provider sends groups or claims at login. The hook needs the claim names and values the upstream provider emits, plus a mapping table that connects each value to a project role or grant in Zitadel. Ask which system is the source of truth for roles, because a role granted in Zitadel and a group removed upstream can disagree. Also ask what happens when the claim is missing, empty or renamed after an identity provider change. Test with a user who loses a group and confirm when the role is removed.
Adding application metadata to tokens
The decision is which application attributes join the user's token before it is issued, such as a plan tier, a tenant code or a cost center. The hook needs the user ID, the requested scopes and the attribute values, either stored as user metadata or fetched from the application's own database. Ask how fresh each value must be, since a token keeps its claims until it expires. Also ask how the flow behaves if a lookup fails, because every lookup adds login latency. Keep personal data out of tokens unless the receiving application needs it.
Reacting to user creation events
The decision is what a downstream system does when Zitadel records an event such as a user being created, for example provisioning an account in a billing or CRM tool. The hook needs the event payload, including the user identifier and organization, and credentials for the downstream API. Ask whether the call must succeed before sign-in continues or can run after the fact, since those are different designs. Assume the same event can arrive more than once, so the receiver should treat repeats as no-ops. Record the mapping between Zitadel user IDs and downstream IDs from the start.
Setting up Zitadel Actions v2 for custom login logic
This sequence moves a custom login hook from decision to production in a fixed order. Each step ends with a check you can run, so the team can see whether the hook is ready before any user depends on it. The result is a tested endpoint, a registered hook, and a rollback plan agreed before promotion.
Confirm the Zitadel release and Actions v2 availability
Confirm which Zitadel release your self-hosted instance runs and that Actions v2 is part of it. The project's release list on GitHub shows v4.19.5, released on 15 October 2026, so compare your deployed version against the release notes and the Actions documentation, and do not assume the newest build applies. Your platform owner records the exact version string from the deployment. The step is done when the recorded version, the Actions v2 configuration screens in the Console, and the documentation you saved for this build all match.
Record each decision and its owner
Write down every decision the hook depends on before anyone builds it. Cover which login events trigger the hook, which checks it runs for domain restrictions, role assignment from an external provider and metadata enrichment, and what happens when the endpoint fails or times out. Also record the timeout value you will configure, and who owns the endpoint, the mapping logic and the rollback call. The step is done when every row in the decision register names one owner and the failure behavior has been approved by the security team, with no blank cells left for the build team to fill in.
Build the endpoint with authenticated incoming calls
The build team creates the endpoint in a service you control, inside your own network, and protects every incoming call before adding business logic. Verify each request from Zitadel using the signing or token method described in the Zitadel documentation for Actions, and reject anything that fails verification. Keep the logic small and deterministic, and avoid outbound calls that can stall a login. The step is done when a test request with no credentials and a test request with a bad signature are both rejected, and a correctly signed test payload returns the response shape the documentation specifies.
Register the hook in a non-production instance
Register the hook in a non-production instance using the Actions v2 screens and configuration keys in the Zitadel documentation. Point it at the endpoint you built, and set the trigger and timeout exactly as the decision register records them. Keep the target and action names identical to the names planned for production, so promotion copies them without retyping. The step is done when the Console shows the hook as active and one test sign-in produces a single call to your endpoint, which the service logs on its side.
Test success, failure and timeout paths
Test the success, failure and timeout paths with named test accounts in the non-production instance, and write down the expected outcome for each case before the run. Create separate accounts for an allowed domain, a denied domain, a user who should receive a role from the external provider, and a user whose metadata the hook enriches. Stop the endpoint to exercise the failure path, then add a delay longer than the configured timeout to exercise the timeout path. The step is done when every case produces the login outcome in the decision register and the Console event viewer shows the expected entry for each attempt.
Promote with a tested rollback plan
Promote the same configuration to production through your change process, with the rollback plan ready before the change window opens. The rollback removes or disables the hook in the Console and restores the previous login behavior. Run the rollback once in non-production before promotion so the team knows the steps work. The step is done when a named test account signs in successfully on production after promotion, and the rollback drill ended with login restored and the change record updated.
Security risks in custom login logic
Custom login logic runs inside the sign-in path, so a weakness in a hook can affect who gets in, what they receive and what the team can prove afterward. The six risks below cover the endpoint's availability, the trust placed in each call, its access to other systems, the personal data it handles, how its code changes and the evidence it leaves behind.
The endpoint sits in the login path
Every hook call made during sign-in waits on your endpoint. If the endpoint times out, returns an error or becomes unreachable, sign-in waits on your endpoint for every user the hook touches. Ask the team to define a fallback for each flow, confirm in your version's documentation whether the hook blocks the flow when it fails, and monitor latency and error rates as login metrics. Give the endpoint the same availability targets as the identity service it supports.
Verify every call before trusting it
The endpoint must reject requests that were not signed by the Zitadel instance it expects. Create a dedicated signing secret for each hook target, keep it in a secrets manager and out of configuration files, and check the signature on every request before the handler reads the payload. Plan rotation as a scheduled task with an overlap window in which old and new secrets both verify. Confirm in the documentation for your version how the signature is computed and which header carries it.
Limit what the endpoint can reach
Hooks often call directory lookups, CRM records or entitlement services to decide a role. Give the endpoint one service identity per downstream system, with read access limited to the fields the hook needs and write access only where a flow requires it. Scope each credential to a single environment, rotate it on a schedule and log each downstream call a hook makes. Review the list of reachable systems at every change, because a new outbound call creates a new path from the login flow into your data.
Minimize personal data in each payload
Hook payloads can carry email addresses, phone numbers and profile attributes so the endpoint can decide. Send only the fields a decision needs, and document which fields each hook receives. Set how long the endpoint keeps request bodies, whether application logs contain personal data and who can read those logs. Mask identifiers in logs where the full value is not needed, and ask your privacy team whether this data flow must appear in your records of processing.
Review login logic like production code
Login logic decides who gets in and with which role, so a small edit can widen access across a whole tenant. Keep the endpoint code and the Actions v2 target configuration in version control, require a second reviewer for changes to role assignment or domain checks, and test each hook against a staging instance before production. Record who approved each release, and keep the previous version ready for rollback. Treat changes to hook conditions as code changes, because they alter when the endpoint runs. Ensure reviewers cover treat configuration as code for every change.
Record what each hook decided
When a user disputes a denied login or a wrong role, the team must show which hook ran, what input it received and what it returned. Have the endpoint write one structured log entry per decision, with a request identifier, the hook name, the outcome and the code version that ran. Correlate those entries with the identity events Zitadel records for the same user, and confirm which events your version exposes. Set retention to match the investigation and audit needs your compliance lead has agreed, and restrict who can alter these logs.
What happens when a login hook fails or times out
Every hook that can block a sign-in needs a written failure decision before it goes live: fail open (let the login proceed without the check) or fail closed (deny the login until the hook answers). This is a business and security choice, so the owner of each rule should make it alongside the engineers who built the endpoint. Take an illustrative domain check that admits only approved partner domains. Failing open admits unapproved accounts during an outage. Failing closed locks out every partner user until the endpoint recovers. Confirm in the documentation for your Zitadel release what happens when a hook returns an error or does not respond in time, and whether that outcome differs between request and response hooks and between Actions v2 and Actions v1 targets.
Make the endpoint highly available in your own infrastructure, using the Kubernetes approach that Zitadel's self-hosting guidance recommends for its own high availability: a cluster you run, at least two replicas spread across nodes or zones, a load balancer with health checks, and resource limits sized from load tests. Place the endpoint in the same region as your Zitadel deployment so network latency does not consume the hook's time limit, and set your own internal timeout below the limit confirmed for your release. Then keep the dependencies small. Every database, directory or third-party API call inside a hook is another way for sign-in to fail, and a hook that calls an external provider inherits that provider's outages. Where data changes slowly, such as a domain allowlist or a role mapping, load it into memory at startup, refresh it on a schedule, and document how stale data is handled.
Test degraded behavior before go-live and after every Zitadel upgrade. Stop one replica during a login test, add latency above the confirmed time limit, return an error status, and return a malformed response. For each case, check three things: whether the user is admitted or denied as the rule's owner decided, what the user sees on screen, and whether the failure appears in your logs and in Zitadel's event records so security can investigate it later. Also rehearse the switch itself. Write a runbook that names who may change a rule from fail closed to fail open, how that change is approved, and how it is recorded. Repeat the tests whenever the hook's dependencies change, because each new dependency adds a failure path that earlier tests never exercised.
Limits to confirm before you commit to hook-based logic
Before you build hooks, confirm six items in your own environment: release support, plan fit, timeout behavior, coexistence with v1, payload and retry limits, and the upgrade path. Each one changes how your login logic should be designed, and each has a source you can check.
Presence in your release
Confirm that Actions v2 exists and is supported in the exact Zitadel version you run. The latest release in our reference set is v4.19.5, released 15 October 2026, so a self-hosted instance on an older version may not expose the same hook types or payload fields. Check the release notes for your version and look for whether the feature is labeled stable or experimental before you plan around it. Then confirm on a test instance that the hook types you need appear in the Console.
Zitadel releasesPlan and deployment fit
Confirm whether Actions v2 is included in the Zitadel Cloud plan you choose or in the self-hosted build you deploy. Plan tiers and feature availability can change, so ask the vendor to confirm in writing which plan includes Actions v2. Ask also whether execution limits or call quotas differ between cloud and self-hosted deployments, and record the answers in the written scope before anyone designs around them.
Zitadel pricingSynchronous timeout behavior
Request and response hooks usually sit in the sign-in path, so a slow external call can delay a user or fail the login. Confirm the maximum time a hook may run, what Zitadel does when that time is reached, and whether functions and event reactions follow the same rule. Test with a deliberately slow endpoint on a test instance and record what the user sees. Treat the fail-open or fail-closed choice as a security decision that needs sign-off from your security owner.
Coexistence with Actions v1
Confirm whether Actions v1 and Actions v2 can run on the same instance at the same time, and which one runs first when both target the same trigger. Mixed execution makes a login hard to reason about, so decide which hooks move to v2 and which stay on v1during the transition. Test a login, a token issue and a user event with both active, and record every hook that fires. Write down the condition that retires v1 for each hook.
Payload size and retries
Confirm the maximum payload size for each hook type and the number of retries Zitadel makes when your endpoint fails or responds late. Large user metadata or long role lists can exceed a limit that never appeared in a small test. Retries mean the same event may reach your code more than once, so your handler needs an idempotency key or a check that makes a repeated call harmless. Confirm both limits in the documentation, then force a failure on a test instance to observe the retry pattern.
Upgrade path for payload changes
Hook payloads can add, rename or remove fields between Zitadel releases, which can break a receiving service without any change on your side. Before each upgrade, read the release notes for hook payload changes, pin your receiving code to the fields it reads, and tolerate unknown fields. Run your hook test suite against the new version on a staging instance and keep the previous version available for rollback. Plan this check into every upgrade, including releases that touch hooks only in part.
Self-hosting overviewZitadel Actions v2 cost, effort and what the work needs from you
What drives the cost of a Zitadel hook build?
The main drivers are how many hooks you need, how much logic sits in each one, how many external systems they call, and how deep the failure handling and testing go. Each external system adds an API contract, credentials, error cases and a test environment, so integrations usually move the quote more than an extra simple rule does. Your quote covers the professional work of planning, building, testing and handing over the hooks. Zitadel's own charges are separate and follow its plans, so check them on the pricing page. Ask every bidder to price these drivers separately, so you can see which ones move the total and which assumptions you can change.
How long does it take to plan and test a Zitadel Actions scope?
Duration depends on the number of hooks in scope, the external systems they touch, and how much testing the flows need. No fixed duration applies to every build, so ask for a schedule with milestones for planning, build, test and handover in the written scope. Planning maps each login or token event to a hook, agrees the request and response contracts, and settles failure behavior. Testing covers normal sign-ins, timeouts, malformed responses and rollback on a non-production instance. Client review, access approvals and endpoint hosting often set the critical path, so ask the proposal to list them as dependencies with named owners and dates.
Can an internal team build Zitadel hooks without an outside partner?
Yes, an internal team with API, identity and Zitadel administration skills can build hooks alone, but confirm those skills before deciding. The team has to write and host the endpoint code, understand each hook's request and response contract, manage signing keys and secrets, and build tests for failure paths. These skills matter most at the start, when design choices are made, and again at each Zitadel upgrade, when the team must retest hook behavior. An outside partner adds the most value where the team lacks capacity or has not built this pattern before. Decide by comparing the skills in your team with the list of hooks in your scope.
What does our team need to provide for a Zitadel hook build?
You provide named owners, a non-production Zitadel instance, hosting for the hook endpoints, and access to every external system the hooks call. Each item needs a specific person or team behind it:
- Named owners: a business owner for each login rule, a security approver, and an administrator for the Zitadel instance.
- Non-production instance: a separate instance with test users, test roles and test identity providers that resemble production.
- Endpoint hosting: a runtime you control, with TLS, secrets storage, logs and a deployment path for the hook code.
- External systems: test credentials and API access for each system, plus its owner's contact for error cases.
Agree these in the written scope so access requests start before build work begins.
Is Actions v2 included in the Zitadel plan we choose?
Confirm it on Zitadel's pricing page, which lists what each plan contains. The page lists Cloud Pro at US$100 per month including 25,000 daily active users, a Free plan at US$0 per month with 100 daily active users, and an Enterprise plan with custom pricing for self-hosted or cloud deployments. Enterprise also includes custom support agreements and technical account management. Check whether the hook features you plan to use appear in the plan you select, and confirm the edition details with Zitadel before you fix the scope. Include that check in the quote request so the price reflects the plan you will run.
How do we ask for a fixed-scope quote for hook work?
Send a written request that lists each hook and its trigger, each external system, the failure behavior you expect, the test environment you will provide, and the handover documents you need. Most DeployOpen engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts. Ask each provider to state what planning, build, testing, documentation and handover include, which items the client supplies, and what is excluded. Ask how changes after signing are priced and who approves them. DeployOpen gives a quote from the written scope and does not publish a price list, so the scope is the basis for comparing offers.
How do Zitadel hook failures affect the login flow?
Confirm in the Zitadel documentation for your version how a failed or slow hook response affects sign-in, because that behavior sets the failure handling you must build and test. For each hook, decide whether the login should stop, continue with a default value, or move to a manual review step, and record the choice. Each option needs its own test case, including a timeout, an error response and a malformed payload. Support staff also need a written runbook that shows what users see and how to find the failing hook in logs. Settle these decisions before pricing, because they change the testing depth and the quote.
How DeployOpen scopes and delivers Zitadel login hooks
DeployOpen scopes Zitadel Actions v2 work as a fixed-scope engagement, with each hook, its trigger and its failure behavior agreed in writing before any code is written. The hooks run in the Zitadel instance you deploy in your own infrastructure, and the handover includes the code, tests and runbook your team needs to operate them.
How we scope
- Each hook is listed by name, with its trigger, input fields, expected response and owner.
- Confirm which Actions v2 hook types and targets your Zitadel release exposes before the build starts.
- The written scope states how existing Actions v1 scripts will be handled alongside the v2 hooks.
How we build
- Domain checks, role assignment and metadata enrichment are built as separate functions with defined inputs and outputs.
- Failure behavior is set per hook, including what users see when an external call times out or fails.
- Hooks are tested on a staging instance with sample users, roles and identity provider responses before production.
How we hand over
- Source code, configuration and test cases are delivered to your repository, with a hook inventory documented.
- The runbook covers deployment order, rollback steps and how to trace hook failures in your logs.
- A walkthrough for your platform and security engineers covers each accepted hook and its known limits.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers after handover.
- Hooks are retested after each Zitadel upgrade, since Actions behavior can change between releases.
- Confirm response expectations, support boundaries and who approves hook changes in the written agreement.

