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

# Create User

> Creates a new user with the specified project_user_id

## Overview

Creates a new user with the specified `project_user_id`. This endpoint allows you to register users in your project and optionally set their properties.

## Authentication

This endpoint requires authentication via the following HTTP headers:

* `X-Clix-Project-ID`: Your project ID
* `X-Clix-API-Key`: Your Clix Secret API Key

## Request Body

| Field             | Type   | Required | Description                                                                             |
| ----------------- | ------ | -------- | --------------------------------------------------------------------------------------- |
| `project_user_id` | string | Yes      | Unique identifier for the user in your project                                          |
| `properties`      | object | No       | User properties as key-value pairs where values can be string, number, boolean, or null |

## Example Request

```json theme={null}
{
  "project_user_id": "clix_user",
  "properties": {
    "email": "user@example.com",
    "age": 25,
    "premium": true,
    "subscription_tier": "gold"
  }
}
```

## Response

### Success Response (200 OK)

Returns the created user properties:

```json theme={null}
{
  "properties": {
    "email": "user@example.com",
    "age": 25,
    "premium": true,
    "subscription_tier": "gold"
  }
}
```

### Error Responses

#### 400 Bad Request

Returned when:

* `project_user_id` is missing or invalid
* Request body is malformed

Returns a plain text error message:

```
Project User Id must be provided
```

#### 401 Unauthorized

Authentication failed or invalid API key.

## Notes

* The `project_user_id` must be unique within your project
* If a user with the same `project_user_id` already exists, this endpoint will update the existing user's properties
* User properties are optional but recommended for personalization and segmentation
* The response returns only the properties object, not the full user object


## OpenAPI

````yaml POST /api/v1/users
openapi: 3.1.0
info:
  title: clix/external/v1/clix.proto
  version: version not set
servers:
  - url: https://api.clix.so
security:
  - ProjectIdAuth: []
    ApiKeyAuth: []
tags:
  - name: ClixExternalService
paths:
  /api/v1/users:
    post:
      tags:
        - ClixExternalService
      summary: Create a new user
      description: Creates a new user with the specified project_user_id
      operationId: ClixExternalService_CreateUser
      requestBody:
        required: true
        description: User data to create
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/v1CreateUserRequest'
      responses:
        '200':
          description: User created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1CreateUserResponse'
        '400':
          description: Bad request - invalid or missing parameters
          content:
            text/plain:
              schema:
                type: string
                example: Project User Id must be provided
components:
  schemas:
    v1CreateUserRequest:
      type: object
      description: Request to create a new user
      properties:
        project_user_id:
          type: string
          description: Unique identifier for the user in your project
        properties:
          type: object
          description: User properties as key-value pairs
          additionalProperties: true
      required:
        - project_user_id
    v1CreateUserResponse:
      type: object
      description: Response containing the created user properties
      properties:
        properties:
          type: object
          description: User properties as key-value pairs
          additionalProperties: true
  securitySchemes:
    ProjectIdAuth:
      type: apiKey
      in: header
      name: X-Clix-Project-ID
      description: Project ID for authentication
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Clix-API-Key
      description: API Key for authentication

````