Walk15 Connect V1
Getting started
Integrate Walk15 Connect end to end: credentials, authorization, token exchange and your first data request.
This walkthrough takes you from approval to your first activity request. Examples use TypeScript on Node.js 18+ (built-in fetch and node:crypto) and curl. Every identifier below is synthetic and every secret is a placeholder.
1. Get approved and receive credentials
Contact Walk15 through your existing contact or the contact form. After approval, Walk15 sends you a client ID, a client secret and the issuer origin for your environment. Keep the secret in a secret manager; Walk15 cannot show it again, so ask for a replacement if it is lost or exposed.
For curl examples, set the issuer once:
WALK15_ISSUER=https://api.walk15.ltThe snippets are integration examples. You provide authenticated connect-start and callback routes, durable pending-authorization storage, and encrypted connection storage. Implement the store interfaces using your backend, including the shared per-user lock used by code exchange and refresh.
The TypeScript examples share this configuration type and error class:
export type Walk15Config = {
/** Issuer origin provided by Walk15, for example https://api.walk15.lt */
issuer: string;
/** Client UUID provided by Walk15. */
clientId: string;
/** Backend-only secret. Load it from your secret manager. */
clientSecret: string;
/** Must be byte-for-byte identical to the callback registered with Walk15. */
redirectUri: string;
};
/** Token response returned by POST /oauth/token for both grant types. */
export type Walk15Tokens = {
application_user_id: string;
history_from: string;
connection_version: string;
access_token: string;
token_type: "Bearer";
expires_in: number;
refresh_token: string;
scope: string;
};
export class Walk15Error extends Error {
constructor(
readonly status: number,
readonly code: string,
readonly retryAfterSeconds?: number,
) {
super(`Walk15 Connect request failed: ${status} ${code}`);
}
}2. Configure your callback URL
Walk15 registers exactly one callback for your client. The redirect_uri you send must match it byte for byte, with no trailing-slash, case, encoding or query-string variations.
- HTTPS (recommended): a URL on your backend with a path other than
/, for examplehttps://partner.example/oauth/walk15/callback. Verified Android App Links and iOS Universal Links use this form too. - Native app scheme: a lowercase reverse-domain scheme with a path, for example
com.partner.app:/oauth/callback. Your app forwards thecodeandstateto your backend, which exchanges the code; the client secret never ships in the app. Any installed app can claim a custom scheme, so prefer HTTPS where you can.
A callback may not contain a fragment, wildcard, credentials, whitespace or backslash. Plain-HTTP callbacks are rejected; an HTTPS callback on localhost is accepted.
3. Create state and a PKCE pair
When a signed-in user clicks "Connect Walk15" in your product, your backend creates a one-time state and a PKCE code_verifier, stores both server-side against that user's session with a short expiry (Walk15's authorization request itself expires after 10 minutes), and derives the S256 code_challenge.
import { createHash, randomBytes } from "node:crypto";
/** One-time, unguessable value bound to the user's session (Walk15 requires 22–2048 visible ASCII characters). */
export const createState = (): string => randomBytes(32).toString("base64url");
/** RFC 7636 S256: the verifier stays on your backend; only the challenge goes to Walk15. */
export const createPkcePair = (): { verifier: string; challenge: string } => {
const verifier = randomBytes(32).toString("base64url"); // 43 characters
const challenge = createHash("sha256").update(verifier).digest("base64url");
return { verifier, challenge };
};4. Redirect the user to Walk15
In your authenticated connect-start route:
- Create a fresh
stateand PKCE pair for the signed-in user. - Before redirecting, persist
{ userId, codeVerifier, expiresAt }under thatstate, bound to the initiating session. Use a short expiry within the 10-minute authorization window. - Build the authorization URL with the challenge and only the scopes your product needs, then send the browser there with an HTTP 303 redirect.
Under the shared per-user lock, your callback must atomically retrieve and delete the pending attempt, verify its expiry and that it belongs to the same signed-in user, then exchange the code. The interfaces below describe those storage operations.
import { exchangeCode } from "./token-client";
import type { StoredConnection } from "./token-manager";
import type { Walk15Config } from "./walk15-config";
export const buildAuthorizationUrl = (
config: Walk15Config,
scopes: readonly string[],
state: string,
codeChallenge: string,
): string => {
const url = new URL("/oauth/authorize", config.issuer);
url.search = new URLSearchParams({
client_id: config.clientId,
redirect_uri: config.redirectUri,
response_type: "code",
scope: scopes.join(" "),
state,
code_challenge: codeChallenge,
code_challenge_method: "S256",
}).toString();
return url.toString();
};
export type PendingAuthorization = { userId: string; codeVerifier: string; expiresAt: number };
export interface AuthorizationStore {
/** Atomically return AND delete the pending attempt for this state, so it can be used once. */
takePending(state: string): Promise<PendingAuthorization | undefined>;
/**
* The same exclusive per-user lock that ConnectionStore.withConnectionLock uses, shared by all
* instances. It must work before the first connection exists. Use a session advisory lock on
* a dedicated connection, released in finally, without wrapping fn in a transaction.
*/
withUserLock<T>(applicationUserId: string, fn: () => Promise<T>): Promise<T>;
/** Commit inside that lock, encrypted at rest and keyed by your own application user ID. */
saveConnection(connection: StoredConnection): Promise<void>;
}
/** Handle GET /oauth/walk15/callback for the signed-in user `currentUserId`. */
export const handleWalk15Callback = async (
config: Walk15Config,
store: AuthorizationStore,
currentUserId: string,
query: URLSearchParams,
): Promise<"connected" | "denied"> => {
return store.withUserLock(currentUserId, async () => {
const pending = await store.takePending(query.get("state") ?? "");
if (!pending || pending.userId !== currentUserId || pending.expiresAt < Date.now()) {
throw new Error("Unknown, expired or foreign authorization state");
}
if (query.get("error") === "access_denied") return "denied";
const code = query.get("code");
if (!code) throw new Error("Missing authorization code");
const tokens = await exchangeCode(config, code, pending.codeVerifier, pending.userId);
if (tokens.application_user_id !== pending.userId) throw new Error("Unexpected user reference");
await store.saveConnection({
...tokens,
accessExpiresAt: Date.now() + tokens.expires_in * 1000,
needsReauthorization: false,
});
return "connected";
});
};Walk15 configures the hosted sign-in methods; your integration needs no provider-specific setup. Open the authorization flow in a normal browser tab. Do not use an iframe or a webview that blocks cookies. No app installation is required. Every sign-in method leads to browser consent and uses the same authorization URL, callback and code exchange. Walk15 then redirects to your callback with code and your unchanged state, or with error=access_denied and state if the user cancelled. The handler above consumes the state and checks it belongs to the same signed-in user before exchanging the code. Invalid requests never reach your callback; the user sees a Walk15 error page instead.
5. Exchange the code
The code is single-use and expires after at most 5 minutes. Exchange it server-to-server with HTTP Basic client authentication, the stored code_verifier and the application_user_id of the user who started the flow.
application_user_id is your own stable, opaque ID for that user: 1–128 letters, digits, ., _ or -, scoped to your client. Do not use email addresses or other personal data. Walk15 echoes it in token responses and webhooks; it never authenticates anyone. Each application user can have one active Walk15 connection. To link a different Walk15 account, or to move this Walk15 account to another application user, disconnect first.
import { Walk15Error, type Walk15Config, type Walk15Tokens } from "./walk15-config";
/** HTTP Basic: form-urlencode the client ID and secret (encodeURIComponent suffices for Walk15's URL-safe values), join with ":", base64-encode. */
export const basicAuthorization = (config: Walk15Config): string =>
"Basic " +
Buffer.from(`${encodeURIComponent(config.clientId)}:${encodeURIComponent(config.clientSecret)}`).toString("base64");
const post = async (config: Walk15Config, path: string, fields: Record<string, string>): Promise<Response> =>
fetch(new URL(path, config.issuer), {
method: "POST",
headers: {
Authorization: basicAuthorization(config),
"Content-Type": "application/x-www-form-urlencoded",
},
body: new URLSearchParams(fields).toString(),
redirect: "error",
signal: AbortSignal.timeout(10_000),
});
const tokenRequest = async (config: Walk15Config, fields: Record<string, string>): Promise<Walk15Tokens> => {
const response = await post(config, "/oauth/token", fields);
const body = await response.json().catch(() => ({}));
if (!response.ok) throw new Walk15Error(response.status, body.error ?? "unknown_error");
return body as Walk15Tokens;
};
export const exchangeCode = (config: Walk15Config, code: string, codeVerifier: string, applicationUserId: string) =>
tokenRequest(config, {
grant_type: "authorization_code",
code,
redirect_uri: config.redirectUri,
code_verifier: codeVerifier,
application_user_id: applicationUserId,
});
export const refreshTokens = (config: Walk15Config, refreshToken: string) =>
tokenRequest(config, { grant_type: "refresh_token", refresh_token: refreshToken });
/** Revokes one access token or a whole refresh-token family. Always 200, even for unknown tokens. */
export const revokeToken = async (
config: Walk15Config,
token: string,
hint: "access_token" | "refresh_token",
): Promise<void> => {
const response = await post(config, "/oauth/revoke", { token, token_type_hint: hint });
if (!response.ok) throw new Walk15Error(response.status, "revoke_failed");
};
/** Disconnects the connection identified by a live access token. Refresh before calling if expired. */
export const disconnectConnection = async (config: Walk15Config, accessToken: string): Promise<void> => {
const response = await fetch(new URL("/connect-walk15/v1/connection", config.issuer), {
method: "DELETE",
headers: { Authorization: "Bearer " + accessToken },
redirect: "error",
signal: AbortSignal.timeout(10_000),
});
if (response.status !== 204) throw new Walk15Error(response.status, "disconnect_failed");
};A successful response (curl version in the API reference):
{
"application_user_id": "partner-user-123",
"history_from": "2026-10-10",
"connection_version": "1",
"access_token": "w15a_<access-token>",
"token_type": "Bearer",
"expires_in": 300,
"refresh_token": "w15r2_<refresh-token>",
"scope": "daily_steps:read cycling_activities:read"
}6. Store the credentials securely
Persist, encrypted at rest and keyed to your user:
| Field | Why you need it |
|---|---|
application_user_id | Your user ID, echoed back. Key stored tokens and incoming webhooks by it. |
access_token + expiry | Bearer credential, valid for at most five minutes (expires_in). |
refresh_token | Single-use. Every refresh returns a new one that replaces it atomically. |
history_from | The user's authorization day. You can request dates from the later of history_from and 30 days before today in UTC. |
connection_version | Increases with every new authorization; used to ignore stale webhooks (details). |
scope | Space-separated scopes the user approved. |
Serialize refreshes per connection across all your instances. See Refresh-token rotation.
A successful code exchange binds your stable application_user_id to the signed-in Walk15 account. Keep your existing stored tokens until a replacement exchange succeeds. See Account collisions.
7. Fetch authorized activity
Use summary for a day-by-day view and activities for paginated rides. The access token identifies the connection. Both dates are inclusive. Request at most 31 calendar dates. The start date must be on or after your token response's history_from and no more than 30 days before today in UTC; the end date may not be later than tomorrow in UTC. Step reads also respect the user's Walk15 registration-day floor. See Calendar dates.
Before running the command, set FROM_DATE and TO_DATE to dates in that eligible window, in YYYY-MM-DD form. For a first request, use the same eligible date for both.
curl "$WALK15_ISSUER/connect-walk15/v1/summary?from=$FROM_DATE&to=$TO_DATE" \
-H "Authorization: Bearer $WALK15_ACCESS_TOKEN"Illustrative response; the dates below are examples, not the dates to use for your connection:
{
"start_date": "2026-10-13",
"end_date": "2026-10-19",
"days": [
{ "date": "2026-10-13", "steps": 7200, "walking_activity_minutes": 72, "cycling_activities": [] },
{ "date": "2026-10-14", "steps": 8430, "walking_activity_minutes": 84, "cycling_activities": [
{ "id": "ca_AHOVcjqx4_GNUbipw3-FMTahov29ELSZgnu18DKRYfm", "started_at": "2026-10-14T07:15:00.000000Z", "ended_at": "2026-10-14T07:45:00.000000Z", "distance_km": 12.4, "cycling_activity_minutes": 30 }
] },
{ "date": "2026-10-15", "steps": 6100, "walking_activity_minutes": 61, "cycling_activities": [] },
{ "date": "2026-10-16", "steps": 9750, "walking_activity_minutes": 98, "cycling_activities": [
{ "id": "ca_NUbipw3-FMTahov29ELSZgnu18DKRYfmt07CJQXelsz", "started_at": "2026-10-16T17:00:00.000000Z", "ended_at": "2026-10-16T17:42:00.000000Z", "distance_km": 18.6, "cycling_activity_minutes": 42 },
{ "id": "ca_ahov29ELSZgnu18DKRYfmt07CJQXelsz6BIPWdkry5A", "started_at": "2026-10-16T18:10:00.000000Z", "ended_at": "2026-10-16T18:34:00.000000Z", "distance_km": 9.2, "cycling_activity_minutes": 24 }
] },
{ "date": "2026-10-17", "steps": 0, "walking_activity_minutes": 0, "cycling_activities": [] },
{ "date": "2026-10-18", "steps": 11200, "walking_activity_minutes": 112, "cycling_activities": [
{ "id": "ca_nu18DKRYfmt07CJQXelsz6BIPWdkry5AHOVcjqx4_GN", "started_at": "2026-10-18T08:00:00.000000Z", "ended_at": "2026-10-18T08:55:00.000000Z", "distance_km": 21.3, "cycling_activity_minutes": 55 }
] },
{ "date": "2026-10-19", "steps": 7860, "walking_activity_minutes": 79, "cycling_activities": [
{ "id": "ca_07CJQXelsz6BIPWdkry5AHOVcjqx4_GNUbipw3-FMTa", "started_at": "2026-10-19T06:30:00.000000Z", "ended_at": "2026-10-19T07:05:00.000000Z", "distance_km": 13.8, "cycling_activity_minutes": 35 },
{ "id": "ca_BIPWdkry5AHOVcjqx4_GNUbipw3-FMTahov29ELSZgn", "started_at": "2026-10-19T12:00:00.000000Z", "ended_at": "2026-10-19T12:28:00.000000Z", "distance_km": 10.5, "cycling_activity_minutes": 28 },
{ "id": "ca_OVcjqx4_GNUbipw3-FMTahov29ELSZgnu18DKRYfmt0", "started_at": "2026-10-19T18:20:00.000000Z", "ended_at": "2026-10-19T19:02:00.000000Z", "distance_km": 17.4, "cycling_activity_minutes": 42 }
] }
]
}The response includes every eligible date. Only authorized fields appear; a day without data has zero steps/minutes or an empty ride list. Walking minutes are daily steps divided by 100, rounded to the nearest minute. Ride minutes are elapsed time including pauses. Activities provides paginated rides.
A TypeScript client covers both supported activity endpoints.
8. Optionally configure webhooks
Ask Walk15 to configure your HTTPS webhook URL; the signing secret is shared with you once, securely. Then build the receiver described in Webhooks.
9. Handle disconnects and errors
- Your user disconnects in your product: call
DELETE /connect-walk15/v1/connectionwith a live access token and remove the local connection after a204. Refresh first if the access token expired. - The user disconnects in Walk15 or deletes their account: data requests return
401, refresh returnsinvalid_grant, and aconnection.revokedwebhook is sent. - Refresh returns
invalid_grantor its outcome is unknown: do not resend the same refresh token. Ask the user to reconnect Walk15 from your app (refresh failures). - Refresh returns
invalid_client: fix the client credentials before trying again. The refresh token was not consumed, so this error does not require the user to reconnect. 429: waitRetry-Afterseconds and reduce concurrency (Rate limits).
Before going live, run through the integration checklist.