> ## 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 Project

> Add a user to a project 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.

Requirements:
- Requires FULL_ACCESS on the project
- Cannot set project permissions for workspace owners (they always have full access)
- If the user doesn't have workspace access, auto-creates member_limited workspace permission

Role must be a valid project role: full_access, editor, commenter, downloader, viewer



## OpenAPI

````yaml /api-reference/openapi.json post /projects/{project_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:
  /projects/{project_id}/users:
    post:
      tags:
        - Projects
      summary: Add User To Project
      description: >-
        Add a user to a project 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.


        Requirements:

        - Requires FULL_ACCESS on the project

        - Cannot set project permissions for workspace owners (they always have
        full access)

        - If the user doesn't have workspace access, auto-creates member_limited
        workspace permission


        Role must be a valid project role: full_access, editor, commenter,
        downloader, viewer
      operationId: post_Projects_projects_project_id_users
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Project Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProjectAddUserRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectUserResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ProjectAddUserRequest:
      properties:
        email:
          type: string
          title: Email
          description: Email of the user to add to project
        role:
          $ref: '#/components/schemas/ResourceRole'
          description: >-
            Role to assign to the user (must be a project role: full_access,
            editor, commenter, downloader, viewer; no_access only valid for
            MEMBER users)
          default: editor
      type: object
      required:
        - email
      title: ProjectAddUserRequest
      description: >-
        API request schema for adding a user to a project.


        If the email belongs to an unregistered user, a stub user will be
        created.


        Note: NO_ACCESS role is only valid for MEMBER users (to block their
        default access).

        For MEMBER_LIMITED users, NO_ACCESS is invalid since they already have
        no access

        without explicit permission. This constraint is enforced at the route
        handler level.
    ProjectUserResponse:
      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 effective role on this project
        actions:
          type: integer
          title: Actions
          description: Permission bitmap derived from role
        workspace_role:
          $ref: '#/components/schemas/ResourceRole'
          description: User's workspace role (for determining editability)
        has_explicit_permission:
          type: boolean
          title: Has Explicit Permission
          description: True if user has explicit permission on this project
      type: object
      required:
        - id
        - first_name
        - last_name
        - email
        - role
        - actions
        - workspace_role
        - has_explicit_permission
      title: ProjectUserResponse
      description: API response schema for a user with project access.
    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.

````