---
title: "Toggle the caller's own leaderboard opt-in"
method: POST
path: "/api/user-settings"
tags: ["leaderboard", "browser-session"]
---

# Toggle the caller's own leaderboard opt-in

`POST /api/user-settings`

## Request

- Base URL: `https://www.immersivecommons.com`
- URL: `https://www.immersivecommons.com/api/user-settings`
- Auth: API key in cookie `__session`

Clerk-session only (NOT reachable with an agt_ bearer). There is no admin check because each member owns their own metadata — the caller can only ever write their own. The write MERGES into existing publicMetadata rather than replacing it. Agents set the same flag through POST /api/leaderboard/optin.

## Request body

- UserSettingsRequest
  - `leaderboardOptIn` boolean, required: Must be a real boolean — a string 'true' is a 400.

## Response `200`

The stored setting.

- UserSettingsResponse
  - `ok` boolean, required
  - `leaderboardOptIn` boolean, required: The value now stored on the caller's publicMetadata.

## Other responses

- `400`: Invalid JSON, or leaderboardOptIn was not a boolean.
- `401`: Not signed in.
- `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)
