> **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 `scalekitClient.sessions()` 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.

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

      Runs `getSession` and returns the result.

      
        Session ID.
      
      
        The response payload for this operation.
      

```java wrap showLineNumbers=false
scalekitClient.sessions().getSession("sess_123");
```

    
  
</div>

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

      Runs `getUserSessions` and returns the result.

      
        Scalekit user ID (`usr_...`).
      
      
        Page size.
      
      
        Page token.
      
      
        Result filter.
      
      
        The response payload for this operation.
      

```java wrap showLineNumbers=false

UserSessionFilter filter = UserSessionFilter.newBuilder().build();

scalekitClient.sessions().getUserSessions("user_123", 20, "", filter);
```

    
  
</div>

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

      Runs `revokeSession` and returns the result.

      
        Session ID.
      
      
        Empty on success.
      

```java wrap showLineNumbers=false
scalekitClient.sessions().revokeSession("sess_123");
```

    
  
</div>

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

      Runs `revokeAllUserSessions` and returns the result.

      
        Scalekit user ID (`usr_...`).
      
      
        Empty on success.
      

```java wrap showLineNumbers=false
scalekitClient.sessions().revokeAllUserSessions("user_123");
```

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