Skip to main content
DELETE
/
workspaces
/
{id}
Delete Workspace
curl --request DELETE \
  --url https://app.tokencraft.dev/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.
Write access policy - This endpoint requires the write:tokens scope.
  • TEAM-owned workspace: owner, admin, editor can write; viewer is blocked (403).
  • Non-TEAM workspace: only the workspace owner can write.
  • If the workspace owner plan has no API write access (for example FREE), write is blocked.

Endpoint

DELETE /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 tkc_your_token_here"

Error Responses

401 Unauthorized

{
  "error": "Invalid API token"
}

404 Not Found

{
  "error": "Workspace not found"
}
Causes:
  • Workspace ID doesn’t exist
  • You do not have access to this workspace

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

Export Workspace Data

Export before deletion

List Workspaces

View all workspaces