API reference

M2M tokens

Create, list, check, refresh and revoke machine-to-machine tokens for an app.

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#

ScopeAllows
readGET and HEAD calls, and authorization checks (/v1/auth/:app_id/authz/check, check-batch, filter).
writeEvery 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#

POST/v1/apps/:app_id/m2m/tokenApp key
client_namestringrequired
A name for the service that uses the token.
expires_instringrequired
Lifetime: 30d, 90d or 1y.
scopesstring[]
Some of read and write. Also accepted as a space or comma separated string. Default both.
cURLbash
curl -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"] }'
Response 200json
{  "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.

StatusWhen
400No client_name.
404No app with that id.
422expires_in is missing or not one of the values, or scopes has an unknown value.

List tokens#

GET/v1/apps/:app_id/m2m/sessionsApp key
cURLbash
curl https://api.scute.io/v1/apps/$SCUTE_APP_ID/m2m/sessions \  -H "Authorization: Bearer $SCUTE_APP_SECRET"
Response 200json
{  "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#

DELETE/v1/apps/:app_id/m2m/sessions/:session_idApp key

The token stops working at once.

cURLbash
curl -X DELETE https://api.scute.io/v1/apps/$SCUTE_APP_ID/m2m/sessions/$SESSION_ID \  -H "Authorization: Bearer $SCUTE_APP_SECRET"
Response 200json
{ "message": "M2M session revoked successfully", "verified": true }

Returns 404 when the app has no M2M token with that id.

Check a token#

GET/v1/apps/:app_id/m2m/verifyM2M token

Called with the token itself in X-Authorization, no key.

cURLbash
curl https://api.scute.io/v1/apps/$SCUTE_APP_ID/m2m/verify \  -H "X-Authorization: Bearer $SCUTE_M2M_TOKEN"
Response 200json
{  "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#

POST/v1/apps/:app_id/m2m/refreshM2M token

Returns a new access JWT for the token's session. The scm2m_ token stays the same and keeps its expiry.

cURLbash
curl -X POST https://api.scute.io/v1/apps/$SCUTE_APP_ID/m2m/refresh \  -H "X-Authorization: Bearer $SCUTE_M2M_TOKEN"
StatusErrorWhen
401invalid_refresh_tokenThe session's refresh token is invalid or expired.
422no_refresh_tokenThe session has no refresh token.

Revoke the token in use#

DELETE/v1/apps/:app_id/m2m/revokeM2M token
cURLbash
curl -X DELETE https://api.scute.io/v1/apps/$SCUTE_APP_ID/m2m/revoke \  -H "X-Authorization: Bearer $SCUTE_M2M_TOKEN"
Response 200json
{ "message": "Token revoked", "verified": true }