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

---

# Sessions

Validate tokens and manage user sessions
<div class="sdk-client-page">

Use the `scalekit_client.sessions` client to inspect session metadata and revoke sessions when users sign out or you detect risk.

Typical flows: load a session by ID after authentication, list a user's sessions for a security UI, and revoke one session or all of a user's sessions on logout.

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

      Method to get session details by session ID

      
        Session ID to get session details
      
      
        Session Details
      

```python wrap showLineNumbers=false
response = scalekit_client.sessions.get_session('session_123456')
session = response[0]
```

    
  
</div>

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

      Method to get all session details for a user with pagination and filtering support

      
        User ID to get all session details for
      
      
        Optional. Number of sessions to return per page
      
      
        Optional. Token for pagination to get next/previous page
      
      
        Optional. Filter to apply to sessions (status, time range)
      
      
        User Session Details with pagination info
      

```python wrap showLineNumbers=false
response = scalekit_client.sessions.get_user_sessions(
    'usr_123456',
    page_size=50
)

for session in response[0].sessions:
    print(f'Session: {session.id}')
```

    
  
</div>

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

      Method to revoke a session for a user

      
        Session ID to revoke
      
      
        Revoke Session Response
      

```python wrap showLineNumbers=false
response = scalekit_client.sessions.revoke_session('session_123456')
```

    
  
</div>

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

      Method to revoke all sessions for a user

      
        User ID to revoke all sessions for
      
      
        Revoke All User Sessions Response
      

```python wrap showLineNumbers=false
response = scalekit_client.sessions.revoke_all_user_sessions('usr_123456')
```

    
  
</div>

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

      Helper method to create a UserSessionFilter for filtering sessions

      
        Optional. List of session statuses to filter by
      
      
        Optional. Filter sessions from this timestamp
      
      
        Optional. Filter sessions until this timestamp
      
      
        UserSessionFilter object
      

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