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

# Add User To Workspace

> Add a user to a workspace with the specified role.

If the user doesn't exist, a stub user is created with the email.
Stub users have external_id=None until they sign up.

Only workspace owners (ADMIN) can add users to a workspace.
Role must be a valid workspace role: owner, member, or member_limited.



## OpenAPI

````yaml /api-reference/openapi.json post /workspaces/{workspace_id}/users
openapi: 3.1.0
info:
  title: Aspect Platform API
  description: A FastAPI application for Aspect Platform functionality
  version: 0.0.0
servers:
  - url: https://api.aspect.inc
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /workspaces/{workspace_id}/users:
    post:
      tags:
        - Workspaces
      summary: Add User To Workspace
      description: |-
        Add a user to a workspace with the specified role.

        If the user doesn't exist, a stub user is created with the email.
        Stub users have external_id=None until they sign up.

        Only workspace owners (ADMIN) can add users to a workspace.
        Role must be a valid workspace role: owner, member, or member_limited.
      operationId: post_Workspaces_workspaces_workspace_id_users
      parameters:
        - name: workspace_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Workspace Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkspaceAddUserRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceUserResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    WorkspaceAddUserRequest:
      properties:
        email:
          type: string
          title: Email
          description: Email of the user to add to workspace
        role:
          $ref: '#/components/schemas/ResourceRole'
          description: >-
            Role to assign to the user (must be a workspace role: owner, member,
            member_limited)
          default: member
      type: object
      required:
        - email
      title: WorkspaceAddUserRequest
      description: >-
        API request schema for adding a user to a workspace. If the email
        belongs to an unregistered user, a stub user will be created.
    WorkspaceUserResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: User ID
        first_name:
          type: string
          title: First Name
          description: User's first name
        last_name:
          type: string
          title: Last Name
          description: User's last name
        email:
          type: string
          title: Email
          description: User's email address
        avatar_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Avatar Url
          description: User's avatar URL
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
          description: External user ID from auth provider (None for stub users)
        role:
          $ref: '#/components/schemas/ResourceRole'
          description: User's workspace role
        actions:
          type: integer
          title: Actions
          description: Permission bitmap derived from role
        explicit_permission_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Explicit Permission Count
          description: Count of explicit project permissions in the workspace
        accessible_project_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Accessible Project Count
          description: Count of accessible projects (MEMBER users only)
      type: object
      required:
        - id
        - first_name
        - last_name
        - email
        - role
        - actions
      title: WorkspaceUserResponse
      description: API response schema for a workspace user.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ResourceRole:
      type: string
      enum:
        - owner
        - member
        - member_limited
        - full_access
        - editor
        - commenter
        - downloader
        - viewer
        - no_access
      title: ResourceRole
      description: |-
        Unified role enum for both workspace and project permissions.
        Stored as PostgreSQL ENUM type 'resourcerole' in database.

        Pattern follows existing enums like AssetType:
        - Python enum: ResourceRole.OWNER = "owner" (lowercase value)
        - PostgreSQL ENUM: 'OWNER', 'MEMBER', etc. (uppercase in DB)
        - SQLAlchemy: sa.Enum('OWNER', 'MEMBER', ..., name='resourcerole')
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT in Authorization header. 'Bearer ' prefix optional.
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Aspect API key (sk_...) in Authorization header. 'Bearer ' optional.

````