---
title: "Creates a new role in a specified Discord guild."
method: POST
path: "/createRole"
---

# Creates a new role in a specified Discord guild.

`POST /createRole`

This function adds a new role to a specified Discord guild with customizable properties. It allows setting various attributes of the role such as name, color, permissions, and position. The function returns a Promise that resolves to the created role object.

## Request body

- object
  - `body` object — Body of the createRole 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, required — The ID of the created role
  - `name` string, required — The name of the created role
  - `color` integer, required — The color of the created role
  - `hoist` boolean, required — Whether the created role is hoisted
  - `position` integer, required — The position of the created role
  - `permissions` string, required — The permissions of the created role
  - `mentionable` boolean, required — Whether the created role is mentionable
  - `managed` boolean, required — Whether the created role is managed
  - `description` string — The description of the created role (if provided)

## Other responses

- `400` — Bad Request - Invalid input parameters
- `403` — Forbidden - Insufficient permissions to create a role
- `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)
