Skip to main content
Docs

Organization metadata

Organization metadata lets you store custom information about an organization that is not part of the standard fields, such as custom attributes that are specific to your application. This is useful for advanced user segmentation, analytics, or storing application-specific data like subscription tier, department, or region.

There are two types of metadata: public and private.

  • You can set both public and private metadata and access them from the Backend API.
  • You can access only public metadata from the Frontend API.

Both the Organization and Organization Membership objects have the metadata fields: publicMetadata and privateMetadata.

  • Use the publicMetadata property if you need to set some metadata from your backend and have them displayed as read-only on the frontend.
  • Use the privateMetadata property if the custom attributes contain sensitive information that should not be displayed on the frontend.

Set organization metadata

You can set organization metadata in the Clerk dashboard or using the JS Backend SDKClerk Icon.

Clerk Dashboard

  1. In the Clerk Dashboard, navigate to the Organizations page.
  2. Select the organization you want to update.
  3. In the Organization metadata section, select Edit next to the metadata you want to update.

JS Backend SDK

To ease the flow of setting metadata, Clerk provides the updateOrganizationMetadata()Clerk Icon and updateOrganizationMembershipMetadata()Clerk Icon methods from the JS BackendClerk Icon, which is a wrapper around the Backend API.

Warning

Metadata is limited to 8KB maximum. If you're storing metadata as a custom claim in the session token, it's highly recommended to keep it under 1.2KB. Learn more about the session token size limitations.

If you use Clerk metadata and modify it server-side, the changes won't appear in the session token until the next refresh. To avoid race conditions, either force a JWT refresh after metadata changes or handle the delay in your application logic.

Next steps

Now that you understand organization metadata, you can:

Feedback

What did you think of this content?

Last updated on