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

# Create a role



## OpenAPI

````yaml https://openapi.production.reelevant.io/v1/render/entity-manager post /roles
openapi: 3.0.0
info:
  title: entity-manager
  version: unknown
  description: |-
    # Errors
    | Error code | Message | HTTP status code | Payload |
    | :--- | :--- | :--- | :--- |
    | number | string | 400 |  |
servers:
  - url: https://api.reelevant.com/v2/
    description: production
security: []
paths:
  /roles:
    post:
      tags:
        - Role
      summary: Create a role
      operationId: create-role
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                rules:
                  type: array
                  items:
                    $ref: '#/components/schemas/RoleRule'
              required:
                - name
                - rules
              additionalProperties: false
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                allOf:
                  - type: object
                    properties:
                      status:
                        type: string
                        enum:
                          - success
                    required:
                      - status
                    additionalProperties: false
                  - $ref: '#/components/schemas/InternalResponse_Role'
        '400':
          description: ''
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/InternalResponse_'
                  - type: object
                    properties:
                      status:
                        type: string
                        enum:
                          - fail
                      error_code:
                        type: number
                      code:
                        type: number
                      message:
                        type: string
                      data:
                        oneOf:
                          - type: object
                            properties: {}
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              count:
                                type: number
                            required:
                              - count
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              resources:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    name:
                                      type: string
                                    resources:
                                      type: array
                                      items:
                                        type: object
                                        properties:
                                          id:
                                            type: string
                                        required:
                                          - id
                                        additionalProperties: false
                                  required:
                                    - name
                                    - resources
                                  additionalProperties: false
                            required:
                              - resources
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties: {}
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              usedAt:
                                type: string
                                format: date-time
                            required:
                              - usedAt
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              reason:
                                type: string
                            required:
                              - reason
                            additionalProperties: false
                          - type: object
                            properties:
                              domains:
                                type: array
                                items:
                                  type: string
                            required:
                              - domains
                            additionalProperties: false
                          - type: object
                            properties:
                              domain:
                                type: string
                            required:
                              - domain
                            additionalProperties: false
                          - type: object
                            properties:
                              reason:
                                oneOf:
                                  - type: string
                                    enum:
                                      - incomplete
                                  - type: string
                                    enum:
                                      - never-used
                            required:
                              - reason
                            additionalProperties: false
                          - type: object
                            properties:
                              properties:
                                type: array
                                items:
                                  type: string
                            required:
                              - properties
                            additionalProperties: false
                    required:
                      - status
                      - error_code
                      - code
                      - message
                    additionalProperties: false
        '409':
          description: ''
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/InternalResponse_'
                  - type: object
                    properties:
                      status:
                        type: string
                        enum:
                          - fail
                      error_code:
                        type: number
                      code:
                        type: number
                      message:
                        type: string
                      data:
                        oneOf:
                          - type: object
                            properties: {}
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              count:
                                type: number
                            required:
                              - count
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              resources:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    name:
                                      type: string
                                    resources:
                                      type: array
                                      items:
                                        type: object
                                        properties:
                                          id:
                                            type: string
                                        required:
                                          - id
                                        additionalProperties: false
                                  required:
                                    - name
                                    - resources
                                  additionalProperties: false
                            required:
                              - resources
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties: {}
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              usedAt:
                                type: string
                                format: date-time
                            required:
                              - usedAt
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                            required:
                              - id
                            additionalProperties: false
                          - type: object
                            properties:
                              reason:
                                type: string
                            required:
                              - reason
                            additionalProperties: false
                          - type: object
                            properties:
                              domains:
                                type: array
                                items:
                                  type: string
                            required:
                              - domains
                            additionalProperties: false
                          - type: object
                            properties:
                              domain:
                                type: string
                            required:
                              - domain
                            additionalProperties: false
                          - type: object
                            properties:
                              reason:
                                oneOf:
                                  - type: string
                                    enum:
                                      - incomplete
                                  - type: string
                                    enum:
                                      - never-used
                            required:
                              - reason
                            additionalProperties: false
                          - type: object
                            properties:
                              properties:
                                type: array
                                items:
                                  type: string
                            required:
                              - properties
                            additionalProperties: false
                    required:
                      - status
                      - error_code
                      - code
                      - message
                    additionalProperties: false
      security:
        - password_auth: []
components:
  schemas:
    RoleRule:
      $ref: '#/components/schemas/RoleRule_Without_ToJSON'
    InternalResponse_Role:
      type: object
      properties:
        program:
          type: string
        version:
          type: string
        datetime:
          type: string
        status:
          type: string
        code:
          type: number
        message:
          type: string
        data:
          $ref: '#/components/schemas/Role'
      required:
        - program
        - version
        - datetime
        - status
        - message
        - data
      additionalProperties: false
    InternalResponse_:
      type: object
      properties:
        program:
          type: string
        version:
          type: string
        datetime:
          type: string
        status:
          type: string
        code:
          type: number
        message:
          type: string
        data:
          type: object
          properties: {}
          additionalProperties: false
      required:
        - program
        - version
        - datetime
        - status
        - message
        - data
      additionalProperties: false
    RoleRule_Without_ToJSON:
      type: object
      properties:
        reason:
          type: string
        action:
          oneOf:
            - type: string
              enum:
                - create
            - type: string
              enum:
                - access
            - type: string
              enum:
                - read
            - type: string
              enum:
                - query
            - type: string
              enum:
                - update
            - type: string
              enum:
                - delete
            - type: string
              enum:
                - export
        fields:
          type: array
          items:
            type: string
        conditions:
          oneOf:
            - type: object
              properties: {}
              additionalProperties:
                $ref: '#/components/schemas/AnyValue'
            - type: array
              items:
                $ref: '#/components/schemas/DatasourceQueryCondition'
        inverted:
          type: boolean
        subject:
          oneOf:
            - type: string
              enum:
                - User
            - type: string
              enum:
                - Invitation
            - type: string
              enum:
                - Company
            - type: string
              enum:
                - Role
            - type: string
              enum:
                - Datasource
            - type: string
              enum:
                - OAuthClient
            - type: string
              enum:
                - Statistics
            - type: string
              enum:
                - Billing
            - type: string
              enum:
                - ResourceGroup
            - type: string
              enum:
                - Workflow
            - type: string
              enum:
                - Content
            - type: string
              enum:
                - ContentFontResource
            - type: string
              enum:
                - DatagraphSchema
            - type: string
              enum:
                - DatagraphEntity
            - type: string
              enum:
                - WorkflowSettings
            - type: string
              enum:
                - DatasourceSettings
            - type: string
              enum:
                - Loop
            - type: string
              enum:
                - Experience
            - type: string
              enum:
                - Infrastructure
            - type: string
              enum:
                - AnalyticsSettings
        mustMatch:
          type: array
          items:
            oneOf:
              - type: string
                enum:
                  - companyId
              - type: string
                enum:
                  - roleId
              - type: string
                enum:
                  - resourceGroupIds
              - type: string
                enum:
                  - id
              - type: object
                properties:
                  field:
                    type: string
                  value:
                    oneOf:
                      - type: string
                        enum:
                          - companyId
                      - type: string
                        enum:
                          - roleId
                      - type: string
                        enum:
                          - resourceGroupIds
                      - type: string
                        enum:
                          - id
                      - type: string
                        enum:
                          - companyId?
                      - type: string
                        enum:
                          - resourceGroupIds?
                required:
                  - field
                  - value
                additionalProperties: false
      required:
        - action
        - subject
      additionalProperties: false
    Role:
      $ref: '#/components/schemas/SerializedRole'
    AnyValue:
      description: Can be any value
      nullable: true
    DatasourceQueryCondition:
      type: object
      properties:
        type:
          type: string
          enum:
            - datasource_query
        options:
          type: object
          properties:
            datasourceIds:
              type: array
              items:
                type: string
            query:
              oneOf:
                - type: object
                  properties:
                    $and:
                      type: array
                      items:
                        type: object
                        properties: {}
                        additionalProperties:
                          $ref: '#/components/schemas/AnyValue'
                  required:
                    - $and
                  additionalProperties: false
                - type: object
                  properties:
                    $or:
                      type: array
                      items:
                        type: object
                        properties: {}
                        additionalProperties:
                          $ref: '#/components/schemas/AnyValue'
                  required:
                    - $or
                  additionalProperties: false
          required:
            - query
          additionalProperties: false
      required:
        - type
        - options
      additionalProperties: false
    SerializedRole:
      type: object
      properties:
        id:
          type: string
          readOnly: true
        companyId:
          type: string
          readOnly: true
        name:
          type: string
        rules:
          type: array
          items:
            $ref: '#/components/schemas/RoleRule_Without_ToJSON'
      required:
        - id
        - companyId
        - name
        - rules
      additionalProperties: false
  securitySchemes:
    password_auth:
      type: oauth2
      flows:
        password:
          tokenUrl: https://api.reelevant.com/v1/auth/token
          refreshUrl: https://api.reelevant.com/v1/auth/token
          scopes: {}

````