Zitadel user metadata for application data

Zitadel user metadata lets you attach application attributes to users and release them in tokens or userinfo. This page covers how to design that flow and what should stay in your application database.

On this page

Zitadel user metadata for application data: when teams need it

Teams need user metadata when an application needs a few attributes about each user, such as a tenant reference, plan tier or preferred locale, and wants them available at sign-in without a second lookup in a separate database. In Zitadel, user metadata is a set of key-value entries attached to a user record and managed through the Console or the API. It fits small, slowly changing attributes that describe the user for the application's own purposes and that the application needs at the moment of authentication. Before you commit, confirm in Zitadel's current documentation how metadata is written, the limits on entry count and value size, and who can read each key: the user, administrators only, or the application client.

Metadata is the wrong place for data that is large, changes often, is relational, or is owned by another system. Billing balances, entitlements that change with each invoice, usage counters, support history and full profile records belong in the application's own database or the system of record, with Zitadel holding only the identifier that links them. Be especially careful with sensitive data. Health details, government identifiers and payment data should stay out of identity records and token claims. Decide attribute by attribute which system is the source of truth, because a value copied into the identity system will drift unless something keeps it in sync, and someone must own that process.

Getting a value into tokens or userinfo is a separate decision from storing it. Confirm which scopes or Actions your Zitadel version uses to add custom claims, how the claim is named, and whether it appears in the ID token, the access token or only in userinfo. Check token size, since each extra claim lengthens every token the application receives. Also confirm what happens when metadata changes, because tokens issued earlier keep the old value until they expire or are refreshed. Test the full path with a live sign-in before the application relies on it. The Zitadel organizations concept explains where users live, which determines the scope of each metadata key.

Choosing how attributes reach the application

This table compares four ways to get an application attribute stored on a Zitadel user into the application: login-time Actions, scope-based claims, userinfo lookups and a local copy keyed by user ID. Read each row for when the option fits, what it costs in latency or coupling, and how sensitivity or frequent change shifts the choice. The main takeaway is that the more often an attribute changes, the less it should be baked into a token issued at login.

Delivery optionWhen it fitsLatency and coupling costSensitive or frequently changing attributes
Metadata read at login through ActionsSmall, stable values the application needs on every sign-in, such as a tenant code or a plan tierRuns on each login flow, so the Action adds login-time latency and ties the identity system to your data modelKeep out of tokens if sensitive; a stale value persists until the next login or token refresh
Scope-based claims in the tokenValues the client requests with a scope and the API needs without a second callClaims travel in every token, which grows token size and exposes values to every resource server that receives itAvoid for sensitive data; any party holding the token can read it, so limit to non-secret identifiers
Userinfo lookup from the applicationAttributes the application reads on demand after sign-in, where freshness matters more than token sizeOne extra call per session or per refresh, and the application depends on the identity system being reachableBetter for values that change often, since each read returns the current value rather than a copy
Application database linked by user IDBusiness data the application owns, such as preferences, entitlements or account historyLowest runtime coupling; the cost is a sync or ownership rule that keeps the two records consistentPreferred for sensitive or high-change data because the application controls storage, retention and deletion
Hybrid: identifier in token, data in applicationMost multi-tenant products that need a stable user and tenant reference at loginToken stays small; the application makes a lookup for the rest, so design the join onceStrong fit for regulated data, since the identity system holds only what authentication needs

Setting up metadata-backed claims in Zitadel

This sequence moves one application attribute from an agreed owner and data classification into a Zitadel user metadata value, then into a token or userinfo response that the application can rely on. Each step ends with a check, so the team knows the claim is correct before production users see it.

  1. Define the attribute list and owners

    Start with a short register of every application attribute you plan to store on a Zitadel user. For each entry, record the claim name, the application that reads it, the business owner who approves changes, and the system of record if the value originates elsewhere, such as an HR system or billing platform. Confirm the list with the application team and the identity owner in writing. Done means every attribute has one owner and one source, and no attribute is marked as a copy of another system without a named sync process. Illustrative example: a billing_plan attribute owned by finance and sourced from the billing system.

  2. Classify the data behind each attribute

    Assign a data classification to each attribute using your organization's existing scheme, and mark any that are personal data, regulated data or secrets. Anything that is a credential, government identifier, health or financial record, or a value an authorization decision depends on needs a deliberate decision about whether it belongs in the identity system at all. Ask your security and privacy teams to sign off on the classified list. Done means each row has a classification, a retention expectation and an approved storage location, and rejected attributes are removed from the plan before any configuration begins.

  3. Create the project, roles and application

    In the Zitadel Console, create or select the project that will own the application, define the roles the application needs, and register the application with the OIDC settings your client flow requires. Keep the project and organization boundaries aligned with the tenant model you chose, so grants are issued where the customer's users actually sit. Record the client ID, redirect URIs and the scopes the application requests. Done means you can complete a sign-in in the non-production instance and see the expected roles in the session, before any metadata is written.

  4. Write metadata and the claim-mapping Action

    Set the approved attribute values as user metadata through the Console, Management API or your provisioning process, then write an Action that reads the metadata and adds the agreed claim to the token or userinfo response. Limit the Action to the scopes and applications that need the claim, and keep attribute names identical across the register, the metadata key and the claim name. Check the Action's documented function and trigger names against the Zitadel Actions documentation for your version before deploying it. Done means the Action is saved, enabled in the intended flow, and produces no error in the Action logs during a test login.

  5. Decode the token and compare userinfo

    Sign in as a test user and decode the ID token and access token with a JWT inspection tool, confirming the custom claim is present, correctly typed and absent from tokens issued to applications that should not receive it. Then call the userinfo endpoint with the same access token and compare the result. Repeat the test for at least two organizations with different metadata values to confirm the claim changes with the user and does not leak across tenants. Done means the claim matches the source metadata for each test user and the two organizations return the values you expect.

  6. Test denial, missing values and updates

    Test the failure paths before go-live: a user with no metadata value, a user whose value was changed after login, a token request with a scope that should not expose the claim, and a revoked or disabled user. Confirm the application handles absent claims safely, the Action does not fail the login silently, and changes take effect at the point you documented, either at next token issuance or after the current session ends. Record the observed behavior in your runbook. Done means each failure case has a recorded, expected result that the application team has accepted.

  7. Record the sign-off and move to production

    Compile the classified attribute register, the Action code and version, the test results, and the decoded token samples with sensitive values redacted into a single change record. Ask the identity owner, the application owner and the security reviewer to approve it, then promote the configuration to production using the same repeatable process you used in the test instance, so the production state matches what was tested. Done means the change record is approved, the production configuration matches the tested configuration, and a post-deployment token check confirms the claims in a live login by a test account.

What should not live in the identity system

Zitadel user metadata is well suited to small, identity-related attributes such as a customer tier, a cost center or a preferred language. It is a poor home for business records, transaction history, payment or health data, large documents and anything with its own retention or access rules. Those belong in the application database or a dedicated store, where they can be partitioned, encrypted, backed up and retained on their own schedule. Metadata values are read by every service that holds a token or calls the API, so putting regulated or high-volume data there widens its exposure and makes deletion and retention harder to prove. Before adding a metadata key, ask whether the value is needed to decide who the user is or what they may access, and whether an application team would be the right owner of its lifecycle.

Some attributes must exist in both places, such as a customer identifier, an organization reference or an email address. Choose one system of record for each attribute and treat the other copy as a derived value. Zitadel's own user ID or a stable external identifier is usually the right join key, so the application stores the Zitadel user ID rather than copying profile fields it does not own. When a value must be read in both places, define who writes it, how changes propagate (for example through the Zitadel API, an Actions hook or a sync job) and how the application behaves if the two copies disagree during a delay. Confirm the event and webhook options available in your Zitadel version with the vendor documentation before you design the sync path.

Security risks when user data reaches tokens

Application attributes stored on Zitadel users become claims once they reach an ID token, access token or userinfo response. Each risk below follows that path: what leaves the identity system, who can change it, how long it stays valid and who can see the change afterward.

Over-sharing claims to third parties

Every claim added to a token is visible to the application that receives it, and to any downstream service that receives the same token. Metadata written for internal routing or HR purposes can reach a partner app that never needed it. Map each claim to a named consumer, and limit scopes so an application only requests the attributes it uses. Review the scope and claim list for every client before go-live.

Zitadel APIs

Stale attributes after changes

Metadata is a copy of a fact held somewhere else, such as an HR record or a billing system. When that source changes and the copy does not, tokens keep carrying the old value until the next token issue. Decide which system is authoritative for each attribute, define how updates reach Zitadel, and test that a change in the source shows up in a fresh login.

Actions that fail open or closed

Actions run during login and token issuance, so their code executes on every sign-in. If an Action calls an external service and that call fails, the outcome depends on how the Action handles errors: a fail-open path issues tokens without the expected claims, while a fail-closed path blocks sign-in for every user. Set the failure behavior on purpose, set timeouts, and test both outcomes in a non-production instance.

Admin access to metadata

Anyone with rights to edit user metadata can change the claims that downstream systems trust, including authorization decisions based on those claims. Separate administrator roles by organization, restrict who can write attributes that drive access, and keep identity administrators apart from application owners. Confirm the role model in your own instance before granting broad rights.

Token size growth

Each added claim makes the token larger, and large tokens can hit header size limits in proxies, gateways and browsers. Lists such as group or role memberships grow with the number of entries per user. Keep claims short and bounded, avoid embedding large objects, and test token size with the heaviest users in each organization.

Audit of attribute changes

When a claim is wrong, the first question is who changed the attribute and when. Metadata changes need to be traceable to an administrator, an automated process or a provisioning job. Confirm which identity events Zitadel records for metadata writes, export them to your log platform, and set a retention period that matches your investigation and audit needs.

How an attribute moves from metadata to the application

The flow starts when an application requests a token from Zitadel. An Action runs during token issuance, reads the user's metadata, and adds only the claim the application is approved to receive. The token or userinfo response then crosses the trust boundary into the application, which stores only its own non-identity records. Check that the Action reads a narrow set of metadata keys and that the application never writes business data back into identity metadata.

Approved metadata becomes a claim at token issuance, and the application keeps its own records.

Limits to confirm in your environment

Metadata and Actions behavior depends on the Zitadel version you run and on how your identity sources are configured. The items below are the limits most likely to change your design, so confirm each one in your own version with a test before you commit to a claim model.

Metadata value size and count

Check how many metadata keys a user can carry and how large each value may be before a write fails. Application attributes such as entitlements or preference blobs grow over time, so a limit that is comfortable at launch can become a blocker later. Run a write test with realistic payloads and record the exact error returned at the boundary. Also confirm whether metadata is readable through the same API you plan to use from your Action, since a value you can write but not read back will break enrichment silently.

Zitadel APIs

Action execution time and failure behavior

Confirm how long an Action may run and what happens when it times out, returns an error, or cannot reach an external service. Decide whether a failed enrichment should block sign-in, drop the claim, or fall back to a default, and test each path. A slow metadata lookup inside a login flow directly affects every user, so measure latency under load as well as in a single test call.

Token types that carry custom claims

Confirm which token types include the custom claims your Action adds: ID tokens, access tokens, and userinfo responses may not behave the same way. Opaque access tokens and JWT access tokens can differ in what downstream APIs see. Decode a token from each flow your applications use, including client credentials and any token exchange, and compare the claim set with what your resource servers expect. Do not assume a claim added for one token type reaches the others.

Actions v1 and v2 differences

Confirm which trigger points, function signatures, and available context objects exist in the Zitadel version you run, and whether your planned hooks are supported under v1, v2, or both. The two generations can run side by side, but behavior and available data may differ, and a hook written for one may not port cleanly. Record the version you test against and repeat the test after every upgrade, because the Actions surface is the part of the product most likely to change between releases.

Zitadel releases

Metadata in userinfo for federated users

Confirm whether metadata written to a user who signed in through an external identity provider appears in the userinfo response, and whether it is written at first login, on every login, or only when an administrator sets it. Federated accounts often have a different claim set from local accounts, so a claim that works for local test users may be missing for the customers who matter most. Test with each identity provider you plan to federate and compare the userinfo output side by side.

Questions teams ask before building metadata claims

How much effort does building custom metadata claims take?

The effort depends on how many attributes you need, how many applications consume them, and how much logic sits between the stored value and the token. A small set of read-only attributes copied into one token is a short build. Attributes that are written by several systems, mapped from HR or a second identity provider, or filtered differently per application take longer because each mapping needs its own design, tests and sign-off. Ask any partner to break the work into attribute inventory, metadata schema, Action or scope logic, client configuration and verification, and to show which items depend on your decisions rather than on the platform.

Can our own engineers build metadata claims without a partner?

Yes, if your team already runs self-hosted identity and has someone comfortable with OIDC scopes, token claims and Zitadel's Actions. The hard part is usually not the configuration itself but agreeing which data belongs in identity and proving that tokens carry only what each application needs. Teams without that experience often underestimate testing across organizations and roles. An outside partner can take the design and verification work, while your team keeps ownership of the data and the operating runbook. Confirm the split in writing before work starts.

What do we need to provide during a metadata claims project?

Three groups of people are needed. Attribute owners define each value, its source of truth, its format and who may change it. Test users, ideally accounts in each customer organization and role, let the team check what each application receives. A security reviewer signs off on which attributes enter tokens, how long those tokens live and which clients may read them. Without named owners for each attribute, requirements tend to change late, and without security sign-off, a claim that exposes personal data can reach production unnoticed.

How is metadata different from a separate profile database?

Metadata stored on a Zitadel user is a small set of key-value attributes that travel with the identity and can be released into tokens or userinfo through scopes and Actions. A separate profile database holds the full application record, with history, relationships, large content and query patterns the identity system was never built for. Use metadata for facts the login flow and applications need on every request, such as a tenant reference, a locale or an entitlement flag. Keep richer profile data in the application's own store and reference it by identifier. Mixing the two tends to make tokens large and the identity system hard to scale.

How do we roll out metadata and claim changes safely?

Treat each claim as an interface with consumers. Define the claim name, type and meaning, add it alongside the existing one, and let applications move to it before the old one is removed. Test changes in a non-production instance that mirrors your organizations and roles, including accounts with missing values. Record each change in version control so you can see what was altered and when. Ask your partner or internal team to describe how a bad Action is rolled back, because a faulty claim can lock users out or expose data across tenants.

What does ongoing maintenance of metadata claims involve?

Maintenance covers the claims themselves, the Actions that set or read them, and the applications that consume them. Each new application, customer organization or attribute adds review work, and each Zitadel upgrade can change how Actions behave, so the test set should be rerun after every upgrade. Someone must own the attribute inventory and retire claims nobody uses. Ask whether support is covered by a retainer or by your own team, and how upgrades are scheduled, since those choices determine the recurring cost after launch.

Which personal data should stay out of identity tokens?

Keep data out of tokens when the receiving application does not need it to make an access decision, or when it is sensitive, large or changes often. Health details, payment information, free-text notes and government identifiers usually belong in a controlled system with its own access rules and audit trail. Tokens are readable by the client that receives them and can be logged or cached, so every extra claim widens exposure. Have your privacy and security teams classify each attribute before it is added to a scope, and confirm the classification with your compliance lead.

How to test claims before production

Before any application goes live, verify that the claims it receives match the expected claim set for that application. Start by recording that set as a written acceptance artifact for each client: the exact scope values requested, the custom claims the token must carry, the claims that must be absent, and the audience and client identifier. Store it alongside the Action code and the project grant configuration so reviewers can compare the running system against a fixed reference rather than against memory.

Then test each client type on its own path. For browser and mobile clients, decode the ID token and access token and check the custom claims under the agreed namespace, the aud and azp values, and the expiry. For API clients, confirm that the access token carries only the claims the resource server needs. Call the userinfo endpoint with the same access token and compare its response with the ID token, because a claim that appears in only one of them usually points to a scope or Action mistake. Run the same checks for one local user and one user who signed in through a federated identity provider. Federated users often lack attributes that local users have, and the difference should be deliberate and documented, not discovered by a support ticket.

Negative tests matter as much as the happy path. Create test users with missing, empty, oversized, malformed and mistyped metadata values, and confirm that the Action fails in the way you designed, whether that means denying login, omitting the claim or substituting a default. Then check for sensitive attributes: search decoded tokens, userinfo responses and application logs for national identifiers, health or payment data, internal risk scores and credentials, and confirm they are absent. Ask your security and privacy teams to approve the expected claim set before sign-off, and have them retest whenever an Action or scope changes.

How DeployOpen scopes and delivers metadata claims for Zitadel

DeployOpen plans, builds and hands over Zitadel user metadata design for application data inside infrastructure you control. The work starts with a written scope that separates identity attributes from application data, then moves through build, testing and documented handover.

How we scope

  • We inventory which application attributes belong in user metadata and which belong in the application's own database.
  • We agree written scope for the metadata keys, claim names, scopes and Actions that will be built and tested.
  • We confirm the Zitadel version, instance and organization layout, and which applications will read the claims before work begins.

How we build

  • We configure user metadata keys and access rules in your Zitadel environment, following the agreed naming and data-type conventions.
  • We write and test Actions that add or shape claims, and we check token and userinfo output for each client type.
  • We verify that metadata writes from admin tools, provisioning and self-service flows match the approved data model.

How we hand over

  • We deliver a written data model listing each metadata key, its owner, its purpose and the claims it feeds.
  • We document Action code, configuration steps and rollback notes so your platform team can maintain them.
  • We walk your identity and application teams through the design and record open decisions for your own sign-off.

How we support

  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.
  • Ongoing support, upgrades and continuous testing are available as a retainer, including review of changes to Zitadel releases.
  • Quotes follow from the written scope, so ask for the components, environments and handover items each quote covers.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.