Can't delete a customer object

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?

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,

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?

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,

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

Hi @JZhao

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

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?

See this link for how to delete a custom object schema completely.

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

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