---
title: "Create role assignment for principal"
url: "https://nov18-dev.movespot.fyi/apis/internal-pdp-policy-access-point-api-v1-1/versions/38c51035-26bf-4e85-b665-4a699daed68a/operations/createPrincipalRoleAssignment"
---

> Full API specification: https://nov18-dev.movespot.fyi/apis/internal-pdp-policy-access-point-api-v1-1/versions/38c51035-26bf-4e85-b665-4a699daed68a.md

# Create role assignment for principal

`POST` `/{principalType}/{principalId}/role-assignments`

Operation ID: `createPrincipalRoleAssignment`

Creates a new role assignment for the specified principal

## Path parameters

- `principalType` (string, required) - Type of principal
- `principalId` (string, uuid, required) - Unique identifier of the principal

## Request body (required)

Content types: `application/json`

## Responses

- `201` - Role assignment created successfully
- `400` - Bad Request
- `409` - Conflict

## OpenAPI definition

```yaml
openapi: 3.0.3
info:
  title: Internal PDP Policy Access Point API v1
  version: 1.0.2
servers:
  - url: http://authorization-pap-api.kauth.svc.cluster.local:8000/v1
    description: Konnect cluster
paths:
  /{principalType}/{principalId}/role-assignments:
    parameters:
      - name: principalType
        in: path
        description: Type of principal
        required: true
        schema:
          $ref: "#/components/schemas/RoleAssignmentPrincipalType"
      - name: principalId
        in: path
        description: Unique identifier of the principal
        required: true
        schema:
          $ref: "#/components/schemas/PrincipalId"
    post:
      operationId: createPrincipalRoleAssignment
      summary: Create role assignment for principal
      description: Creates a new role assignment for the specified principal
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateRoleAssignmentRequest"
      responses:
        "201":
          description: Role assignment created successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RoleAssignment"
        "400":
          $ref: "#/components/responses/BadRequest"
        "409":
          $ref: "#/components/responses/Conflict"
      tags:
        - Role Assignments
security:
  - konnectAccessToken: []
components:
  schemas:
    RoleAssignmentPrincipalType:
      description: Principal types that support role assignments
      type: string
      enum:
        - users
        - system-accounts
        - teams
        - portal-teams
    PrincipalId:
      description: Contains a unique identifier used for a principal (user, system
        account, portal developer, etc.)
      type: string
      format: uuid
      example: 5f9fd312-a987-4628-b4c5-bb4f4fddd5f7
    CreateRoleAssignmentRequest:
      description: Request body for creating a role assignment
      type: object
      properties:
        role_assignment_id:
          description: Optional unique identifier for the role assignment
          type: string
          format: uuid
        role_krn:
          description: Kong Resource Name of the role
          type: string
        region:
          description: Region where the role applies
          type: string
        resource:
          description: Resource identifier
          type: string
      required:
        - role_krn
        - region
        - resource
    RoleAssignment:
      description: A role assignment for a subject (user/system account)
      type: object
      properties:
        id:
          description: Unique identifier of the role assignment
          type: string
          format: uuid
        role_krn:
          description: Kong Resource Name of the role
          type: string
        role_name:
          description: Display name of the assigned role
          type: string
        region:
          description: Region where the role applies
          type: string
        resource:
          description: Resource identifier
          type: string
        entity_type_name:
          description: Entity type name associated with the role
          type: string
      required:
        - id
        - role_krn
        - region
        - resource
        - entity_type_name
        - role_name
    BadRequestError:
      allOf:
        - $ref: "#/components/schemas/BaseError"
        - type: object
          required:
            - invalid_parameters
          properties:
            invalid_parameters:
              $ref: "#/components/schemas/InvalidParameters"
    ConflictError:
      allOf:
        - $ref: "#/components/schemas/BaseError"
        - type: object
          properties:
            status:
              example: 409
            title:
              example: Conflict
            type:
              example: https://httpstatuses.com/409
            instance:
              example: kong:trace:1234567890
            detail:
              example: Conflict
    BaseError:
      description: standard error
      type: object
      properties:
        status:
          description: >
            The HTTP status code of the error. Useful when passing the response

            body to child properties in a frontend UI. Must be returned as an
            integer.
          type: integer
          readOnly: true
        title:
          description: |
            A short, human-readable summary of the problem. It should not
            change between occurences of a problem, except for localization.
            Should be provided as "Sentence case" for direct use in the UI.
          type: string
          readOnly: true
        type:
          description: The error type.
          type: string
          readOnly: true
        instance:
          description: |
            Used to return the correlation ID back to the user, in the format
            kong:trace:<correlation_id>. This helps us find the relevant logs
            when a customer reports an issue.
          type: string
          readOnly: true
        detail:
          description: >
            A human readable explanation specific to this occurence of the
            problem.

            This field may contain request/entity data to help the user
            understand

            what went wrong. Enclose variable values in square brackets. Should
            be

            provided as "Sentence case" for direct use in the UI.
          type: string
          readOnly: true
      required:
        - status
        - title
        - instance
        - detail
      title: Error
    InvalidParameters:
      description: invalid parameters
      type: array
      items:
        oneOf:
          - $ref: "#/components/schemas/InvalidParameterStandard"
          - $ref: "#/components/schemas/InvalidParameterMinimumLength"
          - $ref: "#/components/schemas/InvalidParameterMaximumLength"
          - $ref: "#/components/schemas/InvalidParameterChoiceItem"
          - $ref: "#/components/schemas/InvalidParameterDependentItem"
      minItems: 1
      nullable: false
      uniqueItems: true
    InvalidParameterStandard:
      type: object
      properties:
        field:
          type: string
          example: name
          readOnly: true
        rule:
          $ref: "#/components/schemas/InvalidRules"
        source:
          type: string
          example: body
        reason:
          type: string
          example: is a required field
          readOnly: true
      additionalProperties: false
      required:
        - field
        - reason
    InvalidParameterMinimumLength:
      type: object
      properties:
        field:
          type: string
          example: name
          readOnly: true
        rule:
          description: invalid parameters rules
          type: string
          enum:
            - min_length
            - min_digits
            - min_lowercase
            - min_uppercase
            - min_symbols
            - min_items
            - min
          nullable: false
          readOnly: true
        minimum:
          type: integer
          example: 8
        source:
          type: string
          example: body
        reason:
          type: string
          example: must have at least 8 characters
          readOnly: true
      additionalProperties: false
      required:
        - field
        - reason
        - rule
        - minimum
    InvalidParameterMaximumLength:
      type: object
      properties:
        field:
          type: string
          example: name
          readOnly: true
        rule:
          description: invalid parameters rules
          type: string
          enum:
            - max_length
            - max_items
            - max
          nullable: false
          readOnly: true
        maximum:
          type: integer
          example: 8
        source:
          type: string
          example: body
        reason:
          type: string
          example: must not have more than 8 characters
          readOnly: true
      additionalProperties: false
      required:
        - field
        - reason
        - rule
        - maximum
    InvalidParameterChoiceItem:
      type: object
      properties:
        field:
          type: string
          example: name
          readOnly: true
        rule:
          description: invalid parameters rules
          type: string
          enum:
            - enum
          nullable: false
          readOnly: true
        reason:
          type: string
          example: is a required field
          readOnly: true
        choices:
          type: array
          items: {}
          minItems: 1
          nullable: false
          readOnly: true
          uniqueItems: true
        source:
          type: string
          example: body
      additionalProperties: false
      required:
        - field
        - reason
        - rule
        - choices
    InvalidParameterDependentItem:
      type: object
      properties:
        field:
          type: string
          example: name
          readOnly: true
        rule:
          description: invalid parameters rules
          type: string
          enum:
            - dependent_fields
          nullable: true
          readOnly: true
        reason:
          type: string
          example: is a required field
          readOnly: true
        dependents:
          type: array
          items: {}
          nullable: true
          readOnly: true
          uniqueItems: true
        source:
          type: string
          example: body
      additionalProperties: false
      required:
        - field
        - rule
        - reason
        - dependents
    InvalidRules:
      description: invalid parameters rules
      type: string
      enum:
        - required
        - is_array
        - is_base64
        - is_boolean
        - is_date_time
        - is_integer
        - is_null
        - is_number
        - is_object
        - is_string
        - is_uuid
        - is_fqdn
        - is_arn
        - unknown_property
        - missing_reference
        - is_label
        - matches_regex
        - invalid
        - is_supported_network_availability_zone_list
        - is_supported_network_cidr_block
        - is_supported_provider_region
        - type
      nullable: true
      readOnly: true
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/BadRequestError"
    Conflict:
      description: Conflict
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/ConflictError"
  securitySchemes:
    konnectAccessToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        The Konnect access token is meant to be used by the Konnect dashboard
        and the decK CLI authenticate with.
```
