Clerk logo

Clerk Docs

Ctrl + K
Go to clerk.dev

Organization Object

Organization operations are exposed by the organizations sub-api (clerkClient.organizations)

createOrganization(params)

Creates an organization.

1

Available parameters are:

NameTypeDescription
namestring

Name of the organization.

slugstring
createdBystring

The user id for the user creating the organization. The user will become an administrator for the organization.

publicMetadataRecord<string, unknown>

Metadata saved on the organization, that is visible to both your Frontend and Backend APIs.

privateMetadataRecord<string, unknown>

Metadata saved on the organization that is only visible to your Backend API.

createOrganizationInvitation(params)

Creates an invitation for new users to join an organization.

1

Available parameters are:

NameTypeDescription
organizationIDstring

The organization Id of the organization a user is being invited to.

inviterUserIdstring

The user id of the user creating the invitation.

emailAddressstring

The email address to send the invitation to.

roleOrganizationMembershipRole

The role to assign the invited user within the organization.

publicMetadataRecord<string, unknown>

Metadata saved on the invitation that is visible to both your Frontend and Backend APIs.

redirectUrlstring

The URL users will land at once the organization invitation has been accepted.

createOrganizationMembership(params)

Creates membership to an organization for a user directly (circumventing the need for an invitation).

1

Available parameters are:

NameTypeDescription
organizationIdstring

The organization Id of the organization a user is being added to.

userIdstring

The user id of the user being added to the organization.

roleOrganizationMembershipRole

The role to assign the added user within the organization.

deleteOrganization(organizationId)

Deletes an organization given a valid id. Throws an error otherwise.

1

deleteOrganizationMembership(params)

Removes a user from the specified organization.

1

Available parameters are:

NameTypeDescription
organizationIdstring

The id of the organization the user will be removed from.

userIdstring

The user id to remove from the organization.

getOrganization(organizationId)

Retrieves a single organization by the organization id, if the id is valid. Throws an error otherwise.

1

getOrganizationList(params?: GetOrganizationListParams)

Retrieves organization list:

1

Retrieves organization list that is filtered by the number of results. More params can be found at the OrganizationListParams definition.

1

getOrganizationMembershipList(params)

Retrieves organization membership list:

1

Retrieves orgnanization membership list that is filtered by the number of results. More params can be found at the GetOrganizationMembershipListParams definition.

1

getPendingOrganizationInvitationList(params)

Retrieves a list of organization invitations that have not yet been accepted.

1

Retrieves orgnanization invitation list that is filtered by the number of results. More params can be found at the GetOrganizationInvitationListParams definition.

1

revokeOrganizationInvitation(params)

Revokes an organization invitation from a user for the specified organization.

1

Available parameters are:

NameTypeDescription
organizationIdstring

The id of the organization the user was invited to.

invitationIdstring

Id of the invitation to be revoked.

requestingUserIdstring

Id of the user revoking the organization invitation.

updateOrganization(organizationId, params)

Updates the organization name.

1

Available parameters are:

NameTypeDescription
namestring

Updated name of the organization.

updateOrganizationMembership(params)

Updates a user's organization membership parameters.

1

Available parameters are:

NameTypeDescription
organizationIdstring

The organization Id of the organization a user is being added to.

userIdstring

The user id of the user being added to the organization.

roleOrganizationMembershipRole

The role to assign the added user within the organization.

updateOrganizationMetadata(organizationId, params)

Updates the metadata associated with the specified organization id.

1

Available parameters are:

NameTypeDescription
publicMetadataRecord<string, unknown>

Metadata saved on the organization, that is visible to both your Frontend and Backend APIs.

privateMetadataRecord<string, unknown>

Metadata saved on the organization that is only visible to your Backend API.

updateOrganizationMembershipMetadata(params)

Updates the metadata associated with a user's organization membership.

1

Available parameters are:

NameTypeDescription
organizationIdstring

The id of the organization this membership belongs to.

userIdstring

The user id associated with the metadata being updated.

publicMetadataRecord<string, unknown>

Metadata saved on the organization, that is visible to both your Frontend and Backend APIs.

privateMetadataRecord<string, unknown>

Metadata saved on the organization that is only visible to your Backend API.

Was this helpful?

Clerk © 2022