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

# Login User

> Request OTP for a user



## OpenAPI

````yaml POST /auth/login
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/login:
    post:
      description: Request OTP for a user
      parameters:
        - $ref: '#/components/parameters/X-API-KEY'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UsernameOrEmailRequest'
      responses:
        '202':
          description: OTP code successfully sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RegisterResponse'
        '208':
          description: >-
            Already Reported - OTP can only be requested after the previously
            sent code has expired
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OTPExpirationResponse'
        '400':
          description: >-
            Bad Request - SMS OTP failed or no valid contact information
            provided
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found - No user found with the username/email
          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:
    UsernameOrEmailRequest:
      type: object
      properties:
        usernameOrEmail:
          type: string
          description: Username or email address of the user
      required:
        - usernameOrEmail
    RegisterResponse:
      type: object
      properties:
        message:
          type: string
          description: Response message
        userId:
          type: integer
          description: User ID of the newly created or updated user
    OTPExpirationResponse:
      type: object
      properties:
        message:
          type: string
          description: Response message
        codeExpiredAt:
          type: string
          format: date-time
          description: Expiration date and time of the OTP code
        userId:
          type: integer
          description: User ID
    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

````