Skip to Content
Clerk logo

Clerk Docs

Ctrl + K
Go to clerk.com

Organization Metadata

Metadata allows for custom data to be saved on the Organization and Organization Membership objects. There are two types of metadata: public and private. Choosing which metadata field you should use for setting custom attributes on your organizations becomes a matter of access and visibility.

MetadataFrontend APIBackend API
private-Read and write
publicReadRead and write

Metadata is limited to 8kb maximum.

Both public and private metadata are set from the Backend API, but public metadata can be accessed from the Frontend API and Backend API. These types of metadata can be used to access non-sensitive information about an organization, such as their profile picture or their name. They can be used to build UIs where an organization might not be signed in, but you still want to show some of their profile info.

The publicMetadata property should be used if you need to set some metadata from your backend and have them displayed as read-only on the frontend.

The privateMetadata property should be used if custom attributes contain sensitive information that should not be displayed on the frontend.

Examples

updateOrganizationMetadata

const organizationId = 'my-organization-id'; const update = await organizations.updateOrganizationMetadata(organizationId, { publicMetadata:{ "example": "metadata" } });

updateOrganizationMembershipMetadata

const organizationId = 'my-organization-id'; const userId = 'my-user-id'; const update = await organizations.updateOrganizationMembershipMetadata(organizationId, userId, { publicMetadata:{ "example": "metadata" } });

Last updated on October 6, 2023

What did you think of this content?

Clerk © 2023