OrganizationApi

interface OrganizationApi

Retrofit API interface for organization-related operations in the Clerk system.

This interface defines all HTTP endpoints for managing organizations, domains, invitations, roles, and other organization-related functionality.

See also

com.clerk.api.organizations

Functions

Link copied to clipboard
@POST(value = "organizations/{organization_id}/membership_requests/{request_id}/accept")
abstract suspend fun acceptMembershipRequest(@Path(value = "organization_id") organizationId: String, @Path(value = "request_id") membershipRequestId: String): ClerkResult<OrganizationMembershipRequest, ClerkErrorResponse>

Accepts an organization membership request. The current user must have permissions to manage the members of the organization.

Link copied to clipboard
@FormUrlEncoded
@POST(value = "organizations/{organization_id}/domains/{domain_id}/attempt_affiliation_verification")
abstract suspend fun attemptAffiliationVerification(@Path(value = "organization_id") organizationId: String, @Path(value = "domain_id") domainId: String, @Field(value = "code") code: String): ClerkResult<OrganizationDomain, ClerkErrorResponse>

Attempts to verify the affiliation of an organization domain using a verification code.

Link copied to clipboard
@FormUrlEncoded
@POST(value = "organizations/{organization_id}/invitations/bulk")
abstract suspend fun bulkCreateInvitations(@Path(value = "organization_id") organizationId: String, @Field(value = "email_address") emailAddresses: List<String>, @Field(value = "role") role: String): ClerkResult<List<OrganizationInvitation>, ClerkErrorResponse>

Bulk create an invitation for a user to join an organization.

Link copied to clipboard
@FormUrlEncoded
@POST(value = "organizations/{organization_id}/invitations")
abstract suspend fun createInvitation(@Path(value = "organization_id") organizationId: String, @Field(value = "email_address") emailAddress: String, @Field(value = "role") role: String): ClerkResult<OrganizationInvitation, ClerkErrorResponse>

Create an invitation for a user to join an organization.

Link copied to clipboard
@FormUrlEncoded
@POST(value = "organizations/{organization_id}/memberships")
abstract suspend fun createMembership(@Path(value = "organization_id") organizationId: String, @Field(value = "role") role: String?, @Field(value = "user_id") userId: String?): ClerkResult<OrganizationMembership, ClerkErrorResponse>

Creates a new membership for a user in an organization.

Link copied to clipboard
@FormUrlEncoded
@POST(value = "organizations")
abstract suspend fun createOrganization(@Field(value = "name") name: String): ClerkResult<Organization, ClerkErrorResponse>

Creates a new organization.

Link copied to clipboard
@FormUrlEncoded
@POST(value = "organizations/{organization_id}/domains")
abstract suspend fun createOrganizationDomain(@Path(value = "organization_id") organizationId: String, @Field(value = "name") name: String): ClerkResult<OrganizationDomain, ClerkErrorResponse>

Creates a new domain for an organization.

Link copied to clipboard
@DELETE(value = "organizations/{organization_id}")
abstract suspend fun deleteOrganization(@Path(value = "organization_id") organizationId: String): ClerkResult<DeletedObject, ClerkErrorResponse>

Deletes an organization.

Link copied to clipboard
@DELETE(value = "organizations/{organization_id}/domains/{domain_id}")
abstract suspend fun deleteOrganizationDomain(@Path(value = "organization_id") organizationId: String, @Path(value = "domain_id") domainId: String): ClerkResult<DeletedObject, ClerkErrorResponse>

Deletes an organization domain.

Link copied to clipboard
@DELETE(value = "organizations/{organization_id}/logo")
abstract suspend fun deleteOrganizationLogo(@Path(value = "organization_id") organizationId: String): ClerkResult<Organization, ClerkErrorResponse>

Deletes the logo for an organization.

Link copied to clipboard
@GET(value = "organizations/{organization_id}/invitations")
abstract suspend fun getAllInvitations(@Path(value = "organization_id") organizationId: String, @Query(value = "limit") limit: Int? = null, @Query(value = "offset") offset: Int? = null, @Query(value = "status") status: String? = null): ClerkResult<ClerkPaginatedResponse<OrganizationInvitation>, ClerkErrorResponse>

Retrieve all invitations for an organization. The current user must have permissions to manage the members of the organization.

Link copied to clipboard
@GET(value = "organizations/{organization_id}/domains")
abstract suspend fun getAllOrganizationDomains(@Path(value = "organization_id") organizationId: String, @Query(value = "limit") limit: Int? = null, @Query(value = "offset") offset: Int? = null, @Query(value = "verified") verified: Boolean? = null, @Query(value = "enrollment_mode") enrollmentMode: String? = null): ClerkResult<ClerkPaginatedResponse<OrganizationDomain>, ClerkErrorResponse>

Retrieves all domains for an organization with optional filtering and pagination.

Link copied to clipboard
@GET(value = "organizations/{organization_id}/memberships")
abstract suspend fun getMembers(@Path(value = "organization_id") organizationId: String, @Query(value = "limit") limit: Int?, @Query(value = "offset") offset: Int?, @Query(value = "paginated") paginated: Boolean = true, @Query(value = "_clerk_session_id") sessionId: String? = null, @Query(value = "role") role: String? = null, @Query(value = "query") query: String? = null): ClerkResult<ClerkPaginatedResponse<OrganizationMembership>, ClerkErrorResponse>

Retrieves memberships for an organization with optional filtering and pagination.

Link copied to clipboard
@GET(value = "organizations/{organization_id}/invitations")
abstract suspend fun getMembershipRequests(@Path(value = "organization_id") organizationId: String, @Query(value = "limit") limit: Int? = null, @Query(value = "offset") offset: Int? = null, @Query(value = "status") status: String? = null): ClerkResult<ClerkPaginatedResponse<OrganizationMembershipRequest>, ClerkErrorResponse>

Retrieve a list of all membership requests of an organization. The current user must have permissions to manage the members of the organization.

Link copied to clipboard
@GET(value = "organizations/{organization_id}")
abstract suspend fun getOrganization(@Path(value = "organization_id") organizationId: String): ClerkResult<Organization, ClerkErrorResponse>

Retrieves a specific organization by its ID.

Link copied to clipboard
@GET(value = "organizations/{organization_id}/domains/{domain_id}")
abstract suspend fun getOrganizationDomain(@Path(value = "organization_id") organizationId: String, @Path(value = "domain_id") domainId: String): ClerkResult<OrganizationDomain, ClerkErrorResponse>

Retrieves a specific organization domain by its ID.

Link copied to clipboard
@GET(value = "organizations/{organization_id}/roles")
abstract suspend fun getRoles(@Path(value = "organization_id") organizationId: String, @Query(value = "limit") limit: Int? = null, @Query(value = "offset") offset: Int? = null): ClerkResult<List<Role>, ClerkErrorResponse>

Retrieves roles for a specific organization.

Link copied to clipboard
@FormUrlEncoded
@POST(value = "organizations/{organization_id}/domains/{domain_id}/prepare_affiliation_verification")
abstract suspend fun prepareAffiliationVerification(@Path(value = "organization_id") organizationId: String, @Path(value = "domain_id") domainId: String, @Field(value = "affiliation_email_address") affiliationEmailAddress: String): ClerkResult<OrganizationDomain, ClerkErrorResponse>

Prepares affiliation verification for an organization domain by sending a verification email.

Link copied to clipboard
@POST(value = "organizations/{organization_id}/membership_requests/{request_id}/reject")
abstract suspend fun rejectMembershipRequest(@Path(value = "organization_id") organizationId: String, @Path(value = "request_id") membershipRequestId: String): ClerkResult<OrganizationMembershipRequest, ClerkErrorResponse>

Rejects an organization membership request. The current user must have permissions to manage the members of the organization.

Link copied to clipboard
@DELETE(value = "organizations/{organization_id}/memberships/{user_id}")
abstract suspend fun removeMember(@Path(value = "organization_id") organizationId: String, @Path(value = "user_id") userId: String): ClerkResult<OrganizationMembership, ClerkErrorResponse>

Removes a member from an organization.

Link copied to clipboard
@POST(value = "organizations/{organization_id}/membership_requests")
abstract suspend fun revokeOrganizationInvitation(@Path(value = "organization_id") organizationId: String, @Path(value = "invitation_id") invitationId: String): ClerkResult<OrganizationInvitation, ClerkErrorResponse>

Revoke a pending organization invitation.

Link copied to clipboard
@FormUrlEncoded
@POST(value = "organizations/{organization_id}/domains/{domain_id}/update_enrollment_mode")
abstract suspend fun updateEnrollmentMode(@Path(value = "organization_id") organizationId: String, @Path(value = "domain_id") domainId: String, @Field(value = "enrollment_mode") enrollmentMode: String, @Field(value = "delete_pending") deletePending: Boolean? = null): ClerkResult<OrganizationDomain, ClerkErrorResponse>

Updates the enrollment mode for an organization domain.

Link copied to clipboard
@FormUrlEncoded
@PATCH(value = "organizations/{organization_id}/memberships/{user_id}")
abstract suspend fun updateMembership(@Path(value = "organization_id") organizationId: String, @Path(value = "user_id") userId: String, @Field(value = "role") role: String): ClerkResult<OrganizationMembership, ClerkErrorResponse>

Updates the role of an existing member in an organization.

Link copied to clipboard
@FormUrlEncoded
@PATCH(value = "organizations/{organization_id}")
abstract suspend fun updateOrganization(@Path(value = "organization_id") organizationId: String, @Field(value = "name") name: String? = null, @Field(value = "slug") slug: String? = null): ClerkResult<Organization, ClerkErrorResponse>

Updates an existing organization.

Link copied to clipboard
@Multipart
@PUT(value = "organizations/{organization_id}/logo")
abstract suspend fun updateOrganizationLogo(@Path(value = "organization_id") organizationId: String, @Part file: MultipartBody.Part): ClerkResult<Organization, ClerkErrorResponse>

Updates the logo for an organization.