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

---

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