# Update Settings

**Endpoint**

`POST/v2/messages/settings`

**Link**

{% embed url="<https://stagep.tst-apidmndelss.com/openapi/v2.html#/operations/Messages_UpdateSettings>" %}

### **Request**

#### **Headers**

| Key             | Value              | Required |
| --------------- | ------------------ | -------- |
| `Authorization` | `Bearer <JWT>`     | Yes      |
| `Content-Type`  | `application/json` | Yes      |
| `Accept`        | `application/json` | Yes      |

#### **Request Body (JSON)**

All fields are optional - only include the settings you want to update.

| Field               | Type      | Description                          | Required | Example                       |
| ------------------- | --------- | ------------------------------------ | -------- | ----------------------------- |
| **`settings`**      | `object`  | Configuration settings object.       | Yes      | -                             |
| → **`common`**      | `object`  | Common application settings.         | No       | -                             |
| → → `enabled`       | `boolean` | System status. `true` = operational. | No       | `true`                        |
| → → `appHostname`   | `string`  | Backend API hostname.                | No       | `"api.paymentsystem.com"`     |
| → → `frontHostname` | `string`  | Frontend application hostname.       | No       | `"app.paymentsystem.com"`     |
| → → `frontName`     | `string`  | Frontend display name.               | No       | `"Payment Portal"`            |
| → → `companyName`   | `string`  | Company legal name.                  | No       | `"Acme Payments Inc."`        |
| → → `companyPhone`  | `string`  | Company support phone.               | No       | `"+1-800-123-4567"`           |
| → **`email`**       | `object`  | Email service settings.              | No       | -                             |
| → → `enabled`       | `boolean` | Email service status.                | No       | `true`                        |
| → → `emailAccount`  | `string`  | SMTP email account.                  | No       | `"noreply@paymentsystem.com"` |
| → → `emailPassword` | `string`  | SMTP account password.               | No       | `"securepassword123"`         |
| → → `smtpHost`      | `string`  | SMTP server hostname.                | No       | `"smtp.gmail.com"`            |
| → → `smtpPort`      | `integer` | SMTP server port.                    | No       | `587`                         |

**Example Request Body (Partial Update):**

json

```
{
  "settings": {
    "common": {
      "companyName": "New Company Name Inc.",
      "companyPhone": "+1-888-999-0000"
    },
    "email": {
      "smtpHost": "smtp.mailprovider.com",
      "smtpPort": 465
    }
  }
}
```

**Example Request Body (Full Update):**

json

```
{
  "settings": {
    "common": {
      "enabled": true,
      "appHostname": "api.paymentsystem.com",
      "frontHostname": "app.paymentsystem.com",
      "frontName": "Payment Portal",
      "companyName": "Acme Payments Inc.",
      "companyPhone": "+1-800-123-4567"
    },
    "email": {
      "enabled": true,
      "emailAccount": "noreply@paymentsystem.com",
      "emailPassword": "securepassword123",
      "smtpHost": "smtp.gmail.com",
      "smtpPort": 587
    }
  }
}
```

***

### **Response (200 OK)**

Returns the updated system configuration settings.

#### **Response Fields**

Same structure as the request body, showing all current settings after update.

**Example Response:**

json

```
{
  "settings": {
    "common": {
      "enabled": true,
      "appHostname": "api.paymentsystem.com",
      "frontHostname": "app.paymentsystem.com",
      "frontName": "Payment Portal",
      "companyName": "New Company Name Inc.",
      "companyPhone": "+1-888-999-0000"
    },
    "email": {
      "enabled": true,
      "emailAccount": "noreply@paymentsystem.com",
      "emailPassword": "********",
      "smtpHost": "smtp.mailprovider.com",
      "smtpPort": 465
    }
  }
}
```

***

### **Examples**

#### **Request (Enable Maintenance Mode)**

bash

```
curl -X POST 'https://stagep.tst-apidmndelss.com/v2/messages/settings' \
  -H 'Authorization: Bearer eyJhbGci...wNLGA' \
  -H 'Content-Type: application/json' \
  -d '{
    "settings": {
      "common": {
        "enabled": false
      }
    }
  }'
```

#### **Request (Update Email Settings)**

bash

```
curl -X POST 'https://stagep.tst-apidmndelss.com/v2/messages/settings' \
  -H 'Authorization: Bearer eyJhbGci...wNLGA' \
  -H 'Content-Type: application/json' \
  -d '{
    "settings": {
      "email": {
        "smtpHost": "smtp.office365.com",
        "smtpPort": 587,
        "emailAccount": "notifications@company.com"
      }
    }
  }'
```

***

### **Error Responses**

1. **Invalid SMTP Configuration**:

   json

   ```
   { "error": "SMTP connection failed: Authentication required" }
   ```
2. **Invalid Hostname**:

   json

   ```
   { "error": "Invalid hostname format" }
   ```
3. **Unauthorized**:

   json

   ```
   { "error": "Unauthorized" }
   ```

***

### **Notes**

* **Partial Updates**: Only included fields are modified; omitted fields remain unchanged.
* **Password Masking**: Response may mask passwords for security (`********`).
* **Validation**: Settings are validated before application (e.g., SMTP connection test).
* **Immediate Effect**: Changes typically take effect immediately.

**Best Practices**:

* Test email settings before updating in production
* Use maintenance mode for system updates
* Keep hostnames consistent with SSL certificates


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.delos.financial/messages/update-settings.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
