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

# Update SMTP configuration

> Create or update SMTP email configuration (admin only).
When `enabled` is true, the fields `host`, `username`, `senderEmail`, and `senderName` are required by the backend validation.
When `enabled` is false, these fields may be empty.




## OpenAPI

````yaml https://raw.githubusercontent.com/InsForge/InsForge/main/openapi/auth.yaml put /api/auth/smtp-config
openapi: 3.0.3
info:
  title: Insforge Authentication API
  version: 2.0.0
  description: Authentication endpoints with separated auth and profile tables
servers: []
security: []
paths:
  /api/auth/smtp-config:
    put:
      tags:
        - Admin
      summary: Update SMTP configuration
      description: >
        Create or update SMTP email configuration (admin only).

        When `enabled` is true, the fields `host`, `username`, `senderEmail`,
        and `senderName` are required by the backend validation.

        When `enabled` is false, these fields may be empty.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - enabled
                - port
              properties:
                enabled:
                  type: boolean
                  description: >-
                    When true, host/username/senderEmail/senderName become
                    required
                host:
                  type: string
                  description: Required when enabled is true
                port:
                  type: integer
                  enum:
                    - 25
                    - 465
                    - 587
                    - 2525
                username:
                  type: string
                  description: Required when enabled is true
                password:
                  type: string
                  description: SMTP password (optional on update if unchanged)
                senderEmail:
                  type: string
                  format: email
                  description: Required when enabled is true
                senderName:
                  type: string
                  description: Required when enabled is true
                minIntervalSeconds:
                  type: integer
                  minimum: 0
                  default: 60
                  description: Minimum interval between emails in seconds
      responses:
        '200':
          description: SMTP configuration updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SmtpConfig'
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
        '403':
          description: Forbidden - Admin only
      security:
        - bearerAuth: []
components:
  schemas:
    SmtpConfig:
      type: object
      properties:
        id:
          type: string
          format: uuid
        enabled:
          type: boolean
        host:
          type: string
        port:
          type: integer
        username:
          type: string
        hasPassword:
          type: boolean
          description: Whether a password is set (actual password is never exposed)
        senderEmail:
          type: string
          format: email
        senderName:
          type: string
        minIntervalSeconds:
          type: integer
          minimum: 0
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````