createOrganizationWithHttpInfo method

Future<Response> createOrganizationWithHttpInfo({
  1. CreateOrganizationRequest? createOrganizationRequest,
})

Create an organization

Creates a new organization with the given name for an instance. You can specify an optional slug for the new organization. If provided, the organization slug can contain only lowercase alphanumeric characters (letters and digits) and the dash "-". Organization slugs must be unique for the instance. You can provide additional metadata for the organization and set any custom attribute you want. Organizations support private and public metadata. Private metadata can only be accessed from the Backend API. Public metadata can be accessed from the Backend API, and are read-only from the Frontend API. The created_by user will see this as their active organization (https://clerk.com/docs/organizations/overview#active-organization) the next time they create a session, presuming they don't explicitly set a different organization as active before then.

Note: This method returns the HTTP Response.

Parameters:

Implementation

Future<http.Response> createOrganizationWithHttpInfo({
  CreateOrganizationRequest? createOrganizationRequest,
}) async {
  // ignore: prefer_const_declarations
  final path = r'/organizations';

  // ignore: prefer_final_locals
  Object? postBody = createOrganizationRequest;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  const contentTypes = <String>['application/json'];

  return apiClient.invokeAPI(
    path,
    'POST',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}