Appearance
User - Email Templates
Base URL:
https://your-domain.com
Admin endpoints for managing email templates. All endpoints require admin/staff authentication.
Fetch All Email Templates
Retrieve all email templates.
| Property | Value |
|---|---|
| Endpoint | Fetch All Email Templates |
| Method | GET |
| URL | /api/v1/email-templates |
| Authentication | Bearer Token |
Request Headers:
| Header | Value | Required |
|---|---|---|
Accept | application/json | Yes |
Authorization | Bearer your-auth-token | Yes |
Success Response (200 OK):
json
{
"success": true,
"data": [
{
"id": 1,
"name": "Welcome Email",
"subject": "Welcome to Our Service!",
"is_active": true
}
]
}Fetch Email Template
Retrieve details of a specific email template.
| Property | Value |
|---|---|
| Endpoint | Fetch Email Template |
| Method | GET |
| URL | /api/v1/email-templates/{id} |
| Authentication | Bearer Token |
Success Response (200 OK):
json
{
"success": true,
"data": {
"id": 1,
"name": "Welcome Email",
"subject": "Welcome to Our Service!",
"body": "<h1>Welcome {name}!</h1><p>Thank you for joining.</p>",
"variables": ["{name}", "{email}", "{package}"]
}
}Create Email Template
Create a new email template.
| Property | Value |
|---|---|
| Endpoint | Create Email Template |
| Method | POST |
| URL | /api/v1/email-templates |
| Authentication | Bearer Token |
Request Body:
json
{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "Welcome Email",
"subject": "Welcome!",
"body": "Welcome to our service."
}| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Template name |
subject | string | Yes | Email subject |
body | string | Yes | Email body (HTML supported) |
Success Response (201 Created):
json
{
"success": true,
"message": "Email template created successfully",
"data": {
"id": 1
}
}Update Email Template
Update an existing email template.
| Property | Value |
|---|---|
| Endpoint | Update Email Template |
| Method | PUT |
| URL | /api/v1/email-templates/{id} |
| Authentication | Bearer Token |
Request Body:
json
{
"subject": "Updated Subject",
"body": "Updated body content"
}Success Response (200 OK):
json
{
"success": true,
"message": "Email template updated successfully"
}Delete Email Template
Delete an email template.
| Property | Value |
|---|---|
| Endpoint | Delete Email Template |
| Method | DELETE |
| URL | /api/v1/email-templates/{id} |
| Authentication | Bearer Token |
Success Response (200 OK):
json
{
"success": true,
"message": "Email template deleted successfully"
}