> **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">
  
    
      

      Runs `CreateOrganization` and returns the result.

      
        Request context
      
      
        Display name.
      
      
        Optional request settings.
      
      
        The created organization.
      

```go wrap showLineNumbers=false

  "context"
  "fmt"

  "github.com/scalekit-inc/scalekit-sdk-go/v2"
)

ctx := context.Background()
org, err := scalekitClient.Organization().CreateOrganization(ctx, "Acme Corporation", scalekit.CreateOrganizationOptions{
  ExternalId: "customer_12345",
  Metadata: map[string]string{
    "source": "signup",
  },
})
if err != nil {
  // handle
}

fmt.Println("Organization ID:", org.Organization.Id)
```

    
  
</div>

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

      Runs `ListOrganization` and returns the result.

      
        Request context
      
      
        Request payload.
      
      
        Paginated organizations.
      

```go wrap showLineNumbers=false
orgs, err := scalekitClient.Organization().ListOrganization(ctx, &scalekit.ListOrganizationOptions{
  PageSize:  10,
  PageToken: "",
})
if err != nil {
  // handle
}
for _, org := range orgs.Organizations {
  _ = org.Id
}

// Use server defaults
orgs, err = scalekitClient.Organization().ListOrganization(ctx, nil)
```

    
  
</div>

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

      Runs `GetOrganization` and returns the result.

      
        Request context
      
      
        Resource ID.
      
      
        The organization.
      

```go wrap showLineNumbers=false
org, err := scalekitClient.Organization().GetOrganization(ctx, "org_123")
if err != nil {
  // handle
}
_ = org.Organization
```

    
  
</div>

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

      Runs `GetOrganizationByExternalId` and returns the result.

      
        Request context
      
      
        External ID.
      
      
        The organization.
      

```go wrap showLineNumbers=false
org, err := scalekitClient.Organization().GetOrganizationByExternalId(ctx, "customer_12345")
if err != nil {
  // handle
}
_ = org.Organization
```

    
  
</div>

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

      Runs `UpdateOrganization` and returns the result.

      
        Request context
      
      
        Resource ID.
      
      
        Fields to update.
      
      
        The updated organization.
      

```go wrap showLineNumbers=false
// DisplayName: Display name
updated, err := scalekitClient.Organization().UpdateOrganization(
  ctx,
  "org_123",
  &organizations.UpdateOrganization{
    DisplayName: func() *string { s := "Updated name"; return &s }(),
  },
)
if err != nil {
  // handle
}
_ = updated.Organization
```

    
  
</div>

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

      Runs `UpdateOrganizationByExternalId` and returns the result.

      
        Request context
      
      
        External ID.
      
      
        Fields to update.
      
      
        The updated organization.
      

```go wrap showLineNumbers=false
// DisplayName: Display name
updated, err := scalekitClient.Organization().UpdateOrganizationByExternalId(
  ctx,
  "customer_12345",
  &organizations.UpdateOrganization{
    DisplayName: func() *string { s := "Updated name"; return &s }(),
  },
)
if err != nil {
  // handle
}
_ = updated.Organization
```

    
  
</div>

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

      Runs `DeleteOrganization` and returns the result.

      
        Request context
      
      
        Resource ID.
      
      
        error
      

```go wrap showLineNumbers=false
if err := scalekitClient.Organization().DeleteOrganization(ctx, "org_123"); err != nil {
  // handle
}
```

    
  
</div>

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

      Runs `GeneratePortalLink` and returns the result.

      
        Request context
      
      
        Organization ID.
      
      
        Authorization link.
      

```go wrap showLineNumbers=false
link, err := scalekitClient.Organization().GeneratePortalLink(ctx, "org_123")
if err != nil {
  // handle
}
_ = link.Url
```

    
  
</div>

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

      Runs `UpdateOrganizationSettings` and returns the result.

      
        Request context
      
      
        Resource ID.
      
      
        Settings.
      
      
        The organization.
      

```go wrap showLineNumbers=false
resp, err := scalekitClient.Organization().UpdateOrganizationSettings(ctx, "org_123", scalekit.OrganizationSettings{
  Features: []scalekit.Feature{
    {Name: "sso", Enabled: true},
    {Name: "dir_sync", Enabled: true},
  },
})
if err != nil {
  // handle
}
_ = resp.Organization.Settings
```

    
  
</div>

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

      Runs `UpsertUserManagementSettings` and returns the result.

      
        Request context
      
      
        Organization ID.
      
      
        Settings.
      
      
        organizationsv1.OrganizationUserManagementSettings
      

```go wrap showLineNumbers=false
maxUsers := int32(150)
settings, err := scalekitClient.Organization().UpsertUserManagementSettings(
  ctx,
  "org_123",
  scalekit.OrganizationUserManagementSettings{
    MaxAllowedUsers: &maxUsers,
  },
)
if err != nil {
  // handle
}
_ = settings.MaxAllowedUsers
```

    
  
</div>

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

      Runs `GetOrganizationSessionPolicy` and returns the result.

      
        Request context
      
      
        Organization ID.
      
      
        The response payload for this operation.
      

```go wrap showLineNumbers=false
policy, err := scalekitClient.Organization().GetOrganizationSessionPolicy(ctx, "org_123")
if err != nil {
  // handle
}
if policy.PolicySource == scalekit.SessionPolicySourceCustom {
  _ = policy.AbsoluteSessionTimeout.GetValue()
}
```

    
  
</div>

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

      Runs `UpdateOrganizationSessionPolicy` and returns the result.

      
        Request context
      
      
        Organization ID.
      
      
        Policy.
      
      
        The updated resource.
      

```go wrap showLineNumbers=false
timeout := int32(360)
idleTimeout := int32(60)
idleEnabled := true
policy, err := scalekitClient.Organization().UpdateOrganizationSessionPolicy(ctx, "org_123", scalekit.OrganizationSessionPolicy{
  PolicySource:               scalekit.SessionPolicySourceCustom,
  AbsoluteSessionTimeout:     &timeout,
  AbsoluteSessionTimeoutUnit: scalekit.TimeUnitMinutes,
  IdleSessionTimeoutEnabled:  &idleEnabled,
  IdleSessionTimeout:         &idleTimeout,
  IdleSessionTimeoutUnit:     scalekit.TimeUnitMinutes,
})
if err != nil {
  // handle
}
_ = policy

// Revert to application defaults
reverted, err := scalekitClient.Organization().UpdateOrganizationSessionPolicy(ctx, "org_123", scalekit.OrganizationSessionPolicy{
  PolicySource: scalekit.SessionPolicySourceApplication,
})
if err != nil {
  // handle
}
_ = reverted
```

    
  
</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 |
