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

---

# M2M clients

Machine-to-machine clients and tokens
<div class="sdk-client-page">

Use M2M client APIs to create and manage machine-to-machine OAuth clients and secrets for service-to-service auth.

Create an M2M client, store the secret securely, then obtain tokens with client credentials.

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

      Interface for managing M2M (machine-to-machine) API clients per organization.

      
        The organization ID to create the client for
      
      
        Client.
      
      
        The created resource.
      

```java wrap showLineNumbers=false

OrganizationClient orgClient = OrganizationClient.newBuilder()
  .setName("Production Service Account")
  .build();

scalekitClient.m2m().createOrganizationClient("org_123", orgClient);
```

    
  
</div>

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

      Retrieves details of a specific M2M scalekitClient.

      
        The organization ID
      
      
        The client ID (format: skc_xxxxx)
      
      
        The response payload for this operation.
      

```java wrap showLineNumbers=false
scalekitClient.m2m().getOrganizationClient("org_123", "skc_xxxxx");
```

    
  
</div>

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

      Updates the configuration of an existing M2M scalekitClient.

      
        The organization ID
      
      
        The client ID to update
      
      
        OrganizationClient proto with fields to update
      
      
        The updated resource.
      

```java wrap showLineNumbers=false

OrganizationClient updates = OrganizationClient.newBuilder()
  .setName("Updated Service Account Name")
  .build();

scalekitClient.m2m().updateOrganizationClient("org_123", "skc_xxxxx", updates);
```

    
  
</div>

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

      Permanently deletes an M2M client from an organization.

      
        The organization ID
      
      
        The client ID to delete
      
      
        No return value
      

```java wrap showLineNumbers=false
scalekitClient.m2m().deleteOrganizationClient("org_123", "skc_xxxxx");
```

    
  
</div>

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

      Adds a new secret to an M2M scalekitClient.

      
        The organization ID
      
      
        The client ID to add a secret to
      
      
        The created resource.
      

    
  
</div>

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

      Permanently removes a secret from an M2M scalekitClient.

      
        The organization ID
      
      
        The client ID
      
      
        The secret ID to remove
      
      
        No return value
      

    
  
</div>

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

      Lists all M2M clients for an organization with pagination.

      
        The organization ID
      
      
        Page size (between 10 and 100; 0 uses server default)
      
      
        Pagination cursor for next page (null or empty for first page).
      
      
        Paginated results.
      

```java wrap showLineNumbers=false
scalekitClient.m2m().listOrganizationClients("org_123", 20, "");
```

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