---
title: "Toggle commit-leaderboard opt-in"
method: POST
path: "/api/leaderboard/optin"
tags: ["leaderboard"]
---

# Toggle commit-leaderboard opt-in

`POST /api/leaderboard/optin`

## Request

- Base URL: `https://www.immersivecommons.com`
- URL: `https://www.immersivecommons.com/api/leaderboard/optin`
- Auth: HTTP bearer

Clerk session or agt_ token with `leaderboard:manage`. Opting IN requires a linked GitHub identity (409 otherwise). Opting OUT is unconditional.

## Request body

- LeaderboardOptInRequest
  - `optIn` boolean, required

## Response `200`

New opt-in state.

- LeaderboardOptInResponse
  - `ok` boolean, required
  - `optIn` boolean, required
  - `github_username` string
  - `via` 'clerk' | 'agent'

## Other responses

- `400`: Bad body.
- `401`: No auth.
- `403`: Scope/tier not authorized.
- `409`: Opt-in requested but no GitHub link.
- `500`: Clerk update failed.

---

[API](https://skmtc.dev/immersivecommons/apis/immersive-commons-agent-rest-api.md) · [All operations](https://skmtc.dev/immersivecommons/apis/immersive-commons-agent-rest-api/llms.txt) · [OpenAPI document](https://skmtc.dev/immersivecommons/apis/immersive-commons-agent-rest-api/revisions/be67c1f67c27?raw)
