API reference

Authentication

Every credential the Scute API accepts, the header each goes in, where it is created and which endpoints take it.

Scute reads two headers. Authorization identifies the account calling (an app key or a workspace key). X-Authorization identifies who is acting (a person's access token or an M2M token). Some endpoints need one of them, some need both.

CredentialFormatHeaderCreated in
App keyscapp_...Authorization: BearerDashboard, the app's API keys page
Workspace keyscworks_...Authorization: BearerDashboard, Settings > Keys
M2M tokenscm2m_...X-Authorization: BearerDashboard, the app's M2M clients page, or the API
Access tokenJWTX-Authorization: BearerReturned by a sign-in
Refresh tokenJWTX-Refresh-TokenReturned by a sign-in
Setup tokenstringX-Scute-Setup-TokenReturned by a sign-in that owes a step
Element tokensce_...X-Scute-Element-TokenMinted by your server with the app key
Task tokensct_...Authorization: BearerIssued for an agent's task
Agent keyscak_...Authorization: BearerDashboard, the agent's Keys page

Keys and tokens are shown in full once, when they are created or rotated. Scute stores a hash of each API key; lists show only the first and last characters.

App keys#

An app key is the server credential for one app. It works on that app only: a call naming another app returns 403 API key not authorized for this app.

Create one at control.scute.io on the app's API keys page, or with the API (see App keys). Keep it on your server.

cURLbash
curl https://api.scute.io/v1/$SCUTE_APP_ID/users \  -H "Authorization: Bearer $SCUTE_APP_SECRET"

Rotating a key returns a new key with the same name. The old key keeps working until it is revoked, or until the end you choose with old_key_expires_in: now, 1h, 24h, 7d or 30d. A key past its end is refused as if it did not exist.

Workspace keys#

A workspace key reaches every app in its workspace and in every workspace below it (Master, MSP, client). An integrator holds one Master workspace key instead of a key per client.

Workspace owners and admins create, rename, rotate and revoke workspace keys in the dashboard under Settings > Keys. Rotation works as for app keys.

Endpoints that take an app key also take a workspace key above the app. Some workspace endpoints take only a workspace key and return 401 workspace_api_key_required for an app key.

M2M tokens#

An M2M token identifies a server or service instead of a person. It goes in X-Authorization and is used in two ways:

  • With a key. On endpoints that need both headers, the key goes in Authorization and the M2M token in X-Authorization.
  • On its own. The token's own calls (verify, refresh, revoke) take only the token.

A token reaches its app, the other apps in that app's workspace, and every app in the workspaces below it. A call naming an app outside that range returns 403 app_not_in_scope.

Each token has scopes:

ScopeAllows
readGET and HEAD calls, and authorization checks (/v1/auth/:app_id/authz/check, check-batch, filter)
writeEvery other call

A call the token's scopes do not cover returns 403 insufficient_scope, with details.required_scope. Create tokens in the dashboard on the app's M2M clients page or with POST /v1/apps/:app_id/m2m/token. Lifetimes are 30d, 90d or 1y; an expired token returns 401.

cURLbash
curl https://api.scute.io/v1/apps/$SCUTE_APP_ID/webhooks \  -H "Authorization: Bearer $SCUTE_APP_SECRET" \  -H "X-Authorization: Bearer $SCUTE_M2M_TOKEN"

Access and refresh tokens#

A sign-in returns an access token and a refresh token, both JWTs signed with the workspace's RSA key (RS256). The access token goes in X-Authorization on the signed-in person's own calls (profile, sessions, MFA). The refresh token goes in X-Refresh-Token on POST /v1/auth/:app_id/tokens/refresh.

Your server can check an access token offline with the app's JWKS. See JWKS.

A sign-in that is not finished (a second factor or a contact still to add) returns a setup token instead of a session. It goes in X-Scute-Setup-Token. See Sign-in steps.

Element, task and agent credentials#

  • Element tokens let a browser page call a limited admin API without the app key. Your server mints one with the app key. See Element tokens.
  • Task tokens are what an agent sends while it runs a task, on /v1/auth/:app_id/agent/*. See Task tokens.
  • Agent keys connect a voice or chat platform to Scute's MCP server at /v1/mcp/auth/:app_id. See Voice and chat.

Which endpoints take which credential#

EndpointsCredential
Starting a sign-in, the JWKS, password resetNone
The signed-in person's own data under /v1/auth/:app_idAccess token
Users, user sessions, MFA admin, M2M token create and listApp key or workspace key
Webhooks, events, app keys, user fieldsKey and an M2M token in X-Authorization
Authorization checks under /v1/auth/:app_id/authzApp key or M2M token
Workspace provisioning and challenges for integratorsWorkspace key and an M2M token

Authentication errors#

StatusBodyWhen
401{"error": "Not authorized"}The key or token is missing, unknown, expired or revoked. The body does not say which.
401error_code authentication_requiredThe endpoint needs X-Authorization and none was sent.
403API key not authorized for this appThe key does not own the app in the path.
403error_code app_not_in_scopeThe M2M token's app does not reach the app in the path.
403error_code insufficient_scopeThe M2M token lacks the scope the call needs.
403error_code workspace_access_deniedThe key or token does not reach the workspace in the path.
404error_code app_not_foundNo app with the ID in the path.

See Errors for the full error shape.