# Create a new user or add existing user to new client accounts

Endpoint: POST /users
Version: 1.0
Security: bearer

## Security:

  - `bearer` (unknown)
    http bearer JWT

## Request fields (application/json):

  - `email` (string, required)
    The email of the user
    Example: john.doe@example.com

  - `isEnabled` (boolean)
    The enabled status of the user
    Example: true

  - `isAdmin` (boolean)
    Indicates if the user is an admin
    Example: true

  - `organizationId` (number)
    The organization ID
    Example: 1

  - `brandId` (number)
    The brand ID
    Example: 1

  - `siteId` (number)
    The site ID
    Example: 1

  - `role` (string, required)
    The role of the user
    Enum: "ORGANIZATION_USER", "BRAND_USER", "SITE_USER", "CLIENT_ACCOUNT_USER", "SITE_MANAGER_USER"

  - `clientAccountId` (array)
    List of client account IDs
    Example: [1,2,3]

## Response 201:

  - `201` (unknown)
    The user has been successfully created or added to new client accounts.

## Response 400:

  - `400` (unknown)
    Bad request: Invalid parameters or user already associated with all requested client accounts.

## Response 401:

  - `401` (unknown)
    Unauthorized: Invalid or missing token.

## Response 401 fields (application/json):

  - `message` (string, required)
    Error message indicating unauthorized access.
    Example: Unauthorized

  - `statusCode` (number, required)
    HTTP status code for unauthorized access.
    Example: 401

## Response 403:

  - `403` (unknown)
    Forbidden: Access denied due to unaccepted Terms or insufficient permissions.

## Response 403 fields (application/json):

  - `statusCode` (number, required)
    HTTP status code indicating forbidden access due to unaccepted Terms of Service.
    Example: 403

  - `message` (string, required)
    Human-readable explanation of the error.
    Example: User must accept Terms of Service before continuing

  - `reason` (string, required)
    Machine-readable reason code for the error.
    Example: tos_required

  - `termsOfServicesLink` (string, required)
    URL to the Terms of Service the user must accept.
    Example: https://heydonto.com/terms-of-use/

  - `timestamp` (string, required)
    Timestamp when the error occurred (ISO 8601).
    Example: 2025-01-01T00:00:00.000Z

  - `statusCode` (number, required)
    HTTP status code indicating forbidden access.
    Example: 403

