To provide the best answer I think we might need more information on your scenario. What exactly do you mean by delete?
In a lot of processes I build I'll provide a cancel task available to the originator so that if they choose they can cancel the process and it'll expire (maybe this is what you mean by delete) any open tasks assigned in the process. You can do this using the code in a server event similar to the following which I typically add to the "Completed" or "Cancelled" final activities in the process.
Â
Â
Â
Â
           if (Convert.ToBoolean(K2.ProcessInstance.DataFieldss"GotoAlreadyCalled"].Value) == false)
           {
               K2.ProcessInstance.DataFields "GotoAlreadyCalled"].Value = true;
               K2.GotoActivity(K2.ActivityInstanceDestination.Activity.Name);
           }
Using this method it still leaves a process audit trail in the K2 Log Database which is what I would recommend.
If you actually want to delete the active process and the entry from the K2 Log database you would need to write K2 Management API code that would have Admin permissions on the K2 Server to do this. However, you would need to do this from an external assembly outside of the K2 process otherwise it could affect the K2 server. Take a look at the following class in the out of the box K2 documentation:                    Â
SourceCode.Workflow.Management Assembly > SourceCode.Workflow.Management Namespace > WorkflowManagementServer Class : DeleteProcessInstances Method