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

# Benutzer erstellen

> Erstellt einen aktiven Unternehmensbenutzer und sendet eine E-Mail zur Anmeldung. Erfordert `auth.add_user` und einen verfügbaren Benutzerplatz. Optional entweder role_id oder role_name angeben, niemals beide. Rollenzuweisung erfordert einen Tarif mit Rollen; Admin kann nicht zugewiesen werden, und der Aufrufer muss alle Berechtigungen der gewählten Rolle besitzen. Doppelte E-Mail-Adressen oder Benutzerlimits führen zu 409.



## OpenAPI

````yaml /de/api-reference/openapi.json post /users
openapi: 3.0.0
info:
  title: Corgea API
  version: 1.0.0
  description: >-
    API für die Interaktion mit den Scan- und
    Schwachstellenmanagement-Funktionen von Corgea
servers:
  - url: https://www.corgea.app/api/v1
    description: Produktionsserver
  - url: https://eu.corgea.app/api/v1
    description: EU-Produktionsserver
security:
  - CorgeaToken: []
  - BearerAuth: []
paths:
  /users:
    post:
      tags:
        - Users
      summary: Benutzer erstellen
      description: >-
        Erstellt einen aktiven Unternehmensbenutzer und sendet eine E-Mail zur
        Anmeldung. Erfordert `auth.add_user` und einen verfügbaren
        Benutzerplatz. Optional entweder role_id oder role_name angeben, niemals
        beide. Rollenzuweisung erfordert einen Tarif mit Rollen; Admin kann
        nicht zugewiesen werden, und der Aufrufer muss alle Berechtigungen der
        gewählten Rolle besitzen. Doppelte E-Mail-Adressen oder Benutzerlimits
        führen zu 409.
      operationId: createUser
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserRequest'
      responses:
        '201':
          description: Anfrage erfolgreich abgeschlossen
          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: Ungültiger Request
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Invalid JSON body
    Unauthorized:
      description: Ungültiges oder fehlendes Token
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Missing or invalid authorization header
    Forbidden:
      description: Zugriff verweigert oder Feature nicht verfügbar
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Permission denied
    Conflict:
      description: Request steht im Konflikt mit einer vorhandenen Ressource
      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 für die Authentifizierung API-Tokens inaktiver Benutzer werden
        abgelehnt.
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: OAuth2-Access-Token (JWT) im Authorization-Header

````

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