Roles
Create Discord roles for events or projects, and grant or remove them for members with a project API key.
Grant a project-created role to a member
/api/servers/{serverId}/members/{discordId}/roles/{roleId}Grants a role to a member of the server. Only roles previously created by the calling project can be granted; attempts to grant executive, root, or unowned roles will return 403 Forbidden and record an audit log.
Authentication: Project API key (X-API-Key header)
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
serverId | path | string | yes | Discord server ID |
discordId | path | string | yes | Discord member ID |
roleId | path | string | yes | Discord role ID to grant |
Idempotency-Key | header | string | no | Optional idempotency key (up to 128 characters). A retry with the same key returns the cached response. |
Responses
| Status | Description | Body |
|---|---|---|
204 | Role granted successfully (or already held) | |
401 | Missing or invalid API key | |
403 | Project lacks manage_roles scope, role was not created by this project, or role is protected | |
404 | Server, member, or role not found | |
409 | Idempotency conflict: a request with this key is currently in progress, or the key was reused with a different payload. | |
502 | Discord rejected the role change | |
503 | Discord is unavailable |
Open in Swagger (opens in a new tab)
Remove a project-created role from a member
/api/servers/{serverId}/members/{discordId}/roles/{roleId}Removes a role from a member of the server. Only roles previously created by the calling project can be removed; attempts to remove executive, root, or unowned roles will return 403 Forbidden and record an audit log.
Authentication: Project API key (X-API-Key header)
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
serverId | path | string | yes | Discord server ID |
discordId | path | string | yes | Discord member ID |
roleId | path | string | yes | Discord role ID to remove |
Idempotency-Key | header | string | no | Optional idempotency key (up to 128 characters). A retry with the same key returns the cached response. |
Responses
| Status | Description | Body |
|---|---|---|
204 | Role removed successfully (or not held) | |
401 | Missing or invalid API key | |
403 | Project lacks manage_roles scope, role was not created by this project, or role is protected | |
404 | Server, member, or role not found | |
409 | Idempotency conflict: a request with this key is currently in progress, or the key was reused with a different payload. | |
502 | Discord rejected the role change | |
503 | Discord is unavailable |
Open in Swagger (opens in a new tab)
Create a Discord role for an event or project
/api/servers/{serverId}/rolesCreates a new Discord role with no permissions by default (0n bitfield) and records project ownership. The role can subsequently be granted and removed by the same project using the member role endpoints. A call with a name the project already created on this server returns that role unchanged instead of creating a second one, so a retry is safe.
Authentication: Project API key (X-API-Key header)
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
serverId | path | string | yes | Discord server ID |
Idempotency-Key | header | string | no | Optional idempotency key (up to 128 characters). A retry with the same key returns the cached response. |
Request body (JSON, required): CreateProjectRoleDto schema.
Responses
| Status | Description | Body |
|---|---|---|
201 | Role created, or the role this project already created under that name | ProjectRoleResponseDto |
400 | Invalid input payload | |
401 | Missing or invalid API key | |
403 | Project lacks manage_roles scope on this server | |
404 | Server not found | |
409 | Idempotency conflict: a request with this key is currently in progress, or the key was reused with a different payload. |
Open in Swagger (opens in a new tab)
Schemas
CreateProjectRoleDto schema
| Field | Type | Required | Description |
|---|---|---|---|
color | number | no | RGB color as integer (0 to 16777215) |
mentionable | boolean | no | Whether the role can be mentioned by anyone Default: false. |
name | string | yes | Name of the Discord role to create |
ProjectRoleResponseDto schema
| Field | Type | Required | Description |
|---|---|---|---|
color | number or null | yes | Role color as integer |
createdAt | string | yes | Timestamp when the role was created in MCID |
id | string | yes | Discord snowflake ID of the created role |
mentionable | boolean | yes | Whether the role is mentionable |
name | string | yes | Name of the role |
position | number | yes | Role position in the hierarchy |
serverId | string | yes | Discord server ID |
Source: apps/api/openapi.json.