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

---

# Connections

Configure enterprise SSO connections
<div class="sdk-client-page">

Use `scalekit_client.connection` to configure enterprise SSO (SAML/OIDC) for an organization.

Enable SSO after the organization exists: create a connection, complete IdP setup, and test sign-in for that org.

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

      Method to list connections

      
        Client organization id to get connections
      
      
        Optional. Return active connections or all, E.g. - 'all'
      
      
        List Connections Response
      

```python wrap showLineNumbers=false
response = scalekit_client.connection.list_connections(
    'org_123456',
    include='all'
)

for conn in response[0].connections:
    print(f"Connection: {conn.id}")
```

    
  
</div>

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

      Method to get connection object by domain

      
        Client domain id to get connections
      
      
        Optional. Return active connections or all, E.g. - 'all'
      
      
        List Connections Response
      

```python wrap showLineNumbers=false
response = scalekit_client.connection.list_connections_by_domain(
    'acme.com',
    include='all'
)
```

    
  
</div>

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

      Method to get connection object

      
        Client organization id to get connection
      
      
        Client connection id to get connection
      
      
        Connection Response
      

```python wrap showLineNumbers=false
response = scalekit_client.connection.get_connection(
    'org_123456',
    'conn_123456'
)
connection = response[0].connection
```

    
  
</div>

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

      Method to create a new connection

      
        Organization id to create connection for
      
      
        CreateConnection object with expected values for conn.
      
      
        Create Connection Response
      

```python wrap showLineNumbers=false
from scalekit.v1.connections.connections_pb2 import CreateConnection

connection = CreateConnection()
connection.type = "SAML"

response = scalekit_client.connection.create_connection(
    'org_123456',
    connection
)
```

    
  
</div>

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

      Method to enable connection

      
        Client organization id to enable connection
      
      
        Client connection id to enable connection
      
      
        Enable Connection Response
      

```python wrap showLineNumbers=false
scalekit_client.connection.enable_connection('org_123456', 'conn_123456')
```

    
  
</div>

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

      Method to disable connection

      
        Client organization id to disable connection
      
      
        Client connection id to disable connection
      
      
        Disable Connection Response
      

```python wrap showLineNumbers=false
scalekit_client.connection.disable_connection('org_123456', 'conn_123456')
```

    
  
</div>

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

      Method to delete a connection based in given organization and connection id

      
        Organization id to delete connection for
      
      
        Connection id of connection to be deleted
      
      
        Empty on success.
      

```python wrap showLineNumbers=false
scalekit_client.connection.delete_connection('org_123456', 'conn_123456')
```

    
  
</div>

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

      Method to list environment-level app connections

      
        Results per page.
      
      
        Optional. Token for pagination
      
      
        Optional. Filter by provider (e.g. 'HUBSPOT')
      
      
        List App Connections Response
      

```python wrap showLineNumbers=false
response = scalekit_client.connection.list_app_connections()

for conn in response[0].connections:
    print(f"Connection: {conn.id}, Provider: {conn.provider_key}")

# Filter by provider
response = scalekit_client.connection.list_app_connections(provider='HUBSPOT', page_size=10)
```

    
  
</div>

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

      Method to get an environment-level connection by its id

      
        Connection id to retrieve
      
      
        Get Connection Response
      

```python wrap showLineNumbers=false
response = scalekit_client.connection.get_environment_connection('conn_123456')
conn = response[0].connection
print(f"Provider: {conn.provider_key}, Type: {conn.type}")
```

    
  
</div>

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

      Method to create a new environment-level connection

      
        CreateConnection object with expected values for conn.
      
      
        Optional. Optional Flags (is_login, is_app)
      
      
        Create Connection Response
      

```python wrap showLineNumbers=false
from scalekit.v1.connections.connections_pb2 import (
    CreateConnection, ConnectionType, Flags
)

# Create an OAuth app connection (e.g., HubSpot)
response = scalekit_client.connection.create_environment_connection(
    connection=CreateConnection(
        provider_key='HUBSPOT',
        type=ConnectionType.OAUTH
    ),
    flags=Flags(is_app=True)
)
conn = response[0].connection
print(f"Created: {conn.id}, Key: {conn.key_id}")

# Create a Google Domain-Wide Delegation connection
response = scalekit_client.connection.create_environment_connection(
    connection=CreateConnection(
        provider_key='GOOGLEDWD',
        type=ConnectionType.GOOGLE_DWD,
        key_id='my-gdwd-connection'
    ),
    flags=Flags(is_app=True)
)
```

    
  
</div>

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

      Method to update an environment-level connection

      
        Connection id to update
      
      
        UpdateConnection object with fields to update
      
      
        Update Connection Response
      

```python wrap showLineNumbers=false
from scalekit.v1.connections.connections_pb2 import (
    UpdateConnection, ConnectionType, OAuthConnectionConfig, GoogleDWDConfig
)

# Update OAuth connection credentials
response = scalekit_client.connection.update_environment_connection(
    connection_id='conn_123456',
    connection=UpdateConnection(
        provider_key='HUBSPOT',
        key_id='hubspot-key',
        type=ConnectionType.OAUTH,
        oauth_config=OAuthConnectionConfig(
            client_id={'value': 'my-client-id'},
            client_secret={'value': 'my-client-secret'}
        )
    )
)

# Update Google DWD connection
response = scalekit_client.connection.update_environment_connection(
    connection_id='conn_123456',
    connection=UpdateConnection(
        provider_key='GOOGLEDWD',
        key_id='my-gdwd-connection',
        type=ConnectionType.GOOGLE_DWD,
        google_dwd_config=GoogleDWDConfig(
            service_account_json={'value': '{"type":"service_account",...}'},
            scopes=['https://www.googleapis.com/auth/admin.directory.user.readonly'],
            token_uri={'value': 'https://oauth2.googleapis.com/token'}
        )
    )
)
conn = response[0].connection
```

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