Skip to main content
POST
Update User Metadata
This endpoint requires organization admin privileges. Only users with the org:admin role can update user metadata.
Organization-Scoped Metadata: Metadata set through this endpoint is specific to the user’s membership in your organization. If the same user belongs to multiple organizations, each organization maintains separate metadata.
Update custom metadata for a user within your organization. Perfect for managing user roles, departments, teams, or any custom properties needed for filtering and organization.

Authentication

string
required
Bearer token for authentication. Must be from a user with org:admin role.

Body

string
required
Clerk user ID of the user whose metadata should be updated
object
required
Key-value pairs of metadata to set for the user. This completely replaces existing metadata.

Response

boolean
Whether the metadata update was successful
object
Updated user information

Examples

Error Codes

object
Bad Request - Invalid request data or validation errors
object
Unauthorized - Invalid or missing authentication
object
Forbidden - User is not an admin in the organization, or target user is not a member of the organization
object
Method Not Allowed - Only POST requests are accepted
object
Internal Server Error - Unexpected error occurred

Use Cases

Department Management

Assign users to departments for organizational filtering:

Role-Based Access Control

Set roles that can be used for filtering in the dashboard:

Custom Properties

Store any custom data relevant to your organization:

Workflow

Step 1: Get User ID

First, retrieve the user ID from the Get Organization Users endpoint:

Step 2: Update Metadata

Then update their metadata:

Features

Organization Isolation: Complete metadata separation between organizations.
  • Per-Organization Metadata: Same user in different orgs has independent metadata
  • Complete Replacement: Metadata object completely replaces existing metadata (not merged)
  • Real-time Updates: Changes are immediately reflected in dashboard filters and user listings
  • Flexible Schema: Store any JSON-serializable data structure
  • Dashboard Integration: Use metadata for filtering conversations and statistics

Important Notes

Metadata Replacement: This endpoint completely replaces the user’s metadata in your organization. To preserve existing fields, fetch current metadata first and merge your changes before updating.
  • Metadata is scoped to the organization - each org maintains separate metadata for shared users
  • Removing a user from the organization deletes their metadata for that org
  • Re-adding a user creates fresh metadata (previous metadata is not restored)
  • Metadata can contain any JSON-serializable data (strings, numbers, booleans, objects, arrays)
  • Changes are reflected immediately in dashboard filters

Security Notes

  • Only organization admins can update user metadata
  • Target user must be a member of your organization
  • Cannot update metadata for users in other organizations
  • Metadata is visible in API responses to all org members
Use this endpoint with Get Organization Users to build powerful user management workflows and custom dashboards.