Delete a Template
/templateprivate keyprk_This service deletes a template from your organization: it erases its configuration, both of its HTML files —the Mask and the Complete— and the reference links that point to it. Once deleted, the template no longer appears in GET /template and no processes can be created with it.
Auco refuses to delete it while any process created from it is still in signature —not finished, not expired, and not rejected—, because that process still needs the template to build the signed PDF. Once all its processes finish, expire, or are rejected, you can delete it.
There is no way to recover a deleted template, and creating it again with POST /template gives it a new id: integrations and reference links that used the previous one stop working. If you may need it again, download it first with GET /template?id=, which returns its configuration and the URLs to download both HTML files.
Authentication
Include your private key in the Authorization header.
Authorization: prk_xxx...
Steps to delete a template:
- Download the template with
GET /template?id=if you may need it again. - Call
DELETE /templatewith the template'sid. - If the response is
TEMPLATE_IN_USE, wait for the processes still in signature to finish, or cancel them withPOST /document/cancel, and try again.
Query Parameters
| Name | Type | Description |
|---|---|---|
id | String required | Template identifier, an ObjectId of 24 hexadecimal characters. |
🧪 Usage Examples
You can copy any of the examples depending on your preferred language.
🔹 Delete a template by id
- curl
- Python
- Node.js
curl --location --request DELETE 'https://api.auco.ai/v1.5/ext/template?id=64823dc5ce28a265e02d68f3' \
--header 'Authorization: prk_private_key_company'
import requests
response = requests.delete(
"https://api.auco.ai/v1.5/ext/template",
headers={"Authorization": "prk_private_key_company"},
params={"id": "64823dc5ce28a265e02d68f3"}
)
print(response.json())
const axios = require('axios');
axios
.delete('https://api.auco.ai/v1.5/ext/template', {
headers: { Authorization: 'prk_private_key_company' },
params: { id: '64823dc5ce28a265e02d68f3' },
})
.then((response) => console.log(response.data));
📥 Response Examples
🔹 Template deleted
{
"id": "64823dc5ce28a265e02d68f3",
"deleted": true,
"references": 2
}
🔸 Template with processes in signature
{
"message": "TEMPLATE_IN_USE"
}
📋 Response Fields
| Field | Type | Description |
|---|---|---|
id | String | Identifier of the deleted template, the same one you sent. |
deleted | Boolean | true: the template and both of its HTML files were deleted. |
references | Number | How many reference links to the template were deleted along with it. 0 if it had none. |
⚠️ Error Responses
| Code | Description |
|---|---|
| 400 | Invalid parameter or template that cannot be deleted: TEMPLATE_NOT_FOUND (the id does not match a template of your organization), TEMPLATE_IN_USE (a process created from the template is still in signature), or the validator's message if id is missing or is not an ObjectId |
| 401 | Invalid or missing authentication |
The validator's message describes the problem with id: "id" is required, "id" length must be 24 characters long, or "id" must only contain hexadecimal characters.
TEMPLATE_IN_USE does not say which processesThe response does not identify the processes that block the deletion. If you need to know, check in your integration the processes you created with that template and query their status with GET /document.