Deleting Email Templates
Endpoint Overview
Delete an existing email template belonging to your organization by its numeric identifier.
- HTTP Method:
DELETE - Endpoint URL:
https://api.trywhiteowl.com/api/v1/email/:id - Authentication: Bearer Token (API Key)
- Required Permission:
email:delete(Ensure your API key has Delete permission under Email)
Path Parameters
Section titled “Path Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
id |
Number | Yes | The numeric identifier of the email template to delete. |
Request Headers
Section titled “Request Headers”| Header | Type | Required | Description |
|---|---|---|---|
Authorization |
String | Yes | Bearer token format: Bearer YOUR_API_KEY |
Content-Type |
String | Yes | application/json |
Code Examples
Section titled “Code Examples”cURL
curl -X DELETE "https://api.trywhiteowl.com/api/v1/email/101" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json"JavaScript (Fetch)
const templateId = 101;const options = { method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }};
fetch(`https://api.trywhiteowl.com/api/v1/email/${templateId}`, options) .then(response => response.json()) .then(data => console.log(data)) .catch(err => console.error(err));Python (Requests)
import requests
template_id = 101url = f"https://api.trywhiteowl.com/api/v1/email/{template_id}"headers = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json"}
response = requests.delete(url, headers=headers)print(response.json())Response Structure
Section titled “Response Structure”Success Response (200 OK)
{ "success": true, "message": "Email template deleted successfully", "data": [ { "id": 101, "name": "Course Welcome Email", "body": "<h1>Welcome {{first_name}}!</h1>", "variables": [ "first_name" ], "organization": "org_12345" } ]}Error Responses
- Missing Template Identifier:
{ "success": false, "message": "id is required to delete email template"}- Missing Permissions (
403 Forbidden):
{ "success": false, "message": "Your API key does not have the 'email:delete' permission"}- Internal Server Error (
500 Internal Server Error):
{ "success": false, "message": "There was an error deleting the email template"}