> ## Documentation Index
> Fetch the complete documentation index at: https://docs.identety.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Role



## OpenAPI

````yaml post /roles
openapi: 3.0.0
info:
  title: Identety API
  description: Identity Provider API
  version: '1.0'
  contact: {}
servers: []
security: []
tags: []
paths:
  /roles:
    post:
      tags:
        - Role
      summary: Create role
      operationId: RoleController_createRole
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRoleDto'
      responses:
        '201':
          description: Role created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleSwaggerModel'
        '401':
          description: Unauthorized. Invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnAuthorizedResponseSwaggerModel'
      security:
        - x-api-key: []
components:
  schemas:
    CreateRoleDto:
      type: object
      properties:
        name:
          type: string
          example: Content Editor
          description: Role name will be converted to snake_case automatically
        description:
          type: string
          example: Can manage and publish content
        is_system:
          type: boolean
          example: false
          description: Whether this is a system role. Cannot be set to true manually.
      required:
        - name
    RoleSwaggerModel:
      type: object
      properties:
        id:
          type: string
          example: uuid-123
        name:
          type: string
          example: admin_role
        description:
          type: string
          example: Administrator role with full access
        is_system:
          type: boolean
          example: false
        created_at:
          format: date-time
          type: string
        updated_at:
          format: date-time
          type: string
      required:
        - id
        - name
        - description
        - is_system
        - created_at
        - updated_at
    UnAuthorizedResponseSwaggerModel:
      type: object
      properties:
        message:
          type: string
          example: Invalid API key
        statusCode:
          type: number
          example: 401
        error:
          type: string
          example: Unauthorized
      required:
        - message
        - statusCode
        - error
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key

````