> **Building with AI coding agents?** Install the authstack plugin with one command. This equips your agent with accurate Scalekit implementation patterns.
>
> **Recommended**:
> ```bash
> npx @scalekit-inc/cli setup
> ```
>
> Global:
> ```bash
> npm install -g @scalekit-inc/cli
> scalekit setup
> ```
>
> Supports Claude Code, Cursor, GitHub Copilot, Codex + skills for 40+ agents.
> Features: full-stack-auth, agent-auth, mcp-auth, modular-sso, modular-scim.
> [Full setup guide](https://docs.scalekit.com/dev-kit/build-with-ai/)

---

# Organizations

Manage your customer organizations
<div class="sdk-client-page">

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
<div class="sdk-method-section">
  
    
      

      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.
      

```typescript wrap showLineNumbers=false
// externalId: Your system's ID for this org
// logoUrl: Public URL of the org logo
// slug: URL-safe org slug
const org = await scalekit.organization.createOrganization(
  'Acme Corporation',
  { externalId: 'customer_12345' }
);

console.log('Organization ID:', org.organization.id);
```

    
  
</div>

### listOrganization
<div class="sdk-method-section">
  
    
      

      Retrieves a paginated list of all organizations in your Scalekit environment.

      
        Optional fields: `pageSize`, `pageToken`.
      
      
        Paginated organizations.
      

```typescript wrap showLineNumbers=false
// pageSize: Results per page (default 10, max 100)
// pageToken: Token for the next page
const response = await scalekit.organization.listOrganization({
  pageSize: 20
});

console.log('Organizations:', response.organizations);
console.log('Total:', response.totalSize);
```

    
  
</div>

### getOrganization
<div class="sdk-method-section">
  
    
      

      Retrieves detailed information about a specific organization using its Scalekit ID.

      
        Scalekit resource ID.
      
      
        The organization.
      

```typescript wrap showLineNumbers=false
const response = await scalekit.organization.getOrganization('org_12345');
const org = response.organization;

console.log('Organization:', org.displayName);
console.log('External ID:', org.externalId);
```

    
  
</div>

### getOrganizationByExternalId
<div class="sdk-method-section">
  
    
      

      Retrieves detailed information about an organization using your system's external identifier.

      
        Your system's unique identifier for the organization
      
      
        The organization.
      

```typescript wrap showLineNumbers=false
const response = await scalekit.organization.getOrganizationByExternalId('customer_12345');
const org = response.organization;

console.log('Scalekit ID:', org.id);
console.log('Organization:', org.displayName);
```

    
  
</div>

### updateOrganization
<div class="sdk-method-section">
  
    
      

      Updates an organization's properties using its Scalekit ID.

      
        The Scalekit organization identifier (format: "org_...")
      
      
        Fields to update.
      
      
        The updated organization.
      

```typescript wrap showLineNumbers=false
// displayName: Display name
// metadata: Custom key-value metadata
const response = await scalekit.organization.updateOrganization('org_12345', {
  displayName: 'Acme Corporation (Updated)',
  metadata: {
    industry: 'Technology',
    size: 'Enterprise'
  }
});
```

    
  
</div>

### updateOrganizationByExternalId
<div class="sdk-method-section">
  
    
      

      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.
      

```typescript wrap showLineNumbers=false
// displayName: Display name
const response = await scalekit.organization.updateOrganizationByExternalId(
  'customer_12345',
  { displayName: 'New Company Name' }
);
```

    
  
</div>

### deleteOrganization
<div class="sdk-method-section">
  
    
      

      Permanently deletes an organization from your Scalekit environment.

      
        The Scalekit organization identifier to delete
      
      
        Empty response on successful deletion
      

```typescript wrap showLineNumbers=false
await scalekit.organization.deleteOrganization('org_12345');
console.log('Organization deleted successfully');
```

    
  
</div>

### generatePortalLink
<div class="sdk-method-section">
  
    
      

      Creates a single use Admin Portal URL valid for 1 minute.

      
        The Scalekit organization ID
      
      
        Portal or auth URL.
      

```typescript wrap showLineNumbers=false
app.get('/admin/sso-settings', async (req, res) => {
  const organizationId = req.user.organizationId;

  const link = await scalekit.organization.generatePortalLink(organizationId);

  res.redirect(link.location);
});
```

    
  
</div>

### updateOrganizationSettings
<div class="sdk-method-section">
  
    
      

      Updates configuration settings and feature flags for an organization.

      
        Organization ID.
      
      
        Configuration settings object containing:
      
      
        The organization.
      

```typescript wrap showLineNumbers=false
const response = await scalekit.organization.updateOrganizationSettings('org_12345', {
  features: [
    { name: 'sso', enabled: true },
    { name: 'directory_sync', enabled: true }
  ]
});
```

    
  
</div>

### upsertUserManagementSettings
<div class="sdk-method-section">
  
    
      

      Creates or updates user management settings for an organization.

      
        Organization ID.
      
      
        User management configuration:
      
      
        Organization user management settings message | undefined.
      

```typescript wrap showLineNumbers=false
const settings = await scalekit.organization.upsertUserManagementSettings(
  'org_12345',
  { maxAllowedUsers: 100 }
);

console.log('Max users allowed:', settings?.maxAllowedUsers);
```

    
  
</div>

### searchOrganization
<div class="sdk-method-section">
  
    
      

      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.
      

    
  
</div>

### getOrganizationUserManagementSetting
<div class="sdk-method-section">
  
    
      

      Retrieves the user management settings for a specific organization.

      
        The Scalekit organization identifier
      
      
        The response payload for this operation.
      

    
  
</div>

### updateOrganizationSessionPolicy
<div class="sdk-method-section">
  
    
      

      Sets a custom session policy for an organization or reverts it to application defaults.

      
        Organization ID.
      
      
        The policy to apply.
      
      
        The updated session policy.
      

    
  
</div>

### getOrganizationSessionPolicy
<div class="sdk-method-section">
  
    
      

      Retrieves the session policy for a specific organization.

      
        The Scalekit organization identifier
      
      
        The organization's session policy settings
      

    
  
</div>

</div>


---

## More Scalekit documentation

| Resource | What it contains | When to use it |
|----------|-----------------|----------------|
| [/llms.txt](/llms.txt) | Structured index with routing hints per product area | Start here — find which documentation set covers your topic before loading full content |
| [/llms-full.txt](/llms-full.txt) | Complete documentation for all Scalekit products in one file | Use when you need exhaustive context across multiple products or when the topic spans several areas |
| [sitemap-0.xml](https://docs.scalekit.com/sitemap-0.xml) | Full URL list of every documentation page | Use to discover specific page URLs you can fetch for targeted, page-level answers |
