An M2M token (scm2m_...) identifies a server or service, not a person. It is sent as X-Authorization: Bearer scm2m_..., either alongside an app or workspace key (where a route asks for both) or on its own for the token's own calls below. See Authentication.
A token reaches its app, the other apps in the app's workspace, and every app in the workspaces below it.
Scopes#
| Scope | Allows |
|---|---|
| read | GET and HEAD calls, and authorization checks (/v1/auth/:app_id/authz/check, check-batch, filter). |
| write | Every other call. |
A token created without scopes gets both. A call the token's scopes do not cover fails with 403 insufficient_scope; details.required_scope names the scope it needs. The token's own calls (verify, refresh, revoke) need no scope.
Create a token#
/v1/apps/:app_id/m2m/tokenApp keycurl -X POST https://api.scute.io/v1/apps/$SCUTE_APP_ID/m2m/token \ -H "Authorization: Bearer $SCUTE_APP_SECRET" \ -H "Content-Type: application/json" \ -d '{ "client_name": "billing-worker", "expires_in": "90d", "scopes": ["read"] }'{ "short_token": "scm2m_Qm9vX3R6Yk1hV2RQc2Z4a0t0a1pV", "client_name": "billing-worker", "scopes": ["read"], "expires_at": "2027-02-17T10:00:00Z", "access": "eyJhbGciOiJSUzI1NiIs...", "access_expires_at": "2027-02-17T10:00:00Z", "refresh": "eyJhbGciOiJSUzI1NiIs...", "refresh_expires_at": "2027-02-17T10:00:00Z", "csrf": "kZ3e...", "key_id": "c1b2..."}short_token is the token to send. It is returned only here; lists show a masked preview. refresh and refresh_expires_at are left out when the app's refresh_payload setting is off.
| Status | When |
|---|---|
| 400 | No client_name. |
| 404 | No app with that id. |
| 422 | expires_in is missing or not one of the values, or scopes has an unknown value. |
List tokens#
/v1/apps/:app_id/m2m/sessionsApp keycurl https://api.scute.io/v1/apps/$SCUTE_APP_ID/m2m/sessions \ -H "Authorization: Bearer $SCUTE_APP_SECRET"{ "sessions": [ { "id": "0193fc00-aaaa-7bbb-8ccc-000000000001", "type": "m2m", "client_name": "billing-worker", "short_token_preview": "scm2m_Qm9v••••a1pV", "scopes": ["read"], "expires_at": "2027-02-17T10:00:00Z", "last_used_at": "2026-11-19T09:58:00Z", "created_at": "2026-11-19T09:00:00Z", "status": true } ], "live_count": 1}The example shows a subset of the fields. live_count is the number of tokens that still work.
Revoke a token by id#
/v1/apps/:app_id/m2m/sessions/:session_idApp keyThe token stops working at once.
curl -X DELETE https://api.scute.io/v1/apps/$SCUTE_APP_ID/m2m/sessions/$SESSION_ID \ -H "Authorization: Bearer $SCUTE_APP_SECRET"{ "message": "M2M session revoked successfully", "verified": true }Returns 404 when the app has no M2M token with that id.
Check a token#
/v1/apps/:app_id/m2m/verifyM2M tokenCalled with the token itself in X-Authorization, no key.
curl https://api.scute.io/v1/apps/$SCUTE_APP_ID/m2m/verify \ -H "X-Authorization: Bearer $SCUTE_M2M_TOKEN"{ "message": "verified", "verified": true, "client_name": "billing-worker", "session_id": "0193fc00-aaaa-7bbb-8ccc-000000000001"}An unknown, revoked or expired token returns 401.
Refresh a token#
/v1/apps/:app_id/m2m/refreshM2M tokenReturns a new access JWT for the token's session. The scm2m_ token stays the same and keeps its expiry.
curl -X POST https://api.scute.io/v1/apps/$SCUTE_APP_ID/m2m/refresh \ -H "X-Authorization: Bearer $SCUTE_M2M_TOKEN"| Status | Error | When |
|---|---|---|
| 401 | invalid_refresh_token | The session's refresh token is invalid or expired. |
| 422 | no_refresh_token | The session has no refresh token. |
Revoke the token in use#
/v1/apps/:app_id/m2m/revokeM2M tokencurl -X DELETE https://api.scute.io/v1/apps/$SCUTE_APP_ID/m2m/revoke \ -H "X-Authorization: Bearer $SCUTE_M2M_TOKEN"{ "message": "Token revoked", "verified": true }