# Revoke All Sessions

`POST /auth/sessions/revoke-all` · Identity & Access · Sign-in & Sessions

Ends every live session of the calling end user in this project, on every device, this one included. Call it with the end user's own Gate access token, whose audience must be this project. Answers `{ revokedCount }`, the number of sessions ended.

Each ended session's next refresh is refused 401 `K9O_SESSION_EXPIRED` with `context.reason: "revoked"`. Access tokens already issued stay valid until they expire. The project's `accessTokenTtlMins` sets how long that is.

When a session ends, one `auth.session.ended` record with `reason: "revoke_all"` is written to the project audit log.

## Parameters

| Name | In | Required | Description |
|---|---|---|---|
| `projectSlug` | path | yes | The project's slug: the path segment after `@`. It is unique within the org. Example: `"storefront"`. |

## Responses

- **200**: Success

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | object | yes | How many sessions were ended. |
| `data.revokedCount` | integer | yes | How many live sessions were ended, on every device, the caller's own included. Their refresh tokens stop working at once; access tokens already issued stay valid until they expire. 0 when there were none. |
| `meta` | object | yes | Request metadata: cost, timing and the request and trace ids. |


## Errors

| HTTP | Code | When |
|---|---|---|
| 401 | `K9O_UNAUTHENTICATED` | The caller is not signed in. |
| 403 | `K9O_TRUST_ZONE_VIOLATION` | The token is not an end user's; an operator uses /auth/users/{userId}/sessions/revoke-all. |
| 403 | `K9O_PROJECT_SCOPE_MISMATCH` | The token's project audience is not this project. |

## Code samples

### cURL

```bash
curl -X POST 'https://<org>.api-<region>.k9o.io/@storefront/auth/sessions/revoke-all' \
  -H 'Authorization: Bearer $K9O_TOKEN'
```

### fetch

```javascript
const res = await fetch('https://<org>.api-<region>.k9o.io/@storefront/auth/sessions/revoke-all', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.K9O_TOKEN}`
  },
});
const { data, meta } = await res.json();
```

### @k9o/core

```typescript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.gate.revokeAllSessions()
```

### k9o

```python
# k9o = create_client(org_slug="playground", project_slug="storefront", api_key="k9o_…")
response = k9o.gate.revoke_all_sessions()
```

### sdk-go

```go
// ctx := context.Background()
// client, _ := k9o.NewClient(k9o.ClientOpts{OrgSlug: "playground", ProjectSlug: "storefront", APIKey: "k9o_…"})
data, _, kerr := client.Gate.RevokeAllSessions(ctx)
```

### k9o

```rust
// let k9o = Client::new(ClientOpts { org_slug: "playground".into(), project_slug: "storefront".into(), api_key: "k9o_…".into() })?;
let resp = k9o.gate.revoke_all_sessions().await?
```

### dev.k9o:core

```java
// K9o k9o = K9o.createClient(K9o.Opts.builder().orgSlug("playground").projectSlug("storefront").apiKey("k9o_…").build());
var response = k9o.gate().revokeAllSessions()
```

### K9o.Core

```c#
// var k9o = K9oClient.Create(new K9oOptions { OrgSlug = "playground", ProjectSlug = "storefront", ApiKey = "k9o_…" });
var response = await k9o.Gate.RevokeAllSessionsAsync()
```

### k9o

```ruby
# k9o = K9o.create_client(org_slug: "playground", project_slug: "storefront", api_key: "k9o_…")
response = k9o.gate.revoke_all_sessions()
```

### k9o/sdk

```php
// $k9o = K9oClient::create(['org_slug' => 'playground', 'project_slug' => 'storefront', 'api_key' => 'k9o_…']);
$response = $k9o->gate->revoke_all_sessions()
```

### K9o

```swift
// let k9o = try K9o.createClient(orgSlug: "playground", projectSlug: "storefront", apiKey: "k9o_…")
let result = try await k9o.gate.revokeAllSessions()
```

### core-kotlin

```kotlin
// val k9o = createClient { orgSlug = "playground"; projectSlug = "storefront"; apiKey = "k9o_…" }
val result = k9o.gate.revokeAllSessions()
```

### k9o (Flutter)

```dart
// final k9o = K9o.createClient(orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…');
final result = await k9o.gate.revokeAllSessions()
```

### @k9o/react-native

```javascript
// const k9o = createClient({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })  // RN, secure storage
const { data } = await k9o.gate.revokeAllSessions()
```


Canonical page: https://docs.kilimanjaro.dev/api-playground/identity-access/revoke-all-sessions
