> ## Content Index
> Fetch the complete content index at: https://blog.fabrixly.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Use Communication Template Configuration APIs
- URL: https://blog.fabrixly.com/how-to-use-communication-template-configuration-apis/
- Published: 2026-07-07T14:10:47.000Z
- Updated: 2026-07-07T14:10:47.000Z
- Author: Fabrixly
- Tags: Documentation

This guide describes how to configure SMTP/SMS providers and manage templates dynamically using the REST APIs.

---

## 🔐 Authentication & Prerequisites

All configuration and template endpoints require administrative authentication. Include the administrator's token: `Authorization: Bearer <your-admin-jwt-token>`

---

## Part A: SMTP & SMS Config APIs

### 1\. Retrieve Global SMTP Settings

Retrieve active SMTP provider settings (host, port, user credentials).

- **HTTP Method**: `GET`
- **Path**: `/api/system/email-config`

#### Example Request (curl)

```bash
curl -X GET https://ids.fabrixly.com/api/system/email-config \
  -H "Authorization: Bearer <your-admin-jwt-token>"

```

---

### 2\. Update Global SMTP Settings

- **HTTP Method**: `PUT`
- **Path**: `/api/system/email-config`

#### Example Request (curl)

```bash
curl -X PUT https://ids.fabrixly.com/api/system/email-config \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-admin-jwt-token>" \
  -d '{
    "email_provider": "smtp",
    "email_config": {
      "host": "smtp.example.com",
      "port": 587,
      "user": "smtp-username",
      "pass": "smtp-password",
      "from": "noreply@fabrixly.com"
    }
  }'

```

---

### 3\. Update Client-Specific SMTP Settings

Set a custom email config specifically for an OIDC client application.

- **HTTP Method**: `PUT`
- **Path**: `/api/clients/:clientId/email-config`

#### Example Request (curl)

```bash
curl -X PUT https://ids.fabrixly.com/api/clients/cli_abc123/email-config \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-admin-jwt-token>" \
  -d '{
    "host": "smtp.customclient.com",
    "port": 465,
    "user": "client-smtp-user",
    "pass": "client-smtp-password"
  }'

```

---

## Part B: Templates Management APIs

Allows templates for emails or SMS messages to be customized per-client or system-wide.

### 1\. Create a System Template

Creates a new custom email template at the system level.

- **HTTP Method**: `POST`
- **Path**: `/api/system/templates/email`

#### Example Request (curl)

```bash
curl -X POST https://ids.fabrixly.com/api/system/templates/email \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-admin-jwt-token>" \
  -d '{
    "name": "User Invitation Email",
    "subject": "You have been invited to join",
    "content": "<h1>Welcome</h1><p>Click <a href=\"{{link}}\">here</a> to accept your invitation.</p>"
  }'

```

---

### 2\. Update a System Template

- **HTTP Method**: `PUT`
- **Path**: `/api/system/templates/email/:id`

#### Example Request (curl)

```bash
curl -X PUT https://ids.fabrixly.com/api/system/templates/email/tpl_invitation \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-admin-jwt-token>" \
  -d '{
    "subject": "Invitation to join Fabrixly"
  }'

```

---

### 3\. Retrieve Client-Specific SMS Templates

Get a list of customized SMS templates assigned to a specific client ID.

- **HTTP Method**: `GET`
- **Path**: `/api/clients/:clientId/templates/sms`

#### Example Request (curl)

```bash
curl -X GET https://ids.fabrixly.com/api/clients/cli_abc123/templates/sms \
  -H "Authorization: Bearer <your-admin-jwt-token>"

```

---

### 4\. Delete a Template

Deletes a custom template using its ID.

- **HTTP Method**: `DELETE`
- **Path**: `/api/system/templates/email/:id`

#### Example Request (curl)

```bash
curl -X DELETE https://ids.fabrixly.com/api/system/templates/email/tpl_invitation \
  -H "Authorization: Bearer <your-admin-jwt-token>"

```

---

## Part C: Preview Templates APIs

Enables administrators to test and preview HTML email or SMS formats before making templates live.

### 1\. Preview Email Template

- **HTTP Method**: `POST`
- **Path**: `/api/templates/email/preview`

#### Example Request (curl)

```bash
curl -X POST https://ids.fabrixly.com/api/templates/email/preview \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-admin-jwt-token>" \
  -d '{
    "content": "<h1>Hello {{firstName}}</h1><p>Welcome to our app!</p>",
    "variables": {
      "firstName": "John"
    }
  }'

```

#### Response (`200 OK`)

```json
{
  "html": "<h1>Hello John</h1><p>Welcome to our app!</p>"
}

```

---

### 2\. Preview SMS Template

- **HTTP Method**: `POST`
- **Path**: `/api/templates/sms/preview`
- **Headers**:
  - `Content-Type: application/json`
  - `Authorization: Bearer <your-admin-jwt-token>`

#### Example Request (curl)

```bash
curl -X POST https://ids.fabrixly.com/api/templates/sms/preview \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-admin-jwt-token>" \
  -d '{
    "content": "Hello {{firstName}}! Your verification code is {{code}}",
    "variables": {
      "firstName": "John",
      "code": "123456"
    }
  }'

```

#### Response (`200 OK`)

```json
{
  "text": "Hello John! Your verification code is 123456"
}

```

---

## Part D: System SMS Templates APIs

Allows global customization of system-wide SMS notifications.

### 1\. List System SMS Templates

- **HTTP Method**: `GET`
- **Path**: `/api/system/templates/sms`

#### Example Request (curl)

```bash
curl -X GET https://ids.fabrixly.com/api/system/templates/sms \
  -H "Authorization: Bearer <your-admin-jwt-token>"

```

---

### 2\. Create System SMS Template

- **HTTP Method**: `POST`
- **Path**: `/api/system/templates/sms`

#### Example Request (curl)

```bash
curl -X POST https://ids.fabrixly.com/api/system/templates/sms \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-admin-jwt-token>" \
  -d '{
    "name": "OTP Login Code",
    "content": "Your login code is {{code}}. Valid for 5 minutes."
  }'

```

---

### 3\. Update System SMS Template

- **HTTP Method**: `PUT`
- **Path**: `/api/system/templates/sms/:id`

#### Example Request (curl)

```bash
curl -X PUT https://ids.fabrixly.com/api/system/templates/sms/tpl_sms_otp \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-admin-jwt-token>" \
  -d '{
    "content": "Your Fabrixly code: {{code}}. Do not share."
  }'

```

---

### 4\. Delete System SMS Template

- **HTTP Method**: `DELETE`
- **Path**: `/api/system/templates/sms/:id`

#### Example Request (curl)

```bash
curl -X DELETE https://ids.fabrixly.com/api/system/templates/sms/tpl_sms_otp \
  -H "Authorization: Bearer <your-admin-jwt-token>"

```