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

# Create a new user record

> Creates a new encrypted user record. Databunker extracts `login`, `phone`, and `email` from the request
and builds hashed indexes for lookup. These values must be unique across all users.




## OpenAPI

````yaml /oss/api/openapi.yml post /v1/user
openapi: 3.0.3
info:
  title: Databunker API
  description: >
    Databunker is a super-fast, open-source vault built with Go for secure
    storage of sensitive personal records.


    ## Authentication

    All API requests require authentication using the `X-Bunker-Token` header.
    This token is your root access token.


    ## Content Types

    The API supports the following content types for POST and PUT requests:

    - `application/json`

    - `application/x-www-form-urlencoded`


    ## User Tokens

    Keep the user `{token}` generated by Databunker private, as it serves as an
    additional user identifier.

    Under GDPR, this user token is referred to as a pseudonymized identity.


    For more details, visit: https://databunker.org/
  version: 1.0.0
  contact:
    name: Databunker Support
    url: https://databunker.com
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: http://localhost:3000
    description: Local development server
security:
  - ApiKeyAuth: []
tags:
  - name: User
    description: User personal information management
  - name: User App
    description: Additional user application data
  - name: Session
    description: Secure session storage
  - name: Consent
    description: User consent management
  - name: Agreement
    description: Agreement management
  - name: Request
    description: User privacy requests (GDPR)
  - name: Audit
    description: Audit log access
  - name: Expiration
    description: Data expiration and retention
  - name: System
    description: System administration
paths:
  /v1/user:
    post:
      tags:
        - User
      summary: Create a new user record
      description: >
        Creates a new encrypted user record. Databunker extracts `login`,
        `phone`, and `email` from the request

        and builds hashed indexes for lookup. These values must be unique across
        all users.
      operationId: createUser
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserCreate'
            examples:
              basic:
                summary: Basic user creation
                value:
                  firstName: John
                  lastName: Doe
                  email: user@example.com
                  login: john
              withPhone:
                summary: User with phone number
                value:
                  first: John
                  last: Doe
                  email: user@example.com
                  login: john
                  phone: +1-415-555-0123
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/UserCreate'
      responses:
        '200':
          description: User created successfully
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessResponse'
                  - type: object
                    properties:
                      token:
                        type: string
                        format: uuid
                        description: Unique user token (pseudonymized identity)
              examples:
                success:
                  value:
                    status: ok
                    token: db80789b-0ad7-0690-035a-fd2c42531e87
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/Conflict'
components:
  schemas:
    UserCreate:
      type: object
      properties:
        email:
          type: string
          format: email
          description: User email (unique, creates search index)
        phone:
          type: string
          description: User phone number (unique, creates search index)
        login:
          type: string
          description: User login name (unique, creates search index)
        firstName:
          type: string
          description: User first name
        first:
          type: string
          description: Alternative field for first name
        lastName:
          type: string
          description: User last name
        last:
          type: string
          description: Alternative field for last name
      additionalProperties: true
      description: >
        User data can contain any additional fields. The email, phone, and login
        fields

        are extracted and indexed for lookup. At least one indexed field is
        recommended.
    SuccessResponse:
      type: object
      required:
        - status
      properties:
        status:
          type: string
          enum:
            - ok
          example: ok
    ErrorResponse:
      type: object
      required:
        - status
        - message
      properties:
        status:
          type: string
          enum:
            - error
          example: error
        message:
          type: string
          description: Error description
  responses:
    BadRequest:
      description: Bad request - invalid input
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            duplicate:
              summary: Duplicate user
              value:
                status: error
                message: user with this email already exists
    Unauthorized:
      description: Unauthorized - invalid or missing token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missing:
              summary: Missing token
              value:
                status: error
                message: missing X-Bunker-Token header
    Conflict:
      description: Conflict - resource already exists
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Bunker-Token
      description: Root access token for Databunker API

````