Overview
Delete a WhatsApp message template from both your workspace and Meta’s system.
This action is irreversible . The template will be deleted from Meta and cannot be recovered.
Path Parameters
Parameter Type Required Description workspaceUUID Yes Workspace ID templateinteger Yes Template ID to delete
Response
Success (200 OK)
{
"success" : true ,
"message" : "Template deleted successfully"
}
Not Found (404)
{
"success" : false ,
"message" : "Template not found"
}
What Happens on Deletion?
Job Dispatched
A background job DeleteTemplateInApiProvider is queued
Meta Deletion
The template is deleted from Meta’s WhatsApp Business API
Local Deletion
The template is removed from your workspace database
Example Usage
cURL
curl -X DELETE \
https://lancepilot.com/api/v3/workspaces/{workspace}/templates/1234 \
-H 'Authorization: Bearer YOUR_API_TOKEN'
JavaScript
async function deleteTemplate ( workspaceId , templateId ) {
const response = await fetch (
`https://lancepilot.com/api/v3/workspaces/ ${ workspaceId } /templates/ ${ templateId } ` ,
{
method: 'DELETE' ,
headers: {
'Authorization' : `Bearer ${ YOUR_API_TOKEN } `
}
}
);
const data = await response . json ();
if ( data . success ) {
console . log ( 'Template deleted successfully' );
} else {
console . error ( 'Deletion failed:' , data . message );
}
}
Python
import requests
def delete_template ( workspace_id , template_id , api_token ):
url = f "https://lancepilot.com/api/v3/workspaces/ { workspace_id } /templates/ { template_id } "
headers = { "Authorization" : f "Bearer { api_token } " }
response = requests.delete(url, headers = headers)
return response.json()
# Usage
result = delete_template( "workspace-uuid" , 1234 , "your_token" )
print (result[ 'message' ])
Before Deleting
Check Usage Verify if the template is currently being used in active campaigns
Backup Data Save template configuration if you might need it later
Consider Alternatives Could you update instead of delete? Use Update Template
Test First Test deletion on non-production templates first
Important Notes
Async Processing Deletion from Meta happens in the background. The local database entry is removed immediately, but Meta deletion may take a few seconds.
Active Campaigns If the template is used in active campaigns or automations, deleting it will cause those to fail. Check dependencies before deletion.
Soft Delete Alternative Consider implementing a soft delete pattern where templates are marked as archived instead of permanently deleted.
Error Scenarios
Error Code Cause Solution 404 Template not found Verify template ID exists 401 Unauthorized Check API token validity 403 Insufficient permissions Verify workspace access rights 500 Server error Contact support or retry later
Bulk Deletion Example
async function bulkDeleteTemplates ( workspaceId , templateIds ) {
const results = [];
for ( const templateId of templateIds ) {
try {
const result = await deleteTemplate ( workspaceId , templateId );
results . push ({ templateId , success: true , ... result });
} catch ( error ) {
results . push ({ templateId , success: false , error: error . message });
}
// Add delay to avoid rate limiting
await new Promise ( resolve => setTimeout ( resolve , 1000 ));
}
return results ;
}
// Usage
const deletedTemplates = await bulkDeleteTemplates ( 'workspace-uuid' , [ 1 , 2 , 3 , 4 ]);
console . log ( `Deleted ${ deletedTemplates . filter ( r => r . success ). length } templates` );
Bearer authentication header of the form Bearer <token> , where <token> is your auth token.
Example: "Resource deleted successfully."