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

# Scheduled Jobs

> The cron calls your site needs when you run a manual installation outside the default scheduler.

<Info>
  If you use Supabase mode, `npm run db:push` already sets up `pg_cron` with this same sync schedule.
</Info>

## What your scheduler should call

* Method: `GET`
* Header: `Authorization: Bearer <CRON_SECRET>`
* Base URL: `SITE_URL`
* Endpoints:
  * `/api/sync/events`
  * `/api/sync/event-creations/enqueue`
  * `/api/sync/event-creations`
  * `/api/sync/translations/enqueue`
  * `/api/sync/translations`
  * `/api/sync/resolution`
  * `/api/sync/sports-scores`
  * `/api/sync/volume/enqueue`
  * `/api/sync/volume`

Example:

```bash theme={null}
curl -sS -X GET \
  -H "Authorization: Bearer ${CRON_SECRET}" \
  "${SITE_URL}/api/sync/events"
```

## Recommended cron schedule

| Endpoint                            | Cron schedule                 | Notes                                                        |
| ----------------------------------- | ----------------------------- | ------------------------------------------------------------ |
| `/api/sync/events`                  | `2,11,20,29,38,47,56 * * * *` | Seven times per hour, spaced to reduce overlap               |
| `/api/sync/event-creations/enqueue` | `0,30 * * * *`                | Enqueues scheduled event creations twice per hour            |
| `/api/sync/event-creations`         | `1,31 * * * *`                | Processes event creation jobs after enqueue runs             |
| `/api/sync/translations/enqueue`    | `17 * * * *`                  | Enqueues translation jobs hourly                             |
| `/api/sync/translations`            | `18 * * * *`                  | Processes translation jobs after enqueue runs                |
| `/api/sync/resolution`              | `5-55/10 * * * *`             | Every 10 minutes, offset by 5 minutes                        |
| `/api/sync/sports-scores`           | `* * * * *`                   | Updates live and recently started sports scores every minute |
| `/api/sync/volume/enqueue`          | `*/10 * * * *`                | Enqueues volume sync work every 10 minutes                   |
| `/api/sync/volume`                  | `*/5 * * * *`                 | Processes volume jobs every 5 minutes                        |

Use UTC unless your team needs a strict local timezone.

Supabase mode also creates `clean-cron-details` at `0 0 * * *` and `clean-jobs` at `15 * * * *` as database maintenance jobs. External schedulers should only call the HTTP sync endpoints above.

## Expected responses

* `200`: accepted or completed
* `401`: missing or invalid `CRON_SECRET`
* `409`: sync already running, which can happen on locked routes
* `500`: runtime failure that should be investigated in logs

<Warning>
  Do not run duplicate schedulers at the same time. Use either `pg_cron` or your external cron jobs.
</Warning>
