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

# Add an existing AcornOps user as a workspace member



## OpenAPI

````yaml /openapi/control-plane-public.json post /api/v1/workspaces/{workspaceId}/members
openapi: 3.1.0
info:
  title: AcornOps Control Plane API
  version: 0.0.1-experimental.1
  description: >-
    Control plane API for workspaces, targets, Kubernetes clusters, virtual
    machines, sessions, runs, auth, and internal execution wiring.
servers:
  - url: https://api.acornops.dev
security: []
tags:
  - name: health
    description: Health and readiness endpoints.
  - name: auth
    description: >-
      OIDC, password, browser session, and external integration account link
      endpoints.
  - name: workspaces
    description: Workspace, target, Kubernetes cluster, and VM management endpoints.
  - name: webhooks
    description: >-
      Durable webhook subscriptions, lifecycle-aware delivery, and attempt
      history.
  - name: sessions
    description: Session and message endpoints.
  - name: runs
    description: Run query, cancel, and stream endpoints.
  - name: workflows
    description: >-
      Workspace workflow definitions, schedules, sessions, and approval inbox
      endpoints.
  - name: catalog
    description: >-
      MCP registries, destination-bound browsing, scoped MCP imports, and
      credential connections.
  - name: agents
    description: >-
      Workspace-scoped Agent definitions, direct conversations, tests, and
      activity.
  - name: admin
    description: Operator-only admin API protected exclusively by admin bearer tokens.
  - name: internal
    description: Internal execution endpoints for execution-engine.
paths:
  /api/v1/workspaces/{workspaceId}/members:
    post:
      tags:
        - workspaces
      summary: Add an existing AcornOps user as a workspace member
      parameters:
        - $ref: '#/components/parameters/PathWorkspaceId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - userId
                - email
                - role
              properties:
                userId:
                  type: string
                  format: uuid
                email:
                  type: string
                  format: email
                  maxLength: 320
                role:
                  type: string
                  pattern: ^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$
                  description: >-
                    Deployment-supported workspace role key. Built-ins are
                    owner, admin, operator, viewer, and auditor; custom roles
                    are lowercase snake_case.
      responses:
        '201':
          description: >-
            Workspace member added. Response includes roleTemplate when the role
            is supported.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceMember'
        '400':
          description: >-
            ROLE_NOT_SUPPORTED when the role key is not in the
            deployment-supported catalog.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          description: >-
            Requires manage_members. MEMBER_DISCOVERY_DISABLED is returned when
            direct existing-user addition is disabled.
            PROTECTED_ROLE_REQUIRES_OWNER is returned when a non-owner assigns a
            protected role.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: >-
            Existing eligible user not found, including when userId and email do
            not identify the same user.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            User is already a member, has a pending invitation, user
            workspace-membership quota exceeded, or workspace member quota
            exceeded. Quota failures return QUOTA_EXCEEDED with
            quotaKey=workspaceMemberships or workspaceMembers.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
      security:
        - userSession: []
components:
  parameters:
    PathWorkspaceId:
      in: path
      name: workspaceId
      required: true
      schema:
        type: string
        format: uuid
        example: 4b930d98-add9-4924-ab26-3c16d96ec373
  schemas:
    WorkspaceMember:
      type: object
      required:
        - workspaceId
        - userId
        - role
      properties:
        workspaceId:
          type: string
          format: uuid
        userId:
          type: string
          format: uuid
        email:
          type: string
          format: email
        displayName:
          type: string
        role:
          type: string
        roleTemplate:
          $ref: '#/components/schemas/WorkspaceRoleTemplate'
        joinedAt:
          type: string
          format: date-time
      additionalProperties: true
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            retryable:
              type: boolean
            details:
              type: object
              additionalProperties: true
              description: Optional structured error details.
    WorkspaceRoleTemplate:
      type: object
      required:
        - key
        - displayName
        - kind
        - capabilities
        - capabilityGroups
        - protected
        - sortOrder
      properties:
        key:
          type: string
        displayName:
          type: string
        description:
          type: string
        kind:
          type: string
          enum:
            - system
            - custom
        capabilities:
          type: array
          items:
            type: string
        capabilityGroups:
          type: array
          items:
            $ref: '#/components/schemas/WorkspaceRoleCapabilityGroup'
        protected:
          type: boolean
        sortOrder:
          type: integer
      additionalProperties: true
    WorkspaceRoleCapabilityGroup:
      type: object
      required:
        - key
        - capabilities
        - sortOrder
      properties:
        key:
          type: string
          enum:
            - workspace
            - members
            - targets
            - operations
            - settings
        capabilities:
          type: array
          items:
            type: string
        sortOrder:
          type: integer
      additionalProperties: true
  responses:
    Error401:
      description: Error response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Error429:
      description: Error response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Error500:
      description: Error response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    userSession:
      type: apiKey
      in: cookie
      name: acornops_cp_session

````