Organizations
Manage your customer organizations
Use the organization client to create and manage customer tenants (organizations) in your Scalekit application.
Start here when onboarding a new customer: create an organization, set external IDs and branding, then add users and SSO for that org.
createOrganization
Section titled “createOrganization”#asynccreateOrganization
Creates a new organization (tenant) in your Scalekit application.
Display name for the organization (e.g., “Acme Corporation”)
Optional fields: externalId, logoUrl, slug.
The created organization.
// externalId: Your system's ID for this org// logoUrl: Public URL of the org logo// slug: URL-safe org slugconst org = await scalekit.organization.createOrganization( 'Acme Corporation', { externalId: 'customer_12345' });
console.log('Organization ID:', org.organization.id);listOrganization
Section titled “listOrganization”#asynclistOrganization
Retrieves a paginated list of all organizations in your Scalekit environment.
Optional fields: pageSize, pageToken.
Paginated organizations.
// pageSize: Results per page (default 10, max 100)// pageToken: Token for the next pageconst response = await scalekit.organization.listOrganization({ pageSize: 20});
console.log('Organizations:', response.organizations);console.log('Total:', response.totalSize);getOrganization
Section titled “getOrganization”#asyncgetOrganization
Retrieves detailed information about a specific organization using its Scalekit ID.
Scalekit resource ID.
The organization.
const response = await scalekit.organization.getOrganization('org_12345');const org = response.organization;
console.log('Organization:', org.displayName);console.log('External ID:', org.externalId);getOrganizationByExternalId
Section titled “getOrganizationByExternalId”#asyncgetOrganizationByExternalId
Retrieves detailed information about an organization using your system’s external identifier.
Your system’s unique identifier for the organization
The organization.
const response = await scalekit.organization.getOrganizationByExternalId('customer_12345');const org = response.organization;
console.log('Scalekit ID:', org.id);console.log('Organization:', org.displayName);updateOrganization
Section titled “updateOrganization”#asyncupdateOrganization
Updates an organization’s properties using its Scalekit ID.
The Scalekit organization identifier (format: “org_…”)
Fields to update.
The updated organization.
// displayName: Display name// metadata: Custom key-value metadataconst response = await scalekit.organization.updateOrganization('org_12345', { displayName: 'Acme Corporation (Updated)', metadata: { industry: 'Technology', size: 'Enterprise' }});updateOrganizationByExternalId
Section titled “updateOrganizationByExternalId”#asyncupdateOrganizationByExternalId
Updates an organization’s properties using your system’s external identifier.
Your system’s unique identifier for the organization
Fields to update.
The updated organization.
// displayName: Display nameconst response = await scalekit.organization.updateOrganizationByExternalId( 'customer_12345', { displayName: 'New Company Name' });deleteOrganization
Section titled “deleteOrganization”#asyncdeleteOrganization
Permanently deletes an organization from your Scalekit environment.
The Scalekit organization identifier to delete
Empty response on successful deletion
await scalekit.organization.deleteOrganization('org_12345');console.log('Organization deleted successfully');generatePortalLink
Section titled “generatePortalLink”#asyncgeneratePortalLink
Creates a single use Admin Portal URL valid for 1 minute.
The Scalekit organization ID
Portal or auth URL.
app.get('/admin/sso-settings', async (req, res) => { const organizationId = req.user.organizationId;
const link = await scalekit.organization.generatePortalLink(organizationId);
res.redirect(link.location);});updateOrganizationSettings
Section titled “updateOrganizationSettings”#asyncupdateOrganizationSettings
Updates configuration settings and feature flags for an organization.
Organization ID.
Configuration settings object containing:
The organization.
const response = await scalekit.organization.updateOrganizationSettings('org_12345', { features: [ { name: 'sso', enabled: true }, { name: 'directory_sync', enabled: true } ]});upsertUserManagementSettings
Section titled “upsertUserManagementSettings”#asyncupsertUserManagementSettings
Creates or updates user management settings for an organization.
Organization ID.
User management configuration:
Organization user management settings message | undefined.
const settings = await scalekit.organization.upsertUserManagementSettings( 'org_12345', { maxAllowedUsers: 100 });
console.log('Max users allowed:', settings?.maxAllowedUsers);searchOrganization
Section titled “searchOrganization”#asyncsearchOrganization
Searches for organizations matching a query string.
Search query string
Optional. Number of results per page
Optional. Pagination token for the next page
Paginated results.
getOrganizationUserManagementSetting
Section titled “getOrganizationUserManagementSetting”#asyncgetOrganizationUserManagementSetting
Retrieves the user management settings for a specific organization.
The Scalekit organization identifier
The response payload for this operation.
updateOrganizationSessionPolicy
Section titled “updateOrganizationSessionPolicy”#asyncupdateOrganizationSessionPolicy
Sets a custom session policy for an organization or reverts it to application defaults.
Organization ID.
The policy to apply.
The updated session policy.
getOrganizationSessionPolicy
Section titled “getOrganizationSessionPolicy”#asyncgetOrganizationSessionPolicy
Retrieves the session policy for a specific organization.
The Scalekit organization identifier
The organization’s session policy settings