# Deleting Leads in Bulk

**URL:** <https://forum.mautic.org/t/deleting-leads-in-bulk/3289>\
**Category:** General Discussion\
**Created:** [January 22, 2016, 10:51pm UTC](https://forum.mautic.org/t/deleting-leads-in-bulk/3289 "2016-01-22T22:51:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![lgoffi](https://avatars.discourse-cdn.com/v4/letter/l/41988e/32.png) [@lgoffi](https://forum.mautic.org/u/lgoffi)\
**Post date:** [January 22, 2016, 10:51pm UTC](https://forum.mautic.org/t/deleting-leads-in-bulk/3289/1 "2016-01-22T22:51:25Z")

</div>

Hi folks I hope this message finds you all doing well.  
  
  
  
I am unable to find the place in Mautic where leads can be deleted in bulk. Can someone please point me in the right direction?  
  
  
  
I searched in this forum and in Google with no luck. I found commets on github that the feature was rolled out though. Can someone point me in the right direction please?  
  
  
  
I am on Mautic V 1.1.3  
  
  
  
Thanks a ton for the help. I am enjoying very much using Mautic  
  
  
  
Regards,  
  
Leo

---

<div class="post-metadata">

**Author:** ![lgoffi](https://avatars.discourse-cdn.com/v4/letter/l/41988e/32.png) [@lgoffi](https://forum.mautic.org/u/lgoffi)\
**Post date:** [January 22, 2016, 10:51pm UTC](https://forum.mautic.org/t/deleting-leads-in-bulk/3289/2 "2016-01-22T22:51:25Z")

</div>

Hi folks I hope this message finds you all doing well.

I am unable to find the place in Mautic where leads can be deleted in bulk. Can someone please point me in the right direction?

I searched in this forum and in Google with no luck. I found commets on github that the feature was rolled out though. Can someone point me in the right direction please?

I am on Mautic V 1.1.3

Thanks a ton for the help. I am enjoying very much using Mautic

Regards,  
Leo

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [January 25, 2016, 11:51am UTC](https://forum.mautic.org/t/deleting-leads-in-bulk/3289/3 "2016-01-25T11:51:35Z")

</div>

There is a checkbox in the Lead manager. The first one will select all the leads in currently visible table. Then there is a orange delete button above the table which will delete all selected leads. You can change the rows in the table up to 100 rows if you want to delete in bigger chunks.

---

<div class="post-metadata">

**Author:** ![brianc](https://avatars.discourse-cdn.com/v4/letter/b/848f3c/32.png) [@brianc](https://forum.mautic.org/u/brianc)\
**Post date:** [February 2, 2016, 10:11pm UTC](https://forum.mautic.org/t/deleting-leads-in-bulk/3289/4 "2016-02-02T22:11:02Z")

</div>

Just one thing here, when I try to delete 100 at the time, nothing happens, apparently just refreshes the “selection”, i have a question, is there a way where we can delete more than 100?

This happened to me, I added 5k leads to a list, and I thought that when a “Lead list” is deleted all the leads inside the list would be deleted also, but that is not the case(I guess the “lead list” is only a category internally and not a subfolder)

I need to get rid off all the leads and upload them again, as now only 50 at the time i can delete…

Thank you for your great support!!

---

<div class="post-metadata">

**Author:** ![brianc](https://avatars.discourse-cdn.com/v4/letter/b/848f3c/32.png) [@brianc](https://forum.mautic.org/u/brianc)\
**Post date:** [February 2, 2016, 10:44pm UTC](https://forum.mautic.org/t/deleting-leads-in-bulk/3289/5 "2016-02-02T22:44:34Z")

</div>

In case you would like to delete a higher number of leads than 100 you can access you SQL database under (youhostID)\_mautic you will find “leads” and there you will be able to process any action to your data.

Cheers!

---

<div class="post-metadata">

**Author:** ![Scalar](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@Scalar](https://forum.mautic.org/u/Scalar)\
**Post date:** [June 29, 2016, 9:28am UTC](https://forum.mautic.org/t/deleting-leads-in-bulk/3289/6 "2016-06-29T09:28:22Z")

</div>

I am having the exact same problem.  
When selecting leads in bulk, by selecting them all, then clicking the orange button to ‘delete the selected’ leads it thinks about it, stops, then on page refresh the leads are all still there.

The only way I can delete leads is individually, via the litte drop down next to each individual lead.  
This is painstaking when I have many leads to delete.

So it appears that the bulk lead deletion isnt working for me.

---

<div class="post-metadata">

**Author:** ![eurogroup](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@eurogroup](https://forum.mautic.org/u/eurogroup)\
**Post date:** [August 12, 2016, 7:18am UTC](https://forum.mautic.org/t/deleting-leads-in-bulk/3289/7 "2016-08-12T07:18:40Z")

</div>

Hi,

In MySQL TRUNCATE tableName;

This will reset the counter to 1 also but you should contact the Mautic developers as I notice in my other posts that the leads table is linked to other tables ie lead.donotcontact for example.

---

<div class="post-metadata">

**Author:** ![eurogroup](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@eurogroup](https://forum.mautic.org/u/eurogroup)\
**Post date:** [August 15, 2016, 1:41pm UTC](https://forum.mautic.org/t/deleting-leads-in-bulk/3289/8 "2016-08-15T13:41:09Z")

</div>

Hi,

This worked for me however I have not set up points etc yet and a fairly new instance.

[code]  
SET FOREIGN\_KEY\_CHECKS = 0;  
TRUNCATE leads;  
SET FOREIGN\_KEY\_CHECKS = 1;

SET FOREIGN\_KEY\_CHECKS = 0;  
TRUNCATE do\_not\_contact;  
SET FOREIGN\_KEY\_CHECKS = 1;

SET FOREIGN\_KEY\_CHECKS = 0;  
TRUNCATE lead\_list\_leads;  
SET FOREIGN\_KEY\_CHECKS = 1;[/code]

---

<div class="post-metadata">

**Author:** ![superbiche](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@superbiche](https://forum.mautic.org/u/superbiche)\
**Post date:** [October 26, 2017, 2:22pm UTC](https://forum.mautic.org/t/deleting-leads-in-bulk/3289/9 "2017-10-26T14:22:12Z")

</div>

Hey there,

If you need a simple and quite clean solution, here’s a small JS script I used to delete 30k+ contacts. Just paste in your browser’s console and run it :

```auto

// These constants were defined according to the performance of my server.
// You can tweak them, particularily in case actions are triggered before the previous one has ended.
const waitForTableData = 3000 // how long to wait for the table data to be refreshed.
const waitForCheckboxes = 3000 // how long to wait for the checkboxes to be clicked.
const waitForModal = 3000 // how long to wait for the modal to appear
const interval = 30000 // The interval between two scripts run.

// Define a callback to delete leads
const deleteLeads = () => { 
	// Hack Mautic limit of 100 rows per page. When I set 500 rows it's buggy...
  	Mautic.limitTableData('lead',300,'list','.page-list', '/s/contacts'); 
	setTimeout(() => {
		// Click the headers checkbox to trigger checking all rows.
		jQuery('#customcheckbox-one0').click()

		setTimeout(() => {
			// Click the batchDelete button.
			jQuery('a[href="/s/contacts/batchDelete"]').click()
			setTimeout(() => {
				// Click the modal's delete button.
				jQuery('.modal[aria-hidden="false"] .btn-danger').click()
			}, waitForModal)
		}, waitForCheckboxes)
	}, waitForTableData)
}

// First trigger
deleteLeads()

// And run
setInterval(() => {
	deleteLeads()
}, interval)
```

Just leave your window open so you can see if it’s working properly. In the end, you might be left with pending contacts that are locked by someone, just delete them by hand if there are not many.

Cheers 🙂
