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

# Delete a role

> Delete the specified role within the scope of an organization. Returns no content when deletion is successful.



## OpenAPI

````yaml /en/api-reference/openapi.en-v1.json delete /v1/organizations/{organization_id}/roles/{role_id}
openapi: 3.0.3
info:
  title: API Publica Portal
  version: 1.0.0
  description: Public REST API for portal
servers:
  - url: https://api.flexxible.net/
    description: Portal API
security:
  - bearerAuth: []
tags: []
paths:
  /v1/organizations/{organization_id}/roles/{role_id}:
    delete:
      tags:
        - Roles
      summary: Delete a role
      description: >-
        Delete the specified role within the scope of an organization. Returns
        no content when deletion is successful.
      operationId: delete_role
      parameters:
        - name: organization_id
          in: path
          required: true
          schema:
            type: string
            pattern: ^[0-9a-f]{24}$
            minLength: 24
            maxLength: 24
          description: Organization identifier.
          example: 507f1f77bcf86cd799439011
        - name: role_id
          in: path
          required: true
          schema:
            type: string
            pattern: ^[0-9a-f]{24}$
            minLength: 24
            maxLength: 24
          description: Role identifier.
          example: 64f0c2a1b2d3e4f5060708aa
      responses:
        '204':
          description: User role successfully deleted.
        '400':
          description: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_role_id:
                  summary: Invalid role identifier format
                  value:
                    error:
                      message: Formato de role_id no válido
                      code: bad_request
                      details: >-
                        role_id debe ser una cadena hexadecimal en minúsculas de
                        24 caracteres
        '401':
          description: Not authorized or organization not accessible.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                organization_not_authorized:
                  summary: Organization access failure
                  value:
                    error:
                      message: No autorizado
                      code: unauthorized
        '404':
          description: Role not found within the authorized organization scope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                role_not_found:
                  summary: Requested role not found
                  value:
                    error:
                      message: Rol no encontrado
                      code: not_found
        '422':
          description: >-
            The request cannot be processed because the role still has assigned
            users.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                role_has_assigned_users:
                  summary: Role still has assigned users
                  value:
                    error:
                      message: El rol tiene usuarios asignados
                      code: unprocessable_entity
                      details: >-
                        Elimina las asignaciones del rol de los usuarios antes
                        de eliminar este rol
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unexpected_error:
                  summary: Unhandled failure
                  value:
                    error:
                      message: Error interno del servidor
                      code: internal_error
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
            details:
              type: string
          required:
            - message
            - code
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````