Skip to content

Delete Template

Delete a template permanently using the Docstron API. This action cannot be undone, so use with caution.

DELETE https://api.docstron.com/v1/templates/{template_id}

This endpoint requires authentication using a Bearer token. Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Path Parameters

ParameterTypeRequiredDescription
template_idstringYesThe unique identifier of the template to delete (e.g., template-c2465c0b-fc54-4672-b9ac-7446886cd6de)
Terminal window
curl --location --request DELETE 'https://api.docstron.com/v1/templates/template-c2465c0b-fc54-4672-b9ac-7446886cd6de' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data ''

200 - Success Response

{
"success": true,
"message": "Template successfully deleted.",
"data": []
}
FieldTypeDescription
successbooleanIndicates if the deletion was successful (true)
messagestringA message confirming the deletion
dataarrayEmpty array

404 - Template Not Found

Returned when the provided template_id does not exist or is invalid.

{
"success": false,
"message": "Template not found.",
"data": []
}

Common causes:

  • Invalid or mistyped template_id
  • Template has already been deleted
  • The template belongs to a different application

Solution: Verify the template_id is correct by using the Get Template endpoint before attempting deletion.


500 - Internal Server Error

Returned when an unexpected server error occurs while deleting the template.

{
"success": false,
"message": "Failed to delete the template.",
"data": []
}

Common causes:

  • Temporary server issue
  • Database connectivity problem
  • Service maintenance

Solution: Wait a few moments and retry the request. If the problem persists, contact support@docstron.com.

⚠️ Warning: Deleting a template is permanent and cannot be undone. Consider the following before deletion:

  • Documents using this template - Existing generated documents will remain, but you won’t be able to generate new ones with this template
  • No recovery - Once deleted, the template content and settings cannot be recovered
  • Alternative approach - Instead of deleting, consider deactivating the template by using the Update Template endpoint with "is_active": false
  • Backup template content - Save the template HTML and CSS before deletion
  • Check for dependencies - Ensure no active processes are using this template
  • Use deactivation first - Set is_active to false instead of deleting if you might need the template later
  • Verify template ID - Double-check the template_id to avoid accidental deletion
  • Don’t delete production templates without proper testing in development first
  • Don’t delete templates that are actively being used in scheduled jobs
  • Don’t rush deletions - Take time to verify you’re deleting the correct template

If you have questions about applications or need assistance:

  • 📧 Email: support@docstron.com
  • 💬 Live Chat: Available in your dashboard
  • 📚 Documentation: You’re reading it!