> ## Documentation Index
> Fetch the complete documentation index at: https://docs.playstarters.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Close Session

> Optionally close a game session when the player leaves the game.

Closes an active game session, performing any integration-specific cleanup (e.g. notifying the game provider that the player has left). This endpoint is **optional** — sessions expire automatically after a period of inactivity if not explicitly closed.

<Info>
  This is a convenience endpoint for operators who want immediate session cleanup. If you don't call it, everything still works — the session will expire on its own.
</Info>

## Endpoint

```http theme={null}
POST /operator/close-session
```

## Headers

| Header          | Value                      |
| --------------- | -------------------------- |
| `Authorization` | `ApiKey ps_<your_api_key>` |
| `Content-Type`  | `application/json`         |

## Body parameters

<ParamField body="sessionToken" type="string" required>
  The session token returned by [`POST /operator/launch`](/api/operator/launch) in the `sessionToken` field.
</ParamField>

## Example request

```bash theme={null}
curl -X POST https://api.playstarters.io/operator/close-session \
  -H "Authorization: ApiKey ps_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionToken": "f2d7b0bb993ddc36aa573b3b0f15bfdf"
  }'
```

## Response — 200 OK

```json theme={null}
{
  "closed": true
}
```

### Response fields

<ResponseField name="closed" type="boolean">
  `true` if the session was found and closed. `false` if the session was not found (already expired or invalid token). Both cases return HTTP 200 — this endpoint never throws an error.
</ResponseField>

<Note>
  This endpoint is idempotent and safe to call multiple times with the same `sessionToken`. Calling it on an already-closed or expired session simply returns `{ "closed": false }`.
</Note>
