Build on StandardSuite
Let people sign in to your Standard Works project with their Standard ID, and read accounts, plans and teams from your server with the StandardSuite API.
Standard ID
Standard ID is the account people already use for StandardSuite. Your project can use it to sign people in. It’s standard OpenID Connect, so most sign-in libraries work out of the box: point them at the discovery document and give them your client ID.
# issuer
# discovery
/.well-known/openid-configuration
sub claim): 32 hex characters, never changing, and the same in every Standard Works project. Use it, not the email address, to recognise someone. Emails change.1. Register your project
An admin registers it in Admin → Standard ID → Register an app, giving:
- Redirect addresses: where people come back to after signing in. They must match exactly. Use
https://.http://localhostis fine while developing, and phone apps can use an app link such asstudio.standardworks.app:/callback. - The kind of app. A project with a server that can keep a secret gets a client secret, shown once. Apps that run only on a device or in a browser get no secret and must use PKCE.
- The scopes it may ask for, and whether it’s a trusted Standard Works app (people aren’t asked “Allow?”).
2. Sign someone in (authorization code flow with PKCE)
Send the person to the authorize endpoint. Always send a random state and check it when they come back. For apps without a secret, PKCE is required; it’s recommended for everyone.
// Node 18+, on your server
import crypto from 'node:crypto';
const ISSUER = '';
const verifier = crypto.randomBytes(32).toString('base64url');
const challenge = crypto.createHash('sha256').update(verifier).digest('base64url');
const state = crypto.randomBytes(16).toString('base64url');
// keep verifier and state in the person's session, then redirect them to:
const url = `${ISSUER}/oauth/authorize?` + new URLSearchParams({
client_id: 'sw_…', redirect_uri: 'https://project.standardworks.studio/callback',
response_type: 'code', scope: 'openid profile email', state,
code_challenge: challenge, code_challenge_method: 'S256',
});
If they aren’t signed in to Standard ID, they sign in first. If your app hasn’t been allowed yet, they see what it’s asking for and choose Allow or Cancel. Then they come back to your redirect address with ?code=…&state=…&iss=…, or ?error=access_denied if they said no.
Swap the code for tokens within two minutes:
const r = await fetch(`${ISSUER}/oauth/token`, {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded',
Authorization: 'Basic ' + Buffer.from(`${CLIENT_ID}:${CLIENT_SECRET}`).toString('base64')},
body: new URLSearchParams({grant_type: 'authorization_code', code, redirect_uri, code_verifier: verifier}),
});
const {access_token, id_token, refresh_token, expires_in} = await r.json();
Check the ID token before trusting it. Your OpenID Connect library does this: the RS256 signature against /oauth/jwks.json, iss, aud (your client ID), exp, and the nonce if you sent one. Or skip the ID token and call /oauth/userinfo with the access token.
Use prompt=none to sign someone in silently: you get error=login_required or consent_required instead of a page. Use prompt=consent to ask again.
3. Tokens
| Token | Lasts | Notes |
|---|---|---|
| Authorization code | 2 minutes | Works once. Using it twice revokes everything it gave. |
| Access token | 1 hour | Send as Authorization: Bearer …. Opaque: don’t parse it. |
| ID token | 1 hour | A signed JWT saying who signed in. Only with the openid scope. |
| Refresh token | 30 days | Only with the offline_access scope. A new one comes with every refresh, so keep the newest. Using an old one again revokes the whole chain. |
body: new URLSearchParams({grant_type: 'refresh_token', refresh_token}) // optional: scope=… to ask for fewer
Tokens stop working when the person disconnects your app on their account page, when their account is suspended, or when an admin turns your app off. Your app gets 401 invalid_token; send them through sign-in again.
4. Scopes and claims
| Scope | Gives |
|---|---|
openid | sub: the Standard ID number. Always needed. |
profile | name |
email | email, email_verified |
plan | plan (free, pro, team) and plan_name; on /api/id/v1/me, also the plan’s limits and the apps the person has through a team |
offline_access | A refresh token |
5. Signing out
Sign the person out of your project yourself. To sign them out of Standard ID too, send them to /oauth/logout?id_token_hint=…&post_logout_redirect_uri=…&state=…. The return address must be one of your registered sign-out (or redirect) addresses; without a valid id_token_hint nobody is signed out. Revoke your refresh token with POST /oauth/revoke as well.
Standard ID endpoints
GET/.well-known/openid-configuration | Discovery |
GET/oauth/authorize | Start sign-in (a page the person visits) |
POST/oauth/token | Code or refresh token → tokens (form-encoded) |
GET/oauth/userinfo | Claims for the access token |
GET/api/id/v1/me | The person as JSON, with plan details (scope plan) |
GET/oauth/jwks.json | Signing keys (they rotate; cache for minutes, not days) |
POST/oauth/revoke | Revoke a token (RFC 7009) |
POST/oauth/introspect | Is a token live? (RFC 7662; apps with a secret) |
GET/oauth/logout | Sign out of Standard ID |
The token, userinfo, revoke, JWKS and /api/id/v1/me endpoints allow cross-origin requests, so single-page apps can call them directly. Never put a client secret in a web page or a phone app.
Server API
For your project’s server to read and manage StandardSuite: look up accounts and teams, read plans, and manage billing. Base address: /api/v1. Everything is JSON. The full description is /api/v1/openapi.json.
Keys and scopes
An admin makes a key in Admin → API keys and picks what it can do. The key is shown once. Send it as Authorization: Bearer mwk_…, and keep it on your server: anyone with it can do what its scopes allow.
| Scope | Allows |
|---|---|
users:read | Look up accounts: name, email, Standard ID number, plan, teams |
teams:read | Teams, their apps, seats and members |
pricing:read | Plans: prices, limits, names and perks; price history |
pricing:write | Change Pro and Team prices |
billing:read | Customers, subscriptions, invoices and revenue |
billing:write | Grant plans, cancel or resume subscriptions, checkout and billing portal links |
Endpoints
| Endpoint | Scope | What |
|---|---|---|
GET/api/v1 | any | This key and its scopes |
GET/api/v1/users?email=&q=&limit=&offset= | users:read | Find accounts |
GET/api/v1/users/{number, email or Standard ID} | users:read | One account. Pass the sub from sign-in to see who it is. |
GET/api/v1/teams, /api/v1/teams/{id} | teams:read | Teams, and one team with its members |
GET/api/v1/plans | pricing:read | Plans with prices, limits and perks |
PUT/api/v1/plans/{plan}/prices/{cycle} | pricing:write | Set a price (send an Idempotency-Key header) |
GET/api/v1/customers, /api/v1/customers/{ref} | billing:read | Customers and their subscriptions |
POST/api/v1/customers/{ref}/grant|cancel|resume|sync|checkout|portal | billing:write | Billing actions |
GET/api/v1/stats | billing:read | Accounts, subscriptions and estimated monthly revenue |
curl -H "Authorization: Bearer $STANDARD_API_KEY" /api/v1/users/0f4c…e91a
Errors and limits
Errors come back as {"error": "what went wrong", "code": "machine_readable"} with a matching status: 401 no or bad key, 403 missing scope, 404 not found, 429 too many requests (300 a minute per key). Standard ID’s OAuth endpoints use OAuth’s own shape: {"error": "invalid_grant", "error_description": "…"}. Everything a key changes is in the admin audit log under its name.
Linking a project into the suite
Apps using Standard ID or the API also agree to the developer terms, and must publish their own privacy policy.
Admins can list your project in every app’s launcher, under Standard Works projects: Admin → Standard ID → Linked projects. Choose who sees it (everyone, signed-in people, or staff while it’s being built) and which Standard ID app it signs in with. People then see an ID badge and know their account works there.