Mandraki Mandraki
Get started

Scopes and Permissions

Complete reference of all API token scopes, resource scopes, and admin restrictions in the Mandraki Bot API.

Overview

Every API token carries a set of scopes that determine which operations it can perform. Endpoints check scopes before processing requests — a token without the required scope receives a 403 Forbidden response with the missing scopes listed.

Scope Reference

Chat and Channels

ScopeDescriptionUsed By
channels:readList channels, view metadataGET /bot/channels
channels:historyRead message history (non-E2EE channels only)GET /bot/channels/:channelId/messages
channels:writeCreate channelsChannel creation endpoints
channels:manageArchive channels, add/remove membersChannel management endpoints
messages:writePost messages as the botPOST /bot/channels/:channelId/messages
reactions:writeAdd and remove reactions on messagesReaction endpoints

Users

ScopeDescriptionUsed By
users:readView user profiles (name, avatar, role)GET /bot/users
users:read:emailInclude email addresses in user dataGET /bot/users (adds email field)

Calls

ScopeDescriptionUsed By
calls:readView call metadata (title, duration, participants)Call listing endpoints

Files and Drive

ScopeDescriptionUsed By
files:readDownload files (legacy — prefer drive:read)Legacy file endpoints
files:writeUpload files (legacy — prefer drive:write)Legacy file endpoints
drive:readList folders, view file metadata, download filesGET /bot/drive/folders/:folderId
drive:writeUpload files, create/rename/delete foldersPOST /bot/drive/folders

Tasks

ScopeDescriptionUsed By
tasks:readView projects, tasks, and commentsGET /bot/tasks, GET /bot/tasks/:taskId, GET /bot/tasks/projects
tasks:writeCreate, update, complete, and delete tasks and projectsPOST /bot/tasks, PATCH /bot/tasks/:taskId, DELETE /bot/tasks/:taskId, POST /bot/tasks/projects

Calendar

ScopeDescriptionUsed By
calendar:readView calendar events and scheduled callsGET /bot/calendar/events
calendar:writeCreate, update, cancel events, RSVPCalendar write endpoints

Mail

ScopeDescriptionUsed By
mail:readView mailbox metadata (subject, sender, date — never body content)GET /bot/mail/threads

Teams

ScopeDescriptionUsed By
teams:readList teams, view membersGET /bot/teams, GET /bot/teams/:teamId
teams:writeAdd/remove team members, update team settingsPOST /bot/teams/:teamId/members, DELETE /bot/teams/:teamId/members/:userId

Admin Scopes

Admin scopes require the service account creator to have the ADMIN role in the organization. Non-admin users cannot create tokens with these scopes.

ScopeDescription
admin:usersManage users (invite, deactivate, change roles)
admin:channelsManage all channels regardless of membership
admin:auditRead organization audit logs

How Scope Checking Works

Single Scope Requirement

Most endpoints require a single scope. For example, GET /bot/tasks requires tasks:read:

# Works with tasks:read scope
curl -H "Authorization: Bearer mak_..." \
  "https://app.mandraki.cloud/api/v1/orgs/{orgId}/bot/tasks"

Alternative Scopes

Some endpoints accept alternative scopes. For example, GET /bot/drive/folders/:folderId accepts either drive:read or files:read (the legacy equivalent):

{
  "statusCode": 403,
  "error": "Forbidden",
  "message": "Requires one of these scopes",
  "required": ["drive:read", "files:read"]
}

Scope Errors

When a token lacks a required scope, the response includes the missing scopes:

{
  "statusCode": 403,
  "error": "Forbidden",
  "message": "Insufficient scopes",
  "missing": ["tasks:write"]
}

Resource Scopes

Resource scopes restrict a token to operate only on specific resource instances. They are configured at token creation time and cannot be changed after creation.

Available Resource Types

Resource TypeRestrictsExample
teamsWhich teams the token can access["team-uuid-1", "team-uuid-2"]
channelsWhich channels the token can read/write["channel-uuid-1"]
projectsWhich task projects the token can access["project-uuid-1"]
foldersWhich Drive folders the token can access["folder-uuid-1"]

Behavior

  • Omitted or empty: No restriction — the token can access all resources of that type (within its scopes).
  • Populated: The token can only access the listed resource IDs. Requests targeting other resources return 403:
{
  "statusCode": 403,
  "error": "Forbidden",
  "message": "API token does not have access to this team"
}

Example: Narrowly Scoped Token

A token that can only read tasks in one project and post messages to two channels:

{
  "label": "Sprint bot",
  "scopes": ["tasks:read", "messages:write", "channels:read"],
  "resourceScopes": {
    "projects": ["b7e1c2a3-..."],
    "channels": ["a1b2c3d4-...", "e5f6a7b8-..."]
  }
}

Read-Only Dashboard

["tasks:read", "teams:read", "channels:read", "users:read", "calendar:read"]

Task Automation Bot

["tasks:read", "tasks:write", "channels:read", "messages:write", "users:read"]

Channel Notification Bot

["channels:read", "messages:write"]

Full Admin Integration

["tasks:read", "tasks:write", "teams:read", "teams:write", "channels:read",
 "channels:history", "messages:write", "drive:read", "drive:write",
 "calendar:read", "users:read", "users:read:email",
 "admin:users", "admin:channels", "admin:audit"]