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

---

# Directory sync

Sync users and groups via SCIM directories
<div class="sdk-client-page">

Use `scalekit_client.directory` for SCIM directory sync—listing providers, users, and groups provisioned from an IdP.

Use this after SSO is in place when the customer provisions users via SCIM.

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

      Method to list directories for given organization id

      
        org id to fetch directory list
      
      
        list of directories
      

```python wrap showLineNumbers=false
response = scalekit_client.directory.list_directories('org_123456')

for directory in response[0].directories:
    print(f"Directory: {directory.id}")
```

    
  
</div>

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

      Method to get directory based on given organization and directory id

      
        Organization id
      
      
        directory id
      
      
        Get Directory Response
      

```python wrap showLineNumbers=false
response = scalekit_client.directory.get_directory(
    'org_123456',
    'directory_123456'
)
directory = response[0].directory
```

    
  
</div>

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

      Method to create directory based on given organization id

      
        Organization id to create directory for
      
      
        CreateDirectory object with expected values for dir creation
      
      
        Create Directory Response
      

```python wrap showLineNumbers=false
from scalekit.v1.directories.directories_pb2 import CreateDirectory

directory = CreateDirectory()
directory.provider = "azure"

response = scalekit_client.directory.create_directory(
    'org_123456',
    directory
)
```

    
  
</div>

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

      Runs `list_directory_users` and returns the result.

      
        Organization ID.
      
      
        Directory ID.
      
      
        Results per page.
      
      
        Pagination token.
      
      
        Include detail.
      
      
        Updated after.
      
      
        tuple[ListDirUsersResponse, Any]
      

```python wrap showLineNumbers=false
response = scalekit_client.directory.list_directory_users(
    'org_123456',
    'directory_123456',
    page_size=50
)

for user in response[0].users:
    print(f"User: {user.email}")
```

    
  
</div>

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

      Runs `list_directory_groups` and returns the result.

      
        Organization ID.
      
      
        Directory ID.
      
      
        Results per page.
      
      
        Pagination token.
      
      
        Include detail.
      
      
        Updated after.
      
      
        tuple[ListDirGroupsResponse, Any]
      

```python wrap showLineNumbers=false
response = scalekit_client.directory.list_directory_groups(
    'org_123456',
    'directory_123456',
    page_size=50
)

for group in response[0].groups:
    print(f"Group: {group.display_name}")
```

    
  
</div>

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

      Method to enable directory based on given organization and directory id

      
        Organization id
      
      
        directory id
      
      
        Toggle Directory Response
      

```python wrap showLineNumbers=false
scalekit_client.directory.enable_directory('org_123456', 'directory_123456')
```

    
  
</div>

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

      Method to disable directory based on given organization and directory id

      
        Organization id
      
      
        directory id
      
      
        Toggle Directory Response
      

```python wrap showLineNumbers=false
scalekit_client.directory.disable_directory('org_123456', 'directory_123456')
```

    
  
</div>

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

      Method to delete directory based on given organization and directory id

      
        Organization id to delete directory for
      
      
        Directory id for directory to be deleted
      
      
        Empty on success.
      

```python wrap showLineNumbers=false
scalekit_client.directory.delete_directory('org_123456', 'directory_123456')
```

    
  
</div>

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

      Method to get primary directory based on given organization id

      
        Organization id
      
      
        Primary directory
      

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