APIs & Integrations

JZhao
Participant

Can't delete a customer object

SOLVE

What is the process to delete a customer object completely? I created a customer object and delete it by calling two APIs:

 

DELETE /crm/v3/schemas/{objectType}

DELETE /crm/v3/schemas/{objectType}/purge

 

both API returns successfully. However, I got "already existing" error when I try to re-create the object with the same name:

 

{
"status": "error",
"message": "p8013920_device already exists",
"correlationId": "7a19ce21-0e8b-4cee-8076-f7fa9bc4b0da",
"context": {
"name": [
"p8013920_device"
]
},
"category": "OBJECT_ALREADY_EXISTS",
"subCategory": "InboundDbObjectTypeError.OBJECT_TYPE_ALREADY_EXIST"
}
 
It keeps telling me the object already exists. How can I re-create the same object after deleting?
1 Accepted solution
rOsborn123
Solution
Contributor | Elite Partner
Contributor | Elite Partner

Can't delete a customer object

SOLVE

Hit this endpoint:
DELETE /crm/v3/schemas/{objectType}?archived=true
after hitting

DELETE /crm/v3/schemas/{objectType}
Then you'll be able to create a new custom object with the same name. It's in the docs and I've done it many times before 

View solution in original post

9 Replies 9
rOsborn123
Solution
Contributor | Elite Partner
Contributor | Elite Partner

Can't delete a customer object

SOLVE

Hit this endpoint:
DELETE /crm/v3/schemas/{objectType}?archived=true
after hitting

DELETE /crm/v3/schemas/{objectType}
Then you'll be able to create a new custom object with the same name. It's in the docs and I've done it many times before 

JZhao
Participant

Can't delete a customer object

SOLVE

I already did DELETE /crm/v3/schemas/{objectType}?archived=true but it shows it doesn't exist error.

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Can't delete a customer object

SOLVE

Hi @JZhao 

Make sure that there are no records exist  within the the Custom Object before using the DELETE /crm/v3/schemas/{objectType}

JZhao
Participant

Can't delete a customer object

SOLVE

As I already mentioned in the question, the two API are run successfully

 

DELETE /crm/v3/schemas/{objectType}

DELETE /crm/v3/schemas/{objectType}/purge

 

that means no records exist otherwise these API will fail.

 

The question is how to recreate the object with the same name. It doesn't allow me to create the customer object with the same name and the error is object already exists. How can I delete the customer object completely?

0 Upvotes
mathew_murphy
Participant

Can't delete a customer object

SOLVE
0 Upvotes
himanshurauthan
Thought Leader | Elite Partner
Thought Leader | Elite Partner

Can't delete a customer object

SOLVE

Hi @JZhao,

 

Are you deleting the objects first before making the delete request?

 

Before deleting the schema, any existing records of this schema must be deleted first otherwise, this call will fail.

If it's a success then please make sure after fetching the schema again, check if it includes the deleted one or not.

 

Regards,

 

Digital Marketing & Inbound Expert In Growth Hacking Technology
JZhao
Participant

Can't delete a customer object

SOLVE

I already deleted all objects for the secheme. I am able to query sechema with archive=true which means they are not deleted completely. I have tried to delete and purge them as I mentioned above but none of them works. How can I delete them?

himanshurauthan
Thought Leader | Elite Partner
Thought Leader | Elite Partner

Can't delete a customer object

SOLVE

Thank you for the clarification @JZhao.

 

I tested the same and haven't found any API to delete it completely.

 

What I'll suggest here is - if you want to re-use the schema, instead of recreating it let's update it.

 

But if we need the deleted endpoint, I hope someone from the HubSpot development team can answer it.

 

Regards,

Digital Marketing & Inbound Expert In Growth Hacking Technology
0 Upvotes
JZhao
Participant

Can't delete a customer object

SOLVE

Thanks @himanshurauthan , thanks for testing it. Do you know who can help on that?