API reference

JWKS and token verification

Fetch the workspace's public keys and verify Scute access tokens on your server without a call per request.

Access tokens are JWTs signed with the workspace's RSA key (RS256). Every app in a workspace shares the workspace's keys. The token header names the key in kid.

Get the JWKS#

GET/v1/auth/:app_id/.well-known/jwks.jsonNone

GET /v1/auth/:app_id/jwks returns the same document. :app_id is the app's UUID or app_xxx public ID.

cURLbash
curl https://api.scute.io/v1/auth/$SCUTE_APP_ID/.well-known/jwks.json
Response 200json
{  "keys": [    {      "kty": "RSA",      "kid": "f3b1c2d4e5",      "use": "sig",      "alg": "RS256",      "n": "0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx4cbbfAAtVT86zwu1RK7aPFFxuhDR1L6tSoc_BJECPebWKRXjBZCiFV4n3oknjhMstn64tZ_2W-5JsGY4Hc5n9yBXArwl93lqt7_RN5w6Cf0h4QyQ5v-65YGjQR0_FDW2QvzqY368QQMicAtaSqzs8KJZgnYb9c7d0zgdAZHzu6qMQvRL5hajrn1n91CbOpbISD08qNLyrdkt-bFTWhAI4vMQFh6WeZu0fM4lFd2NcRwr3XPksINHaQ-G_xBniIqbw0Ls1jF44-csFCur-kEgU8awapJzKnqDKgw",      "e": "AQAB"    }  ]}

The first key is the one that signs now. After a signing key rotation, earlier keys stay in the list until no token they signed can still be valid, so sessions do not end at a rotation. Match the token's kid to a key.

Statuserror_codeWhen
404app_not_foundNo app with that ID.
503keys_not_availableThe workspace has no RSA keys yet.

Get the public key as PEM#

GET/v1/auth/:app_id/public_keyNone

Returns the current signing key only.

Response 200json
{  "public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...\n-----END PUBLIC KEY-----\n",  "algorithm": "RS256",  "key_id": "f3b1c2d4e5"}

Prefer the JWKS: it also carries the earlier keys that still verify.

Access token claims#

ClaimDescription
uuidThe app user's ID.
aidThe app's public ID (app_xxx).
widThe workspace's ID.
msp_idPublic ID (msp_xxx) of the MSP the app's workspace belongs to. Only under an MSP.
cridID of the passkey used, on sessions started with a passkey.
uidID of this access token. Changes on every refresh.
ruidID of the session's refresh token.
expExpiry, as a Unix timestamp.

Access tokens carry no iss or aud claim. Check aid against your app's public ID instead.

Verify a token offline#

lib/verify-scute-token.tsts
import { createRemoteJWKSet, jwtVerify } from "jose";const APP_ID = process.env.SCUTE_APP_ID!; // app_xxxconst JWKS = createRemoteJWKSet(  new URL(`https://api.scute.io/v1/auth/${APP_ID}/.well-known/jwks.json`));export async function verifyScuteToken(token: string) {  const { payload } = await jwtVerify(token, JWKS, { algorithms: ["RS256"] });  if (payload.aid !== APP_ID) throw new Error("Token is for another app");  return { userId: payload.uuid as string, workspaceId: payload.wid as string };}

An offline check confirms the signature and expiry. It does not see a session that was revoked or signed out before the token expired. When you need that, call Check an access token, or keep access token lifetimes short.