Re: bulk delete from database

Mark_Ioffe
Level 1

bulk delete from database

hello. we have a few hundred leads deleted because customers have closed accounts and other reasons.  we have a custom field on the lead that represents our internal customer id.  is there a way we can pass a list of customer id's to marketo to delete them from the lead and associated custom objects?  i see we can pass the marketo id but that lives only in marketo-land.

thanks!

5 REPLIES 5
Gerard_Donnell4
Level 10

Re: bulk delete from database

Hi Mark,

It probably depends on the field type.

Try creating a smart list and then drag out the custom field. It should hopefully have a green plus sign to the right. If you click that a box appears where you can enter multiple values on separate lines. Copy and paste all your Customer ID's in there and hopefully that will create a smart list with all the people you need to delete.

Screen Shot 2018-12-12 at 16.07.16.png

Screen Shot 2018-12-12 at 16.07.27.png

Mark_Ioffe
Level 1

Re: bulk delete from database

Thank you for your prompt reply. Is there a way I can do it via API? Like pass the customer field as a list of id’s (1,2,3,4,5) etc.. and call /bulk/v1/leads.json?_method=DELETE on that csv containing the id’s?

SanfordWhiteman
Level 10 - Community Moderator

Re: bulk delete from database

Deletes are done with the Lead ID. You could use Get Leads (by Filter Type) and pass the results to Delete.

It wouldn't make sense for delete to key on a custom field, because deletes refer to a single lead at a time and your custom field (even if you try to keep it unique in userland) is not actually guaranteed unique.

Nick_Wee
Level 1

Re: bulk delete from database

Hello

Is there a way to pull more than 300 leads with an API call? What if we have say 1 million records we'd like to delete in bulk? 

SanfordWhiteman
Level 10 - Community Moderator

Re: bulk delete from database

It's not feasible to do mass deletes using only the API. You can upsert a large batch of leads (up to the bulk import max size of 10 MB) into a (static) List.

Then run a batch SC filtered on Member of List that deletes the leads.

However, note this does not allow deletion based on Lead Id unless you have a secondary field into which you copy the {{lead.id}} (call it something like Lead Id Mirror). One frustrating quirk of Marketo is that you can't act directly on Lead ID in a filter.