Delete Template
Delete a template permanently using the Docstron API. This action cannot be undone, so use with caution.
Endpoint
Section titled “Endpoint”DELETE https://api.docstron.com/v1/templates/{template_id}
Authentication
Section titled “Authentication”This endpoint requires authentication using a Bearer token. Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Parameters
Section titled “Parameters”Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
template_id | string | Yes | The unique identifier of the template to delete (e.g., template-c2465c0b-fc54-4672-b9ac-7446886cd6de ) |
Request Examples
Section titled “Request Examples”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 ''
Response
Section titled “Response”200 - Success Response
{ "success": true, "message": "Template successfully deleted.", "data": []}
Response Fields
Section titled “Response Fields”Field | Type | Description |
---|---|---|
success | boolean | Indicates if the deletion was successful (true ) |
message | string | A message confirming the deletion |
data | array | Empty array |
Error Responses
Section titled “Error Responses”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.
Important Notes
Section titled “Important Notes”⚠️ 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
Best Practices
Section titled “Best Practices”✅ Recommended Actions
Section titled “✅ Recommended Actions”- 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
tofalse
instead of deleting if you might need the template later - Verify template ID - Double-check the
template_id
to avoid accidental deletion
❌ Actions to Avoid
Section titled “❌ Actions to Avoid”- 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
Need Help?
Section titled “Need Help?”If you have questions about applications or need assistance:
- 📧 Email: support@docstron.com
- 💬 Live Chat: Available in your dashboard
- 📚 Documentation: You’re reading it!