Replace optin

Sets the CALLER's own public-listing preference on the leaderboard.

PUT /v1/leaderboard/optin

Addresshttps://api.hanzo.ai/v1/leaderboard/optin
MethodPUT
Operationput_leaderboard_optin
AuthAuthorization: Bearer $HANZO_API_KEY

Sets the CALLER's own public-listing preference on the leaderboard. Self only: the row written is keyed by the caller's validated ledger identity, so this can never edit another member's visibility whatever the request says. A caller opting in with no handle is given their username, so a listed row never renders as "Anonymous" to its own owner.

Request

2 fields, body application/json (required).

FieldInTypeRequiredDescription
handlebodystring—Handle is the display name shown on a listed row: 1-40 characters of letters, digits, space, dot, underscore, apostrophe or hyphen.
listedbodyboolean—Listed publishes the caller's row to other viewers of the board when true, and anonymizes it when false.

Response

StatusBodyMeaning
200leaderboard.userOptinViewok
defaultproblem-detailsrefused

200 body — 3 fields.

FieldInTypeAlwaysDescription
canSetbodyboolean—CanSet is false when the caller's ledger identity cannot be resolved (no user name on the principal).
handlebodystring—Handle is the display name on the caller's listed row.
listedbodyboolean—Listed is true when the caller's board row is published under Handle to other viewers.

Failure carries the platform error shape — see Errors.

Examples

hanzo leaderboard optin replace
import { Configuration, LeaderboardApi } from 'hanzoai';

const api = new LeaderboardApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.putLeaderboardOptin({ handle: "<handle>", listed: false });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import LeaderboardApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = LeaderboardApi(client).put_leaderboard_optin(handle="<handle>", listed=False)
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.LeaderboardAPI.PutLeaderboardOptin(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, leaderboard_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = leaderboard_api::put_leaderboard_optin(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.LeaderboardApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new LeaderboardApi(client).putLeaderboardOptin();
curl -X PUT https://api.hanzo.ai/v1/leaderboard/optin \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "handle": "<handle>",
       "listed": false
     }'

MCP reaches leaderboard through the leaderboard tool, which names its 5 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_leaderboards"
         }
       }
     }'

Leaderboard API · All Hanzo APIs · Interactive reference

Was this page useful?