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

# Reconcile Room

> Reconcile the active participants counter with the server's ground truth.

Fixes a stale `active_participants` count by querying the server for the actual
number of online users and updating the stored counter to match.

This is useful when the dashboard analytics show an incorrect active-user count,
typically caused by abrupt client disconnections (e.g. a killed process or
network failure) that prevented the normal decrement path from completing.

## Endpoint

```
POST /v1/accounts/:accountId/rooms/:roomId/reconcile
```

## Authentication

**Bearer token** required.

## Path Parameters

<ParamField path="roomId" type="string" required>
  The room's unique ID.
</ParamField>

## Response

<ResponseField name="room" type="CollabKitRoom">
  The room object with the corrected `active_participants` value. See [`CollabKitRoom`](/types/core#collabkitroom).
</ResponseField>

<ResponseField name="previous_active_participants" type="number">
  The `active_participants` value that was stored before reconciliation.
</ResponseField>

<ResponseField name="reconciled_active_participants" type="number">
  The corrected `active_participants` value, reflecting the actual number of
  users currently connected to the room.
</ResponseField>

## Example

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST "https://api.collab-kit.com/v1/accounts/${ACCOUNT_ID}/rooms/c3003c93-60cf-4184-b85f-20be14d26dac/reconcile" \
    -H "Authorization: Bearer ${TOKEN}"
  ```

  ```typescript JavaScript theme={null}
  const roomId = 'c3003c93-60cf-4184-b85f-20be14d26dac';
  const res = await fetch(
    `https://api.collab-kit.com/v1/accounts/${accountId}/rooms/${roomId}/reconcile`,
    {
      method: 'POST',
      headers: { 'Authorization': `Bearer ${token}` },
    },
  );
  const { data } = await res.json();
  console.log(`Fixed: ${data.previous_active_participants} -> ${data.reconciled_active_participants}`);
  ```
</CodeGroup>

```json Response (200) theme={null}
{
  "type": "response",
  "success": true,
  "description": "OK",
  "data": {
    "room": {
      "id": "c3003c93-60cf-4184-...",
      "account_id": "a1b2c3d4-...",
      "name": "whiteboard/room-one",
      "custom_id": "my-room-1",
      "created_at": "2026-05-29T10:00:00.000Z",
      "state": "active",
      "duration_seconds": 3600,
      "active_participants": 0,
      "total_users_created": 500
    },
    "previous_active_participants": 500,
    "reconciled_active_participants": 0
  },
  "error": null
}
```

<Note>
  This endpoint is safe to call at any time. If the counter is already accurate,
  the response will show the same value for both `previous_active_participants`
  and `reconciled_active_participants`.
</Note>
