# Verify Session

`POST /gate/verify-session` · Identity & Access · Sign-in & Sessions

Validates a Gate-issued end-user access JWT, confirming it is properly signed and within its TTL. Because Gate JWTs are stateless bearer tokens, verification is a local signature check against the project JWKS; the JWT TTL is the revocation propagation bound.

## Parameters

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

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `token` | string | yes | The end user's access token to check. |

```json
{
  "token": "eyJhbGciOiJFUzI1NiIsImtpZCI6ImtleV9leGFtcGxlIn0.eyJzdWIiOiJldV9leGFtcGxlIn0.c2lnbmF0dXJl"
}
```

## Responses

- **200**: Success

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | object | yes | The verdict. A bad token is a 200 with `valid: false`, not an error. |
| _one of_ | | |  |
| `data.valid` | enum (true) | yes | The token is genuine, unexpired, issued for this project, and its end user is active. |
| `data.claims` | object | yes | What the token says. |
| `data.claims.subjectId` | string | yes | The token's subject: the end user's id (`eu_...`). |
| `data.claims.projectId` | string | yes | The token's audience: this project's id (`proj_...`). |
| `data.claims.expiresAt` | string (date-time) | yes | When the token expires. |
| _or_ | | |  |
| `data.valid` | enum (false) | yes | The token must not be accepted. |
| `data.reason` | string | yes | Why. `AUDIENCE_MISMATCH`: the token was issued for another project. `SUBJECT_NOT_ACTIVE`: its end user is locked, deleted or gone. Otherwise the error code from checking the token, such as `K9O_INVALID_TOKEN` or `K9O_TOKEN_EXPIRED`. |
| `meta` | object | yes | Request metadata: cost, timing and the request and trace ids. |


## Errors

| HTTP | Code | When |
|---|---|---|
| 401 | `K9O_INVALID_CREDENTIALS` | The session token provided for verification is invalid or does not exist. |
| 401 | `K9O_SESSION_EXPIRED` | The session being verified has expired or been revoked. |

## Code samples

### cURL

```bash
curl -X POST 'https://<org>.api-<region>.k9o.io/@storefront/gate/verify-session' \
  -H 'Authorization: Bearer $K9O_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "token": "eyJhbGciOiJFUzI1NiIsImtpZCI6ImtleV9leGFtcGxlIn0.eyJzdWIiOiJldV9leGFtcGxlIn0.c2lnbmF0dXJl"
}'
```

### fetch

```javascript
const res = await fetch('https://<org>.api-<region>.k9o.io/@storefront/gate/verify-session', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.K9O_TOKEN}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
  "token": "eyJhbGciOiJFUzI1NiIsImtpZCI6ImtleV9leGFtcGxlIn0.eyJzdWIiOiJldV9leGFtcGxlIn0.c2lnbmF0dXJl"
}),
});
const { data, meta } = await res.json();
```

### @k9o/core

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


Canonical page: https://docs.kilimanjaro.dev/api-playground/identity-access/verify-session
