---
title: "Sync Community Rooms"
method: POST
path: "/events/community-rooms/sync"
tags: ["events"]
---

# Sync Community Rooms

`POST /events/community-rooms/sync`

Cron-triggered endpoint that ensures the right number of voice chatrooms exist
for each community hour that's currently active or about to start.

Authenticated by the ``INTERNAL_CRON_TOKEN`` shared secret (2026-09-18
route-auth review); test_every_route_answers.py had it listed as "cron
trigger anyone can fire". It creates voice chatrooms, so an open version
is a room-spam button. kubernetes/cronjobs/community-rooms-sync.yaml now
sends the header from the `fluentea-secrets` secret.

Logic per event:
  1. Skip if we're not within the [start - lead, start + duration] window.
  2. Count confirmed RSVPs for the upcoming/current occurrence.
  3. Compute desired room count: max(1, ceil(rsvp_count / TARGET_PER_ROOM)).
  4. Count existing chatrooms already auto-created for this occurrence
     (matched by activity_config.community_event_id).
  5. Create the difference, all with activity_type=canasta and the right language.

Idempotent — safe to call repeatedly. Uses activity_config.community_event_id
as the dedup key so we don't double-spawn within a single occurrence.

## Headers

- `x-internal-token` string, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

## Changes

> 21 revisions in range; 1 not diffed.

- **2026-09-21** `13996d792e23` — 2 info
  - added the new optional `header` request parameter `x-internal-token`
  - added the non-success response with the status `422`

[Change history](https://skmtc.dev/fluentea/apis/aurqa-language-learning-platform-refactored/changes/events/community-rooms/sync/post.md)

---

[API](https://skmtc.dev/fluentea/apis/aurqa-language-learning-platform-refactored.md) · [All operations](https://skmtc.dev/fluentea/apis/aurqa-language-learning-platform-refactored/llms.txt) · [OpenAPI document](https://skmtc.dev/fluentea/apis/aurqa-language-learning-platform-refactored/revisions/13996d792e23?raw)
