Skip to content

Archive or delete template

There are two ways to remove a template via the API:

  1. Archive (Soft Delete): Hides the template from the library but retains its data. Processes already launched from it continue to run. Archived templates can be restored.
  2. Delete (Permanent): Permanently removes the template and its associated data. This action cannot be undone.

1. Archive Template

Endpoint

DELETE /organizations/{org_id}/checklists/{checklist_id}

This endpoint archives the specified template.

Request

Replace {org_id} with your Organization ID and {checklist_id} with the ID of the template to archive.

Headers
  • Authorization: Bearer {your_access_token}
  • Accept: application/json
  • X-Tallyfy-Client: APIClient
Body

No request body is needed for this DELETE request.

Code samples for archiving

const accessToken = 'YOUR_PERSONAL_ACCESS_TOKEN';
const orgId = 'YOUR_ORGANIZATION_ID';
const checklistId = 'TEMPLATE_ID_TO_ARCHIVE';
const apiUrl = `https://go.tallyfy.com/api/organizations/${orgId}/checklists/${checklistId}`;
const headers = new Headers();
headers.append('Authorization', `Bearer ${accessToken}`);
headers.append('Accept', 'application/json');
headers.append('X-Tallyfy-Client', 'APIClient');
fetch(apiUrl, {
method: 'DELETE', // Use DELETE method
headers: headers
})
.then(response => {
if (!response.ok) { // Check for 200 OK
// Try to get error details
return response.json().then(errData => {
throw new Error(`HTTP error! status: ${response.status}, message: ${JSON.stringify(errData)}`);
}).catch(() => {
throw new Error(`HTTP error! status: ${response.status}`);
});
}
// For successful DELETE, often there's no JSON body, but check status
console.log(`Successfully archived template ${checklistId}. Status: ${response.status}`);
// Optionally return response.json() if the API sends back the archived object
return response.json();
})
.then(data => {
if (data) {
console.log('Archived template details:');
console.log(JSON.stringify(data, null, 2));
}
})
.catch(error => {
console.error('Error archiving template:', error);
});

Response examples for archiving

A successful archive request typically returns a 200 OK status code. The response body may contain the details of the archived template, now including an archived_at timestamp.

{
"data": {
"id": "TEMPLATE_ID_TO_ARCHIVE",
"title": "Template To Be Archived",
// ... other properties ...
"archived_at": "2024-05-20T13:00:00.000Z" // Timestamp indicates archival
}
}

2. Permanently delete Template

Endpoint

DELETE /organizations/{org_id}/checklists/{checklist_id}/delete

Note the extra /delete path segment compared to the archive endpoint.

Request

Replace {org_id} and {checklist_id} as appropriate.

Headers
  • Authorization: Bearer {your_access_token}
  • Accept: application/json
  • X-Tallyfy-Client: APIClient
Body

No request body is needed.

Code samples for archiving and deleting

const accessToken = 'YOUR_PERSONAL_ACCESS_TOKEN';
const orgId = 'YOUR_ORGANIZATION_ID';
const checklistId = 'TEMPLATE_ID_TO_ACTION';
// Choose the action: true to permanently delete, false (or omit) to archive
const permanentlyDelete = false;
const headers = new Headers();
headers.append('Authorization', `Bearer ${accessToken}`);
headers.append('Accept', 'application/json');
headers.append('X-Tallyfy-Client', 'APIClient');
const actionPath = permanentlyDelete ? '/delete' : '';
const apiUrl = `https://go.tallyfy.com/api/organizations/${orgId}/checklists/${checklistId}${actionPath}`;
fetch(apiUrl, {
method: 'DELETE',
headers: headers
})
.then(response => {
const successStatus = permanentlyDelete ? 204 : 200; // Delete often returns 204, Archive 200
const successStatusAlt = permanentlyDelete ? 200 : null; // Delete might also return 200
if (response.status === successStatus || (successStatusAlt && response.status === successStatusAlt)) {
const actionText = permanentlyDelete ? 'deleted' : 'archived';
console.log(`Successfully ${actionText} template ${checklistId}. Status: ${response.status}`);
if (response.status === 204) {
return null; // No body expected for 204
} else {
// Try to parse JSON for 200 OK
return response.json().catch(e => {
console.warn("Could not parse JSON response:", e);
return null;
});
}
} else {
// Try to parse error JSON, fallback to text
return response.json()
.catch(() => response.text())
.then(errData => {
const actionText = permanentlyDelete ? 'delete' : 'archive';
console.error(`Failed to ${actionText} template ${checklistId}. Status: ${response.status}`, errData);
throw new Error(`HTTP error! status: ${response.status}`);
});
}
})
.then(data => {
if (data) {
const actionText = permanentlyDelete ? 'Deleted' : 'Archived';
console.log(`${actionText} template details (if returned):`);
console.log(JSON.stringify(data, null, 2));
}
})
.catch(error => {
const actionText = permanentlyDelete ? 'deleting' : 'archiving';
console.error(`Error ${actionText} template ${checklistId}:`, error.message);
});

Response examples for archiving

A successful archive request typically returns a 200 OK status code. The response body may contain the details of the archived template, now including an archived_at timestamp.

{
"data": {
"id": "TEMPLATE_ID_TO_ARCHIVE",
"title": "Template To Be Archived",
// ... other properties ...
"archived_at": "2024-05-20T13:00:00.000Z" // Timestamp indicates archival
}
}

Response examples for permanent deletion

A successful permanent deletion typically returns a 200 OK or 204 No Content status code. The response body, if present for a 200 OK, might contain a success message.

Tasks > Archive task

A DELETE endpoint archives standalone tasks by hiding them from default views while preserving data for potential future restoration through authenticated API requests with provided code examples in multiple programming languages.

Tags > Archive tag

A DELETE endpoint that enables archiving of organization tags by making them hidden while maintaining their data with authentication headers and code examples in multiple programming languages.

Processes > Archive process

The DELETE endpoint enables archiving of process instances by hiding them from default views while maintaining data accessibility for future restoration through authenticated API requests.

Processes > Delete process

A DELETE endpoint permanently removes a specific process instance and its associated data with authentication headers returning either 200 OK or 204 No Content status codes upon successful deletion.