API referenceProject API

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

PUT/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

NameInTypeRequiredDescription
serverIdpathstringyesDiscord server ID
discordIdpathstringyesDiscord member ID
roleIdpathstringyesDiscord role ID to grant
Idempotency-KeyheaderstringnoOptional idempotency key (up to 128 characters). A retry with the same key returns the cached response.

Responses

StatusDescriptionBody
204Role granted successfully (or already held)
401Missing or invalid API key
403Project lacks manage_roles scope, role was not created by this project, or role is protected
404Server, member, or role not found
409Idempotency conflict: a request with this key is currently in progress, or the key was reused with a different payload.
502Discord rejected the role change
503Discord is unavailable

Open in Swagger (opens in a new tab)

Remove a project-created role from a member

DELETE/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

NameInTypeRequiredDescription
serverIdpathstringyesDiscord server ID
discordIdpathstringyesDiscord member ID
roleIdpathstringyesDiscord role ID to remove
Idempotency-KeyheaderstringnoOptional idempotency key (up to 128 characters). A retry with the same key returns the cached response.

Responses

StatusDescriptionBody
204Role removed successfully (or not held)
401Missing or invalid API key
403Project lacks manage_roles scope, role was not created by this project, or role is protected
404Server, member, or role not found
409Idempotency conflict: a request with this key is currently in progress, or the key was reused with a different payload.
502Discord rejected the role change
503Discord is unavailable

Open in Swagger (opens in a new tab)

Create a Discord role for an event or project

POST/api/servers/{serverId}/roles

Creates 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

NameInTypeRequiredDescription
serverIdpathstringyesDiscord server ID
Idempotency-KeyheaderstringnoOptional idempotency key (up to 128 characters). A retry with the same key returns the cached response.

Request body (JSON, required): CreateProjectRoleDto schema.

Responses

StatusDescriptionBody
201Role created, or the role this project already created under that nameProjectRoleResponseDto
400Invalid input payload
401Missing or invalid API key
403Project lacks manage_roles scope on this server
404Server not found
409Idempotency 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

FieldTypeRequiredDescription
colornumbernoRGB color as integer (0 to 16777215)
mentionablebooleannoWhether the role can be mentioned by anyone Default: false.
namestringyesName of the Discord role to create

ProjectRoleResponseDto schema

FieldTypeRequiredDescription
colornumber or nullyesRole color as integer
createdAtstringyesTimestamp when the role was created in MCID
idstringyesDiscord snowflake ID of the created role
mentionablebooleanyesWhether the role is mentionable
namestringyesName of the role
positionnumberyesRole position in the hierarchy
serverIdstringyesDiscord server ID

Source: apps/api/openapi.json.

On this page