---
title: "Create a role set"
method: POST
path: "/role_sets"
tags: ["Role Sets"]
---

# Create a role set

`POST /role_sets`

Creates a new role set with the given name and roles.
The key must be unique for the instance and start with the 'role_set:' prefix, followed by lowercase alphanumeric characters and underscores only.
You must provide at least one role and specify a default role key and creator role key.

## Request body

- object
  - `name` string, required — The name of the new role set
  - `key` string — A unique key for the role set. Must start with 'role_set:' and contain only lowercase alphanumeric characters and underscores. If not provided, a key will be generated from the name.
  - `description` string, nullable — Optional description for the role set
  - `default_role_key` string, required — The key of the role to use as the default role for new organization members. Must be one of the roles in the `roles` array.
  - `creator_role_key` string, required — The key of the role to assign to organization creators. Must be one of the roles in the `roles` array.
  - `type` 'initial' | 'custom' — The type of the role set. "initial" role sets are the default for new organizations. Only one role set can be "initial" per instance.
  - `roles` string[], required — Array of role keys to include in the role set. Must contain at least one role and no more than 10 roles.

## Response `200`

Success

- RoleSet — A role set defines a collection of roles that can be assigned to organization members
  - `object` 'role_set', required
  - `id` string, required — The unique identifier of the role set
  - `name` string, required — The name of the role set
  - `key` string, required — A unique key for the role set (e.g., "role_set:default")
  - `description` string, nullable, required — Optional description of the role set
  - `roles` RoleSetItem[], required — The list of roles in this role set
    - `object` 'role_set_item', required
    - `id` string, required — The unique identifier of the role
    - `name` string, required — The name of the role
    - `key` string, required — The key of the role (e.g., "org:admin", "org:member")
    - `description` string, nullable, required — Optional description of the role
    - `members_count` integer, nullable — The number of members assigned to this role within the role set
    - `has_members` boolean, nullable — Whether this role has any members assigned within the role set
    - `created_at` integer, required — Unix timestamp of role creation
    - `updated_at` integer, required — Unix timestamp of last role update
  - `default_role` RoleSetItem — A role within a role set
    - `object` 'role_set_item', required
    - `id` string, required — The unique identifier of the role
    - `name` string, required — The name of the role
    - `key` string, required — The key of the role (e.g., "org:admin", "org:member")
    - `description` string, nullable, required — Optional description of the role
    - `members_count` integer, nullable — The number of members assigned to this role within the role set
    - `has_members` boolean, nullable — Whether this role has any members assigned within the role set
    - `created_at` integer, required — Unix timestamp of role creation
    - `updated_at` integer, required — Unix timestamp of last role update
  - `creator_role` RoleSetItem — A role within a role set
    - `object` 'role_set_item', required
    - `id` string, required — The unique identifier of the role
    - `name` string, required — The name of the role
    - `key` string, required — The key of the role (e.g., "org:admin", "org:member")
    - `description` string, nullable, required — Optional description of the role
    - `members_count` integer, nullable — The number of members assigned to this role within the role set
    - `has_members` boolean, nullable — Whether this role has any members assigned within the role set
    - `created_at` integer, required — Unix timestamp of role creation
    - `updated_at` integer, required — Unix timestamp of last role update
  - `type` 'initial' | 'custom', required — The type of the role set ("initial" or "custom")
  - `role_set_migration` RoleSetMigration — Information about an ongoing role set migration
    - `object` 'role_set_migration', required
    - `id` string, required — The unique identifier of the migration
    - `organization_id` string, nullable — The organization ID if the migration is scoped to a specific organization
    - `instance_id` string, required — The instance ID this migration belongs to
    - `source_role_set_id` string, required — The ID of the source role set being migrated from
    - `dest_role_set_id` string, nullable — The ID of the destination role set being migrated to
    - `trigger_type` string, required — What triggered this migration (e.g., "role_set_deletion", "role_removal")
    - `status` string, required — Current status of the migration (e.g., "enqueued", "in_progress", "completed")
    - `migrated_members` integer, required — Number of members that have been migrated so far
    - `mappings` object, nullable — Role key mappings from source to destination roles
    - `started_at` integer, nullable — Unix timestamp when the migration started
    - `completed_at` integer, nullable — Unix timestamp when the migration completed
    - `created_at` integer, required — Unix timestamp of migration creation
    - `updated_at` integer, required — Unix timestamp of last migration update
  - `created_at` integer, required — Unix timestamp of role set creation
  - `updated_at` integer, required — Unix timestamp of last role set update

## Other responses

- `400` — Request was not successful
- `401` — Authentication invalid
- `402` — Payment required
- `403` — Authorization invalid
- `404` — Resource not found
- `422` — Invalid request parameters

---

[API](https://skmtc.net/clerk/apis/clerk-backend-api.md) · [All operations](https://skmtc.net/clerk/apis/clerk-backend-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/clerk/clerk-backend-api/revisions/7d969765e49a/schema)
