---
title: "Fetches all roles in a Discord guild."
method: POST
path: "/fetchRoles"
---

# Fetches all roles in a Discord guild.

`POST /fetchRoles`

This function retrieves a list of all roles within a specific Discord guild. It takes a guild ID as input and returns a Promise that resolves to an array of role objects. This can be useful for managing permissions, displaying role information, or performing role-based operations within a Discord bot or application.

## Request body

- object
  - `body` object — Body of the fetchRoles sls call
    - `arguments` unknown[], required
      - unknown
    - `auth` object — Authentication object
      - `strategy` 'apikey' — Authentication strategy
      - `variables` unknown[] — Variables for the authentication strategy
        - unknown
    - `packageName` string — @microfox/discord

## Response `200`

Successful response

- object[]
  - `id` string — The ID of the role
  - `name` string — The name of the role
  - `color` integer — The color of the role
  - `hoist` boolean — Whether the role is hoisted
  - `position` integer — The position of the role
  - `permissions` string — The permissions of the role as a string
  - `managed` boolean — Whether the role is managed by an integration
  - `mentionable` boolean — Whether the role is mentionable

## Other responses

- `400` — Bad Request - Invalid guild ID provided
- `403` — Forbidden - Bot lacks permissions to fetch roles
- `404` — Not Found - Guild not found
- `500` — Internal Server Error

## Changes

- **2025-05-29** `2deb154b9766` — 1 breaking, 4 warning, 4 info
  - the response's body type/format changed from `object`/`` to `array`/`` for status `200`
  - removed the optional property `arguments` from the response with the `200` status
  - removed the optional property `description` from the response with the `200` status
  - removed the optional property `responses` from the response with the `200` status
  - …5 more
- **2025-05-28** `d03e8c66c195` — 1 breaking, 8 info
  - the response's body type/format changed from `array`/`` to `object`/`` for status `200`
  - removed the non-success response with the status `400`
  - removed the non-success response with the status `403`
  - removed the non-success response with the status `404`
  - …5 more

[Change history](https://skmtc.dev/microfox-ai/apis/microfox-discord-sdk-api/changes/fetchRoles/post.md)

---

[API](https://skmtc.dev/microfox-ai/apis/microfox-discord-sdk-api.md) · [All operations](https://skmtc.dev/microfox-ai/apis/microfox-discord-sdk-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/microfox-ai/microfox-discord-sdk-api/revisions/7cb5b64ae924/schema)
