Skip to content

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.

PropertyValue
EndpointFetch All Email Templates
MethodGET
URL/api/v1/email-templates
AuthenticationBearer Token

Request Headers:

HeaderValueRequired
Acceptapplication/jsonYes
AuthorizationBearer your-auth-tokenYes

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.

PropertyValue
EndpointFetch Email Template
MethodGET
URL/api/v1/email-templates/{id}
AuthenticationBearer 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.

PropertyValue
EndpointCreate Email Template
MethodPOST
URL/api/v1/email-templates
AuthenticationBearer Token

Request Body:

json
{
    "isp_id": 1,
    "branch_id": 1,
    "user_id": 1,
    "name": "Welcome Email",
    "subject": "Welcome!",
    "body": "Welcome to our service."
}
ParameterTypeRequiredDescription
namestringYesTemplate name
subjectstringYesEmail subject
bodystringYesEmail 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.

PropertyValue
EndpointUpdate Email Template
MethodPUT
URL/api/v1/email-templates/{id}
AuthenticationBearer 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.

PropertyValue
EndpointDelete Email Template
MethodDELETE
URL/api/v1/email-templates/{id}
AuthenticationBearer Token

Success Response (200 OK):

json
{
    "success": true,
    "message": "Email template deleted successfully"
}

www.onezeroart.com