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

# Create user

> Creates an active company user and sends a welcome sign-in email. Requires `auth.add_user` and an available user seat. Optionally supply either role_id or role_name, never both. Role assignment requires a plan supporting roles; Admin cannot be assigned, and the caller must hold every permission in the selected role. Duplicate email or user limits return 409.



## OpenAPI

````yaml /api-reference/openapi.json post /users
openapi: 3.0.0
info:
  title: Corgea API
  version: 1.0.0
  description: >-
    API for interacting with Corgea's scanning and vulnerability management
    features
servers:
  - url: https://www.corgea.app/api/v1
    description: Production server
  - url: https://eu.corgea.app/api/v1
    description: EU production server
security:
  - CorgeaToken: []
  - BearerAuth: []
paths:
  /users:
    post:
      tags:
        - Users
      summary: Create user
      description: >-
        Creates an active company user and sends a welcome sign-in email.
        Requires `auth.add_user` and an available user seat. Optionally supply
        either role_id or role_name, never both. Role assignment requires a plan
        supporting roles; Admin cannot be assigned, and the caller must hold
        every permission in the selected role. Duplicate email or user limits
        return 409.
      operationId: createUser
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserRequest'
      responses:
        '201':
          description: Request completed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  user:
                    $ref: '#/components/schemas/CompanyUser'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
components:
  schemas:
    CreateUserRequest:
      type: object
      properties:
        email:
          type: string
          format: email
        first_name:
          type: string
          minLength: 1
          maxLength: 150
        last_name:
          type: string
          minLength: 1
          maxLength: 150
        role_id:
          type: integer
        role_name:
          type: string
      required:
        - email
        - first_name
        - last_name
      additionalProperties: false
    CompanyUser:
      type: object
      properties:
        id:
          type: integer
        email:
          type: string
          format: email
        first_name:
          type: string
        last_name:
          type: string
        active:
          type: boolean
        roles:
          type: array
          items:
            $ref: '#/components/schemas/UserRole'
        created_at:
          type: string
          format: date-time
    UserRole:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Invalid JSON body
    Unauthorized:
      description: Invalid or missing token
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Missing or invalid authorization header
    Forbidden:
      description: Permission denied or feature unavailable
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Permission denied
    Conflict:
      description: Request conflicts with an existing resource
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: A policy with this name already exists
  securitySchemes:
    CorgeaToken:
      type: apiKey
      in: header
      name: CORGEA-TOKEN
      description: >-
        API key for authentication API tokens belonging to inactive users are
        rejected.
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: OAuth2 access token (JWT) in the Authorization header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.