Skip to content

Archive task

Endpoint

DELETE /organizations/{org_id}/tasks/{task_id}

This endpoint archives a standalone (“one-off”) task. Archived tasks are hidden from default views but can potentially be restored or deleted permanently later.

Request

Replace {org_id} with your Organization ID and {task_id} with the ID of the one-off task 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

const accessToken = 'YOUR_PERSONAL_ACCESS_TOKEN';
const orgId = 'YOUR_ORGANIZATION_ID';
const taskId = 'ONE_OFF_TASK_ID_TO_ARCHIVE';
const apiUrl = `https://api.tallyfy.com/organizations/${orgId}/tasks/${taskId}`;
const headers = new Headers();
headers.append('Authorization', `Bearer ${accessToken}`);
headers.append('Accept', 'application/json');
headers.append('X-Tallyfy-Client', 'APIClient');
fetch(apiUrl, {
method: 'DELETE',
headers: headers
})
.then(response => {
// Check for 204 No Content or potentially 200 OK
if (response.status === 204 || response.status === 200) {
console.log(`Successfully archived one-off task ${taskId}. Status: ${response.status}`);
// Response might be empty (204) or contain the archived task (200)
if (response.status === 200) {
return response.json();
}
return null;
} else {
// Error handling...
return response.json().then(errData => { throw new Error(/*...*/); }).catch(() => { throw new Error(/*...*/); });
}
})
.then(data => {
if (data) {
console.log('Archived task details:');
console.log(JSON.stringify(data, null, 2));
}
})
.catch(error => {
console.error(`Error archiving one-off task ${taskId}:`, error);
});

Response

A successful request typically returns a 204 No Content status code, indicating the task was archived successfully without returning any body content. Occasionally, it might return 200 OK with the archived task details in the body.

If a 200 OK response is returned with a body:

{
"data": {
"id": "ONE_OFF_TASK_ID_TO_ARCHIVE",
"title": "Archived One-Off Task",
"status": "archived", // Or similar status indicating it's archived
"archived_at": "2024-05-20T19:00:00.000Z", // Archive timestamp
// ... other task properties ...
}
}

If the task ID doesn’t exist or is not a one-off task eligible for direct archival, an error will occur.