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

# List roles

> Returns a paginated list of roles available within the organization's scope.



## OpenAPI

````yaml /en/api-reference/openapi.en-v2.json get /v2/organizations/{organization_id}/roles
openapi: 3.0.3
info:
  title: API Publica Portal
  version: 2.0.0
  description: Public REST API for portal
servers:
  - url: https://api.flexxible.net
    description: Portal API (production)
security:
  - bearerAuth: []
tags:
  - name: Digital activity
    description: Creation of core process groups by organization
  - name: Roles
    description: Endpoint de creacion de roles de organizacion
  - name: Usuarios
    description: Endpoint de creacion de usuarios de organizacion
  - name: Grupos de workspaces
    description: Endpoints de gestión de grupos de workspaces
  - name: Workspaces
    description: Endpoint de eliminacion de workspaces de la organizacion
  - name: Aplicaciones instaladas
    description: Endpoint de detalle de aplicación instalada de la organización
  - name: Autenticación
    description: Endpoints de autenticación y contexto de sesión
  - name: Microservicios
    description: Detalle de microservicios por organizacion
  - name: Operaciones
    description: Consulta de detalle de operaciones por organización
  - name: Organización
    description: Operaciones de organización
  - name: Objetivos de política de parches
    description: Endpoints de gestión de objetivos de política de parches
  - name: Configuraciones de producto
    description: Endpoints de gestión de configuraciones de producto
  - name: Grupos de reporte
    description: Operaciones sobre grupos de reporte
  - name: Sesiones
    description: Endpoint de detalle de sesion de la organizacion
  - name: Tenants
    description: Endpoints de gestión de tenants
paths:
  /v2/organizations/{organization_id}/roles:
    get:
      tags:
        - Roles
      summary: List roles
      description: >-
        Returns a paginated list of roles available within the organization's
        scope.
      operationId: get_roles
      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: page
          in: query
          required: false
          schema:
            type: integer
            default: 1
            minimum: 1
          description: Page number.
        - name: per_page
          in: query
          required: false
          schema:
            type: integer
            default: 100
            minimum: 1
            maximum: 100
          description: Number of items per page.
        - name: fields
          in: query
          required: false
          schema:
            type: string
            maxLength: 2048
          description: Comma-separated names of response fields to be included.
        - name: filters
          in: query
          required: false
          schema:
            type: string
            maxLength: 5120
          description: JSON filter expression on filterable field paths in the response.
          examples:
            simple:
              summary: Filter by role name
              value: '{"field":"name","op":"contains","value":"administrador"}'
            complex-and:
              summary: Filter by combined tokens of the role name
              value: >-
                {"and":[{"field":"name","op":"contains","value":"organización"},{"field":"name","op":"contains","value":"administrador"}]}
            complex-or-and:
              summary: Combine OR and AND conditions
              value: >-
                {"and":[{"or":[{"field":"name","op":"contains","value":"administrador"},{"field":"name","op":"contains","value":"operador"}]},{"field":"name","op":"contains","value":"rol"}]}
        - name: sort
          in: query
          required: false
          schema:
            type: string
            pattern: ^(id|organization_id|name|created_at|created_by):(asc|desc)$
          description: Order expression in the format <field>:asc|desc.
      responses:
        '200':
          description: Roles retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetRolesResponseV2'
              examples:
                paginated_result:
                  summary: Paginated list with roles
                  value:
                    has_next: true
                    data:
                      - id: 64f0c2a1b2d3e4f5060708aa
                        organization_id: 507f1f77bcf86cd799439011
                        name: Administrador de la organización
                        created_at: '2026-03-12T10:30:00Z'
                        created_by: 64f0c2a1b2d3e4f5060708bb
                        permissions:
                          - portal_permission: organization_admin
                            workspaces_permission: admin
                            analyzer_permission: access
                            target_organization: all
                            target_reporting_groups:
                              - 64f0c2a1b2d3e4f5060708c1
                empty_result:
                  summary: No roles found
                  value:
                    has_next: false
                    data: []
        '400':
          description: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_filters:
                  summary: Invalid filters format
                  value:
                    error:
                      message: Formato de filtros inválido
                      code: bad_request
                      details: filters debe ser una cadena JSON válida
        '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: >-
            The requested resource was not found within the authorized
            organization's scope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                resource_not_found:
                  summary: Requested resource not found
                  value:
                    error:
                      message: No encontrado
                      code: not_found
        '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:
    GetRolesResponseV2:
      type: object
      properties:
        has_next:
          type: boolean
          description: Indicates if another page is available.
        data:
          type: array
          items:
            $ref: '#/components/schemas/RoleV2'
      required:
        - has_next
        - data
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
            details:
              type: string
          required:
            - message
            - code
      required:
        - error
    RoleV2:
      type: object
      properties:
        id:
          type: string
          pattern: ^[0-9a-f]{24}$
          minLength: 24
          maxLength: 24
          description: Role identifier.
        name:
          type: string
          description: Role name.
        organization_id:
          type: string
          pattern: ^[0-9a-f]{24}$
          minLength: 24
          maxLength: 24
          description: Organization identifier associated with this role.
        created_at:
          type: string
          format: date-time
          description: Role creation timestamp in ISO 8601 format.
        created_by:
          type: string
          nullable: true
          pattern: ^[0-9a-f]{24}$
          minLength: 24
          maxLength: 24
          description: Identifier of the user who created the role.
        permissions:
          type: array
          nullable: true
          description: Permission entries configured for this role.
          items:
            $ref: '#/components/schemas/GetRolePermissionItemV2'
      required:
        - id
        - name
        - organization_id
        - created_at
        - created_by
    GetRolePermissionItemV2:
      type: object
      properties:
        portal_permission:
          type: string
          nullable: true
          enum:
            - admin
            - organization_admin
            - organization_admin_read_only
            - user
            - platform
            - l1_support_team
            - l1_support_team_read_only
            - l2_support_team
            - l2_support_team_read_only
            - l3_engineering_team
            - l3_engineering_team_read_only
            - billing
          description: Portal permission level.
        workspaces_permission:
          type: string
          nullable: true
          enum:
            - no_access
            - l1_support_team_read_only
            - l1_support_team
            - l2_support_team_read_only
            - l2_support_team
            - l3_engineering_team_read_only
            - l3_engineering_team
            - admin_read_only
            - admin
          description: Workspace permission level.
        analyzer_permission:
          type: string
          nullable: true
          enum:
            - no_access
            - access
            - admin
          description: Analyzer permission level.
        target_organization:
          oneOf:
            - type: string
              enum:
                - all
            - type: string
              pattern: ^[0-9a-f]{24}$
              minLength: 24
              maxLength: 24
          description: >-
            Organization scope of permission: `all` for all organizations or a
            specific `organization_id`.
        target_reporting_groups:
          oneOf:
            - type: string
              enum:
                - all
            - type: array
              minItems: 1
              items:
                type: string
                pattern: ^[0-9a-f]{24}$
                minLength: 24
                maxLength: 24
          description: >-
            Reporting groups scope of permission: `all` for all groups or list
            of specific `reporting_group_id`.
      required:
        - target_organization
        - target_reporting_groups
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````