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

# Create Access Role



## OpenAPI

````yaml /openapi.yaml post /v1/access-management
openapi: 3.1.0
info:
  title: Trackpilots API & Webhooks
  version: 1.1.0
  description: >
    Trackpilots REST APIs and Webhook events.

    Webhooks are sent by the Trackpilots desktop agent to customer-configured
    endpoints.

    Clients only send `secret_key`. All other fields are generated by the
    server.
servers:
  - url: https://api.trackpilots.com
    description: Production server
security: []
tags:
  - name: Teams
    description: Team management APIs
  - name: Desktop Events
    description: Desktop agent webhook events
paths:
  /v1/access-management:
    post:
      tags:
        - Access Control
      summary: Create Access Role
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAccessManagementRoleRequest'
      responses:
        '200':
          description: >-
            Page-level access permissions have been successfully assigned to the
            role.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/200CreateAccessManagementSuccessResponse'
        '400':
          description: Request validation failed
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/400CreateAccessManagementValidationErrorResponse
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '409':
          description: A role with this name already exists. Try using a unique role name.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/409CreateAccessManagementDuplicateRoleErrorResponse
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - BearerAuth: []
components:
  schemas:
    CreateAccessManagementRoleRequest:
      type: object
      properties:
        roleName:
          type: string
          example: Manager
        roleData:
          type: array
          description: >-
            Route-wise access configuration defining the permission level
            granted to this role.
          items:
            type: object
            example:
              - path: /
                access: Full Access
              - path: /my-team
                access: Team Data
              - path: /proof-of-work/screenshot
                access: Own Data
            properties:
              path:
                type: string
                example: /my-team
              access:
                type: string
                enum:
                  - Full Access
                  - Team Data
                  - Own Data
                example: Team Data
      required:
        - roleName
    200CreateAccessManagementSuccessResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        statusCode:
          type: integer
          example: 200
        statusMessage:
          type: string
          example: >-
            Page-level access permissions have been successfully assigned to the
            role.
        error:
          type: object
          nullable: true
          example: null
        data:
          type: object
          properties:
            roleId:
              type: string
              format: uuid
              example: c44a66ea-d0ba-4423-9f85-25c68f7aa37b
            roleName:
              type: string
              example: Manager
            roleData:
              type: array
              items:
                type: object
                properties:
                  path:
                    type: string
                    example: /my-team
                  access:
                    type: string
                    enum:
                      - Full Access
                      - Team Data
                      - Own Data
                    example: Full Access
              example:
                - path: /
                  access: Full Access
                - path: /my-team
                  access: Team Data
                - path: /proof-of-work/screenshot
                  access: Own Data
    400CreateAccessManagementValidationErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        statusCode:
          type: integer
          example: 400
        statusMessage:
          type: string
          example: Failed to create a new access role
        data:
          nullable: true
          example: null
        error:
          type: object
          properties:
            message:
              type: string
              example: Request body is not valid
            code:
              type: string
              example: REQUEST_VALIDATION_FAILED
            details:
              type: array
              items:
                type: object
                properties:
                  path:
                    type: array
                    items:
                      type: string
                    example:
                      - roleName
                  message:
                    type: string
                    example: roleName is required
    409CreateAccessManagementDuplicateRoleErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        statusCode:
          type: integer
          example: 409
        statusMessage:
          type: string
          example: A role with this name already exists. Try using a unique role name.
        data:
          nullable: true
          example: null
        error:
          type: object
          properties:
            message:
              type: string
              example: >-
                A role with this name already exists in your organization.
                Please choose a different name.
            code:
              type: string
              example: DUPLICATE_ROLE_NAME
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        statusCode:
          type: integer
          format: int32
          example: 401
        statusMessage:
          type: string
          example: Authentication failed
        data:
          nullable: true
          example: null
        error:
          type: object
          properties:
            message:
              type: string
              example: Authorization header is missing
            code:
              type: string
              enum:
                - AUTHORIZATION_HEADER_MISSING
                - INVALID_API_KEY_SCHEMA
                - API_KEY_MISSING
                - INVALID_API_KEY
                - PLAN_EXPIRED
              example: AUTHORIZATION_HEADER_MISSING
    InternalServerError:
      allOf:
        - $ref: '#/components/schemas/BaseError'
        - type: object
          properties:
            statusCode:
              example: 500
            statusMessage:
              example: Internal server error
            error:
              type: object
              properties:
                message:
                  example: Some technical error has occurred !!
                code:
                  example: UNKNOWN_SERVER_ERROR
    BaseError:
      type: object
      properties:
        success:
          type: boolean
          example: false
        statusCode:
          type: integer
        statusMessage:
          type: string
        data:
          nullable: true
          example: null
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
  responses:
    UnauthorizedError:
      description: Authentication & Authorization errors
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            authorizationHeaderMissing:
              summary: Authorization header missing
              value:
                success: false
                statusCode: 401
                statusMessage: Authentication token header is missing
                data: null
                error:
                  message: Authorization header is missing
                  code: AUTHORIZATION_HEADER_MISSING
            invalidAuthorizationScheme:
              summary: Invalid authorization scheme
              value:
                success: false
                statusCode: 401
                statusMessage: Invalid authentication token schema
                data: null
                error:
                  message: Authorization header must start with 'Bearer'
                  code: INVALID_API_KEY_SCHEMA
            apiKeyMissing:
              summary: API key missing
              value:
                success: false
                statusCode: 401
                statusMessage: Authentication token is missing
                data: null
                error:
                  message: API key value is missing
                  code: API_KEY_MISSING
            invalidApiKey:
              summary: Invalid or inactive API key
              value:
                success: false
                statusCode: 401
                statusMessage: Authentication failed
                data: null
                error:
                  message: Provided API key is invalid or inactive
                  code: INVALID_API_KEY
            planExpired:
              summary: Upgrade required
              value:
                success: false
                statusCode: 401
                statusMessage: Upgrade required
                data: null
                error:
                  message: Upgrade required to use Trackpilots APIs
                  code: PLAN_EXPIRED
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InternalServerError'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````