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

  1. 1You get a client_id and a client_secret from Stegen.
  2. 2You send the user's browser to Stegen. They sign in, choose a ladder and approve.
  3. 3Stegen sends the browser back to you with a one-time code.
  4. 4Your server exchanges the code for an access token and a refresh token.
  5. 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 URLhttps://stegen.app
Scoperesults:write (the only one, and optional to send)
LaddersIndividual-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 https and have no #fragment. http://localhost is allowed for development.

You get back a client_id and a client_secret. The secret is shown once and cannot be retrieved later.

Ask the user for access

Redirect the user's browser to the authorization endpoint.

GET/oauth/authorize

https://stegen.app/oauth/authorize
  ?response_type=code
  &client_id=YOUR_CLIENT_ID
  &redirect_uri=https%3A%2F%2Fexample.com%2Fstegen%2Fcallback
  &state=RANDOM_VALUE
ParameterDescription
response_typerequiredAlways code.
client_idrequiredYour client ID.
redirect_urirequiredMust match one of your registered URIs exactly, character for character.
staterecommendedA random value you generate per request. It comes back unchanged. Check it to protect against CSRF.
scopeoptionalresults:write if sent.

The user signs in if needed (or creates an account), chooses one of their ladders and presses Allow or Deny. Stegen then redirects to your redirect_uri:

# Approved
https://example.com/stegen/callback?code=stegen_ac_…&state=RANDOM_VALUE

# Denied
https://example.com/stegen/callback?error=access_denied&state=RANDOM_VALUE

The code is valid for 60 seconds and can be used once. Other possible error values are unsupported_response_type and invalid_scope.

If client_id or redirect_uri is wrong, Stegen answers 400 and does not redirect. This is the first thing to check when the approval page does not appear.

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
}
FieldDescription
valueUnitWhat value means when you register a result: km, steps, pts or seconds.
resultSystemdistanceKm, steps, time, timeReversed, points or pointsReversed. “Reversed” means lower is better.
registeringModeanytime: every result is kept. daily: one result per day, and a new one replaces the earlier one for that day.
acceptsResultsfalse when the ladder is archived or its season is locked.
participantThe 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"}'
FieldDescription
valuerequiredA whole number, 0 or higher, in the ladder's valueUnit. A time of 25:30 is 1530.
playedAtoptionalWhen the result was achieved. ISO 8601 with a timezone (Z or an offset). Must not be in the future. Defaults to now.
notesoptionalFree 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": "…" }

StatusErrorMeaning
401invalid_clientWrong or missing client ID or secret.
400invalid_grantThe code or refresh token is wrong, expired, already used or revoked, or redirect_uri differs.
400invalid_requestA required field is missing, or the body is not form-encoded.
400unsupported_grant_typeOnly authorization_code and refresh_token are supported.

API endpoints

Errors look like this: { "error": "…", "message": "…" }

StatusErrorMeaning
401invalid_tokenThe access token is missing, expired or revoked. Refresh it and retry once.
400invalid_requestThe body is invalid. message names the field.
403not_a_memberThe user has left the ladder's organization.
409ladder_closedThe ladder is archived or has no current season.
409season_lockedThe current season has ended and is locked.
409unsupported_ladderThe 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 anytime ladder, sending the same result twice stores it twice. Only retry when you did not get a response, and prefer daily ladders 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 daily mode, playedAt decides which day a result belongs to.
  • Keep secrets on the server. Never put the client secret or tokens in a browser or mobile app.