Skip to content

Email Templates

SendAPI provides a built-in template engine for rendering dynamic HTML emails. Templates use standard variable interpolation syntax (e.g., ) and can be managed programmatically.

List Templates

Retrieve all email templates stored in the project.

GET /v1/email/templates

Response

json
{
  "data": [
    {
      "id": 1,
      "name": "Welcome Email",
      "subject": "Welcome to SendAPI, {{ name }}!",
      "created_at": "2026-03-09T14:30:00.000000Z",
      "updated_at": "2026-03-10T09:15:00.000000Z"
    }
  ]
}

Create a Template

Store a new reusable HTML template.

POST /v1/email/templates

Request Body

ParameterTypeRequiredDescription
namestringYesInternal reference name for the template.
subjectstringYesDefault subject line (supports variables).
html_contentstringYesThe raw HTML structure of your email. Use for dynamic data injection.
bash
curl -X POST https://sendapi.co/v1/email/templates \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Password Reset",
    "subject": "Reset your password",
    "html_content": "<html><body>Hi {{ name }}, <a href=\"{{ reset_url }}\">Click here to reset</a>.</body></html>"
  }'

Get a Template

Retrieve the full details of a specific template, including its html_content.

GET /v1/email/templates/{id}


Update a Template

Update the contents of an existing template.

PUT /v1/email/templates/{id}

Request Body

ParameterTypeRequiredDescription
namestringNoInternal reference name for the template.
subjectstringNoDefault subject line (supports variables).
html_contentstringNoThe raw HTML structure of your email.

Delete a Template

DELETE /v1/email/templates/{id}

Immediate Effect

Deleting a template is immediate. Any active API integrations calling /v1/email/send using this template ID will instantly fail with a 404 Not Found error.

Released under the MIT License.