Developer guide
Stegen Results API
Register results in Stegen on behalf of a user. The user grants access with OAuth 2.0 and picks one ladder. Your token can then register that user's own results in that ladder, and nothing else.
Overview
- 1You get a
client_idand aclient_secretfrom Stegen. - 2You send the user's browser to Stegen. They sign in, choose a ladder and approve.
- 3Stegen sends the browser back to you with a one-time
code. - 4Your server exchanges the code for an access token and a refresh token.
- 5Your server registers results with the access token.
This is the standard authorization code flow for server-side (confidential) clients. The client secret must stay on your server, so the flow is not suited to apps without a backend.
| Base URL | https://stegen.app |
| Scope | results:write (the only one, and optional to send) |
| Ladders | Individual-result ladders only: distance, steps, time and points |
Get credentials
We register your service by hand. Email hi@stegen.app with:
- A name. Users see it on the approval page: “Your name wants to register results for you”.
- One or more redirect URIs. They must use
httpsand have no#fragment.http://localhostis allowed for development.
You get back a client_id and a client_secret. The secret is shown once and cannot be retrieved later.
Exchange the code
Call the token endpoint from your server. Authenticate with HTTP Basic using your client ID and secret.
POST/api/oauth/token
curl https://stegen.app/api/oauth/token \
-u "$CLIENT_ID:$CLIENT_SECRET" \
-d grant_type=authorization_code \
-d code="$CODE" \
--data-urlencode redirect_uri="https://example.com/stegen/callback"The body is application/x-www-form-urlencoded. redirect_uri must be the same one you used in the previous step. Instead of Basic auth you may send client_id and client_secret as form fields.
{
"access_token": "stegen_at_…",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "stegen_rt_…",
"scope": "results:write"
}Store both tokens on your server, linked to your user. Each token pair belongs to one Stegen user and one ladder.
Refresh the token
Access tokens last one hour. Get a new one with the refresh token.
curl https://stegen.app/api/oauth/token \
-u "$CLIENT_ID:$CLIENT_SECRET" \
-d grant_type=refresh_token \
-d refresh_token="$REFRESH_TOKEN"The response has the same shape as above. The refresh token is returned unchanged; keep using it. It stays valid until one of these happens:
- The user removes your service under Account → Security → Connected Apps in Stegen.
- The user approves the same ladder for your service again. That issues a new token pair and the old one stops working.
- The ladder is deleted.
When that happens the token endpoint answers 400 invalid_grant. Send the user through the approval step again.
Read the ladder
All API requests carry the access token: Authorization: Bearer stegen_at_…
GET/api/v1/ladder
Describes the ladder the user chose. Call it after the token exchange to learn which unit to send values in.
curl https://stegen.app/api/v1/ladder \
-H "Authorization: Bearer $ACCESS_TOKEN"{
"id": "x8k2…",
"name": "Step challenge",
"tenant": { "id": "p41c…", "name": "Acme" },
"participant": { "id": "m7dq…", "name": "Alice" },
"resultSystem": "steps",
"valueUnit": "steps",
"registeringMode": "daily",
"acceptsResults": true
}| Field | Description |
|---|---|
valueUnit | What value means when you register a result: km, steps, pts or seconds. |
resultSystem | distanceKm, steps, time, timeReversed, points or pointsReversed. “Reversed” means lower is better. |
registeringMode | anytime: every result is kept. daily: one result per day, and a new one replaces the earlier one for that day. |
acceptsResults | false when the ladder is archived or its season is locked. |
participant | The user as they appear in the ladder. null if they have left the organization. |
Register a result
POST/api/v1/results
curl https://stegen.app/api/v1/results \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"value": 8000, "playedAt": "2026-03-01T18:30:00+01:00", "notes": "Evening walk"}'| Field | Description |
|---|---|
valuerequired | A whole number, 0 or higher, in the ladder's valueUnit. A time of 25:30 is 1530. |
playedAtoptional | When the result was achieved. ISO 8601 with a timezone (Z or an offset). Must not be in the future. Defaults to now. |
notesoptional | Free text, up to 1000 characters. Shown with the result in Stegen. |
A successful request answers 201:
{
"id": "k6ll4um6…",
"ladderId": "x8k2…",
"value": 8000,
"playedAt": "2026-03-01T17:30:00.000Z"
}The result appears in the ladder's standings right away, and the ladder's Slack or Teams channel is notified if one is connected.
Errors
Token endpoint
Errors follow RFC 6749: { "error": "…", "error_description": "…" }
| Status | Error | Meaning |
|---|---|---|
| 401 | invalid_client | Wrong or missing client ID or secret. |
| 400 | invalid_grant | The code or refresh token is wrong, expired, already used or revoked, or redirect_uri differs. |
| 400 | invalid_request | A required field is missing, or the body is not form-encoded. |
| 400 | unsupported_grant_type | Only authorization_code and refresh_token are supported. |
API endpoints
Errors look like this: { "error": "…", "message": "…" }
| Status | Error | Meaning |
|---|---|---|
| 401 | invalid_token | The access token is missing, expired or revoked. Refresh it and retry once. |
| 400 | invalid_request | The body is invalid. message names the field. |
| 403 | not_a_member | The user has left the ladder's organization. |
| 409 | ladder_closed | The ladder is archived or has no current season. |
| 409 | season_locked | The current season has ended and is locked. |
| 409 | unsupported_ladder | The ladder no longer takes individual results. |
Good to know
- Values are whole numbers. Decimals are rejected. Round before sending.
- Retries can create duplicates. In an
anytimeladder, sending the same result twice stores it twice. Only retry when you did not get a response, and preferdailyladders for totals you send repeatedly, such as a running step count. - One token, one ladder. To register in a second ladder, send the user through the approval step again and keep both token pairs.
- Days follow the organization's timezone. In
dailymode,playedAtdecides which day a result belongs to. - Keep secrets on the server. Never put the client secret or tokens in a browser or mobile app.