A session has an access token and a refresh token, both JWTs signed with the workspace's RSA key. The access token goes in X-Authorization on calls; the refresh token is swapped for a new access token before the access token expires. See Token set for the fields and default lifetimes.
Session rules#
- Idle timeout. A session not used (no call with its access token) and not refreshed for longer than the app's session timeout (604800 seconds by default) ends at its next refresh, which returns 401 session_idle.
- Overlapping refreshes. After a refresh, the previous access token keeps working for 60 seconds, so requests already in flight do not fail.
- IP rules. Every refresh is checked against the workspace's IP rules. On a refresh from your server, pass the person's address in X-Scute-Client-IP. A refused refresh keeps the session; it refreshes again from an allowed address.
- Bans and suspensions. A refresh for a person who was banned, suspended or deactivated ends the session and returns 401 with user_banned, user_suspended or account_deactivated.
- Support sessions. A session opened as a person from the dashboard (impersonation) is never refreshed.
Refresh the access token#
/v1/auth/:app_id/tokens/refreshRefresh tokencurl -X POST https://api.scute.io/v1/auth/$SCUTE_APP_ID/tokens/refresh \ -H "X-Refresh-Token: $REFRESH_TOKEN"{ "csrf": "kZQ3x0Qb7V1o2y8wL4mN9pR6sT0uV3wX5yZ7aB9cD1eF", "access": "eyJhbGciOiJSUzI1NiIsImtpZCI6Ii4uLiJ9...", "access_expires_at": "2026-11-19T16:04:05.000+00:00"}The refresh token stays the same. When the refresh token is sent in the sc-refresh-token cookie instead of the header, X-CSRF-Token must carry the session's csrf.
| Status | error_code | When |
|---|---|---|
| 401 | session_revoked | The session was revoked, or its person deleted. Sign in again. |
| 401 | session_idle | The session was idle longer than the app's session timeout. Sign in again. |
| 401 | Invalid or expired refresh token. | |
| 403 | ip_blocked, country_blocked | The workspace's IP rules refuse the address. |
Check an access token#
/v1/auth/:app_id/tokens/access/verifyAccess tokenChecks that the access token is valid and its session is live.
curl -X POST https://api.scute.io/v1/auth/$SCUTE_APP_ID/tokens/access/verify \ -H "X-Authorization: Bearer $ACCESS_TOKEN"{ "message": "verified", "verified": true }An invalid, expired or revoked token returns 401. To check tokens without a call per request, verify them offline with the JWKS.
Check a refresh token#
/v1/auth/:app_id/tokens/refresh/verifyRefresh tokencurl -X POST https://api.scute.io/v1/auth/$SCUTE_APP_ID/tokens/refresh/verify \ -H "X-Refresh-Token: $REFRESH_TOKEN"{ "message": "verified", "verified": true }An invalid or expired token returns 401.
Server-side rotation#
These two routes are for a server that keeps the tokens in HTTP-only cookies and refreshes them for the browser. They need the app key in Authorization. The key must belong to the app in the URL, or be a workspace key of a workspace above it; another key returns 403 api_key_not_authorized.
Rotate with the access token#
/v1/auth/:app_id/tokens/rotate_accessApp keyTakes the current access token and returns a new access token plus the session's refresh token.
curl -X POST https://api.scute.io/v1/auth/$SCUTE_APP_ID/tokens/rotate_access \ -H "Authorization: Bearer $SCUTE_APP_SECRET" \ -H "X-Authorization: Bearer $ACCESS_TOKEN" \ -H "X-Scute-Client-IP: 203.0.113.24"{ "csrf": "kZQ3x0Qb7V1o2y8wL4mN9pR6sT0uV3wX5yZ7aB9cD1eF", "access": "eyJhbGciOiJSUzI1NiIsImtpZCI6Ii4uLiJ9...", "access_expires_at": "2026-11-19T16:04:05.000+00:00", "refresh": "eyJhbGciOiJSUzI1NiIsImtpZCI6Ii4uLiJ9..."}| Status | error_code | When |
|---|---|---|
| 401 | Invalid app key, or invalid access token or session. | |
| 401 | session_idle | The session was idle longer than the app's session timeout. |
| 403 | api_key_not_authorized | The key does not own the app. |
| 404 | app_not_found | No app with that ID. |
Rotate with the refresh token#
/v1/auth/:app_id/tokens/force_refreshApp keyTakes the refresh token and returns a new access token. The refresh token is not returned.
curl -X POST https://api.scute.io/v1/auth/$SCUTE_APP_ID/tokens/force_refresh \ -H "Authorization: Bearer $SCUTE_APP_SECRET" \ -H "X-Refresh-Token: $REFRESH_TOKEN" \ -H "X-Scute-Client-IP: 203.0.113.24"{ "csrf": "kZQ3x0Qb7V1o2y8wL4mN9pR6sT0uV3wX5yZ7aB9cD1eF", "access": "eyJhbGciOiJSUzI1NiIsImtpZCI6Ii4uLiJ9...", "access_expires_at": "2026-11-19T16:04:05.000+00:00"}| Status | error_code | When |
|---|---|---|
| 401 | session_revoked | The session was revoked, or its person deleted. |
| 401 | session_idle | The session was idle longer than the app's session timeout. |
| 403 | api_key_not_authorized | The key does not own the app. |
Sign out#
To end the current session, call Sign out. To end another of the person's sessions, see Sessions and devices.