APIs & Integrations

AlexLHW
Member

Delete Contact in batches

SOLVE

Hey

 

I'm working on a little integration between our app and hubspot's api.

I'm actually working on how to delete contact in our hubspot's crm, and what I understood is that I need to make a batche of contact to delete using /crm/v3/objects/contacts/batch/create and then send the id of the freshly created batch using /crm/v3/objects/contacts/batch/archive 

But for now, I don't clearly understand from the doc what I need to send to create the batche.

Do I need to pass every field of my contacts into the body of the request, or just the unique identifier ?

 

Thanks for your help on that !

0 Upvotes
1 Accepted solution
himanshurauthan
Solution
Thought Leader | Elite Partner
Thought Leader | Elite Partner

Delete Contact in batches

SOLVE

Hello @AlexLHW 

When using the HubSpot API to create a batch of contacts for deletion, you only need to include the unique identifiers of the contacts in the request body, rather than passing every field of the contacts.

you need to provide an array of objects, where each object represents a contact and includes the unique identifier of the contact.

{
  "inputs": [
    {
      "id": "CONTACT_ID_1"
    },
    {
      "id": "CONTACT_ID_2"
    },
    ...
  ]
}

 

Replace "CONTACT_ID_1", "CONTACT_ID_2", and so on with the actual unique identifiers of the contacts you want to delete.

Once you have created the batch using the /crm/v3/objects/contacts/batch/create endpoint and obtained the batch ID, you can then use the /crm/v3/objects/contacts/batch/archive endpoint to delete the contacts in the batch by providing the batch ID in the request.




Digital Marketing & Inbound Expert In Growth Hacking Technology

View solution in original post

2 Replies 2
himanshurauthan
Solution
Thought Leader | Elite Partner
Thought Leader | Elite Partner

Delete Contact in batches

SOLVE

Hello @AlexLHW 

When using the HubSpot API to create a batch of contacts for deletion, you only need to include the unique identifiers of the contacts in the request body, rather than passing every field of the contacts.

you need to provide an array of objects, where each object represents a contact and includes the unique identifier of the contact.

{
  "inputs": [
    {
      "id": "CONTACT_ID_1"
    },
    {
      "id": "CONTACT_ID_2"
    },
    ...
  ]
}

 

Replace "CONTACT_ID_1", "CONTACT_ID_2", and so on with the actual unique identifiers of the contacts you want to delete.

Once you have created the batch using the /crm/v3/objects/contacts/batch/create endpoint and obtained the batch ID, you can then use the /crm/v3/objects/contacts/batch/archive endpoint to delete the contacts in the batch by providing the batch ID in the request.




Digital Marketing & Inbound Expert In Growth Hacking Technology
AlexLHW
Member

Delete Contact in batches

SOLVE

Hello Himanshu,

 

Thanks a lot for your quick reply ! 

 

Have a nice day 😉

 

AlexLHW  

0 Upvotes