Skip to main content
DELETE
/
api
/
v1
/
workspaces
/
{id}
Delete Workspace
curl --request DELETE \
  --url https://app.tokencraft.dev/api/v1/api/v1/workspaces/{id} \
  --header 'Authorization: Bearer <token>'

Delete Workspace

Permanently deletes a workspace and all its associated tokensets, modes, and tokens. This action cannot be undone.
PRO Plan Required - This endpoint requires a PRO or TEAM subscription plan. API write access is not available on the FREE plan.

Endpoint

DELETE /api/v1/workspaces/{id}

Authentication

Requires a valid API token in the Authorization header.

Request

Headers

HeaderValueRequired
AuthorizationBearer tokenYes

Path Parameters

ParameterTypeRequiredDescription
idstringYesWorkspace ID

Response

Success Response

Status: 200 OK
{
  "message": "Workspace deleted successfully"
}

Examples

curl -X DELETE https://app.tokencraft.dev/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer dtk_your_token_here"

Error Responses

401 Unauthorized

{
  "error": "Invalid API token"
}

404 Not Found

{
  "error": "Workspace not found"
}
Causes:
  • Workspace ID doesn’t exist
  • Workspace belongs to a different user

500 Internal Server Error

{
  "error": "Failed to delete workspace"
}

Cascade Deletion

When a workspace is deleted, the following are also deleted:
  • ✅ All tokensets in the workspace
  • ✅ All modes in those tokensets
  • ✅ All tokens in those modes
This operation is irreversible. All data will be permanently deleted. Make sure to export your tokens before deletion if you need a backup.

Best Practices

1. Confirmation

Always confirm with the user before deletion:
async function deleteWorkspaceWithConfirmation(id) {
  const confirmed = confirm(
    'Are you sure? This will delete all tokensets and tokens. This action cannot be undone.'
  );
  
  if (!confirmed) return;
  
  await deleteWorkspace(id);
}

2. Export Before Deletion

Download all data before deletion:
async function safeDeleteWorkspace(id) {
  // Export all tokensets first
  const tokensets = await getWorkspaceTokensets(id);
  
  for (const tokenset of tokensets) {
    await exportTokenset(tokenset.id, 'json');
  }
  
  // Then delete
  await deleteWorkspace(id);
}

3. Archive Instead

Consider archiving instead of deleting:
// Update workspace name to indicate archived status
await updateWorkspace(id, {
  name: `[ARCHIVED] ${workspace.name}`
});

Recovery

Deleted workspaces cannot be recovered. There is no undo or trash bin. Make sure you have backups of important data.

Next Steps