Keys and connecting
Keys at a glance
| Key | What it gives | Where to issue | Lifetime |
|---|---|---|---|
ak_… |
Club data over the API: roster, event entries, passes, attendance (organization keys) | Account → organization → “API keys” | your choice, may not expire |
ek_… |
Read the entries of one event (entries) | Account → event → “Sync” | until revoked |
rk_… |
Publish results of one competition | Account or device-code connection | competition end + 7 days |
ro_… |
Manage the organization’s competitions from a program | Device-code connection with the live.manage right |
one year |
Every key is shown once and the server stores only its hash; revoke any key in the account area.
Source key
A key rk_… allows publishing results of one event (and one race, if the key is limited to it). It is sent in the header Authorization: Bearer rk_…. The server stores only the SHA-256; the key itself is shown once, when issued. By default it expires at the end of the event’s last day plus 7 days; it can be revoked in the account area.
Device-code connection (RFC 8628)
The program does not ask the user to copy keys: it requests a code, the user enters it in the account area (chooses the organization and the event — existing or new — and presses “Allow”), and the program receives the key.
# 1. Запрос кода (программа называет себя сама)curl -s -d 'client_id=my-timing-app&scope=live.source' https://api.ruunso.com/oauth/device_authorization
# 2. Пока пользователь подтверждает код в кабинете, опрашивайте токен не чаще раза в 5 секундcurl -s -d 'grant_type=urn:ietf:params:oauth:grant-type:device_code&device_code=<device_code>' \ https://api.ruunso.com/oauth/tokenThe first response contains user_code, verification_uri_complete, device_code and interval. Show the code to the user and open verification_uri_complete. While the second response is authorization_pending, wait interval seconds (longer after slow_down). After approval the response carries access_token — the key rk_… — and competition_id. The code is valid for 10 minutes; the token is issued exactly once.
Organization token and management
With the live.manage scope the connection issues an organization token ro_… (valid for a year, revocable in the account area). It is needed by ManageService: create and change events, stop and resume ingest, clear data, issue and revoke source keys. Rules, limits and audit are the same as in the account area. Methods are described in manage.proto; errors: token_invalid, token_expired, token_revoked, competition_invalid, not_found, competitions_limit, keys_limit.