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

---

# Permissions

Manage fine-grained permissions
<div class="sdk-client-page">

Use the `permission` client to define fine-grained permissions that roles can grant.

Model permissions for resources in your app, then attach them to roles.

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

      Creates a new permission defining a specific action users can perform.

      
        Permission object containing:
      
      
        Created permission with ID and timestamps
      

```typescript wrap showLineNumbers=false
await scalekit.permission.createPermission({
  name: 'read:invoices',
  description: 'View invoice details'
});
```

    
  
</div>

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

      Retrieves complete information for a specific permission.

      
        Permission identifier (e.g., 'read:documents')
      
      
        Permission details including description and timestamps
      

```typescript wrap showLineNumbers=false
const response = await scalekit.permission.getPermission('read:invoices');
console.log('Description:', response.permission.description);
```

    
  
</div>

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

      Lists all permissions with pagination support.

      
        Optional. Token for retrieving the next page
      
      
        Optional. Number of permissions per page (max: 100)
      
      
        Paginated list of permissions
      

```typescript wrap showLineNumbers=false
const response = await scalekit.permission.listPermissions();
response.permissions.forEach(perm => {
  console.log(`${perm.name}: ${perm.description}`);
});
```

    
  
</div>

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

      Updates an existing permission's attributes.

      
        Permission to update
      
      
        Updated permission properties
      
      
        Updated permission details
      

```typescript wrap showLineNumbers=false
await scalekit.permission.updatePermission('read:invoices', {
  name: 'read:invoices',
  description: 'View invoice details and history (updated)'
});
```

    
  
</div>

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

      Permanently removes a permission.

      
        Permission identifier to delete
      
      
        Empty response on success
      

```typescript wrap showLineNumbers=false
await scalekit.permission.deletePermission('deprecated:feature');
```

    
  
</div>

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

      Lists direct permissions assigned to a role (excluding inherited permissions).

      
        Role to examine
      
      
        List of directly assigned permissions only
      

```typescript wrap showLineNumbers=false
const response = await scalekit.permission.listRolePermissions('editor');
console.log('Direct permissions:', response.permissions);
```

    
  
</div>

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

      Grants additional permissions to a role without removing existing assignments.

      
        Target role to enhance
      
      
        Array of permission identifiers to add
      
      
        Updated list of all role permissions
      

```typescript wrap showLineNumbers=false
await scalekit.permission.addPermissionsToRole('editor', [
  'read:documents',
  'write:documents',
  'edit:documents'
]);
```

    
  
</div>

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

      Revokes a specific permission from a role, restricting access for all assigned users.

      
        Role to modify
      
      
        Permission to remove
      
      
        Empty response on success
      

```typescript wrap showLineNumbers=false
await scalekit.permission.removePermissionFromRole('editor', 'delete:documents');
```

    
  
</div>

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

      Lists all effective permissions for a role including both direct and inherited permissions.

      
        Role to analyze
      
      
        Complete list including inherited permissions
      

```typescript wrap showLineNumbers=false
const response = await scalekit.permission.listEffectiveRolePermissions('senior_editor');

console.log('Total effective permissions:', response.permissions.length);
```

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