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

# Register User

> Register a new user



## OpenAPI

````yaml POST /auth/register
openapi: 3.0.1
info:
  title: User Authentication API
  version: 1.0.0
  description: API for user registration, OTP request, and OTP verification
servers:
  - url: https://our-secret-api-url.com
security: []
paths:
  /auth/register:
    post:
      description: Register a new user
      parameters:
        - $ref: '#/components/parameters/X-API-KEY'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserRegistrationRequest'
      responses:
        '201':
          description: OTP code successfully sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RegisterResponse'
        '400':
          description: >-
            Bad Request - No valid contact information provided or SMS OTP
            failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            Conflict - User with the same username/email/phone has been
            registered
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable Entity - Validation errors
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  parameters:
    X-API-KEY:
      name: X-API-KEY
      description: API key required for authentication
      in: header
      required: true
      schema:
        type: string
  schemas:
    UserRegistrationRequest:
      type: object
      properties:
        name:
          type: string
          description: Name of the user
        username:
          type: string
          description: Username of the user
        email:
          type: string
          description: Email address of the user
          nullable: true
        phone:
          type: string
          description: Phone number of the user
          nullable: true
      required:
        - name
        - username
    RegisterResponse:
      type: object
      properties:
        message:
          type: string
          description: Response message
        userId:
          type: integer
          description: User ID of the newly created or updated user
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: Error message
        errors:
          type: array
          items:
            type: object
            properties:
              path:
                type: string
                description: Path of the error
              message:
                type: string
                description: Error message

````