create

abstract suspend fun create(request: IB2BDiscoveryOrganizationsCreateParameters): B2BDiscoveryOrganizationsCreateResponse

Creates a new organization and immediately establishes a member session within it. Calls the POST /sdk/v1/b2b/discovery/organizations/create endpoint. Automatically includes the intermediate session token if one is present.

Kotlin:

StytchB2B.discovery.organizations.create(
B2BDiscoveryOrganizationsCreateParameters(
organizationName = "My Company",
organizationSlug = "my-company",
sessionDurationMinutes = 30,
)
)

iOS:

let params = B2BDiscoveryOrganizationsCreateParameters(
organizationName: "My Company",
organizationSlug: "my-company",
sessionDurationMinutes: 30
)
let response = try await StytchB2B.discovery.organizations.create(params)

React Native:

StytchB2B.discovery.organizations.create({
organizationName: "My Company",
organizationSlug: "my-company",
sessionDurationMinutes: 30,
})

Return

B2BDiscoveryOrganizationsCreateResponse containing the new organization and member session.

Parameters

request
  • IB2BDiscoveryOrganizationsCreateParameters

  • sessionDurationMinutes — Duration of the session to create, in minutes.

  • organizationName? — Display name for the new organization.

  • organizationSlug? — URL-safe identifier for the new organization.

  • organizationLogoUrl? — URL for the organization's logo.

  • ssoJitProvisioning? — SSO just-in-time provisioning policy.

  • emailAllowedDomains? — List of allowed email domains for the organization.

  • emailJitProvisioning? — Email just-in-time provisioning policy.

  • emailInvites? — Email invite policy for the organization.

  • authMethods? — Authentication methods policy.

  • allowedAuthMethods? — List of allowed authentication methods.

  • mfaMethods? — MFA methods policy.

  • allowedMfaMethods? — List of allowed MFA methods.

  • mfaPolicy? — MFA enforcement policy.

  • oauthTenantJitProvisioning? — OAuth tenant just-in-time provisioning policy.

  • allowedOauthTenants? — Map of allowed OAuth tenants.

Throws

StytchError

if the organization cannot be created.

if the coroutine is cancelled.