Feb 23, 2021 4:45 PM
I created a custom object but deleted it. After that I try to create it again with different associations, I got below error. It says "p8013920_device" already exists. I already deleted it and I can't find it in my dashboard. Why do I get this error message?
```
Feb 25, 2021 4:23 AM
I didn't save the object id when I delete the custom object. What I can get is when I recreate the object, I see this output:
Feb 25, 2021 3:09 AM
The ObjectTypeId is returned with the call when you create a custom object.
Checkout the docmentation:
https://developers.hubspot.com/docs/api/crm/crm-custom-objects
and search for Fetching Object Schema.
Feb 26, 2021 4:59 AM
Could you give me some guidence on this? My project is completed blocked since I am not able to create a custom object and I am not able to delete the object either, so that I am not able to create the object.
when I create a object, I get this error:
Feb 26, 2021 5:02 AM
How do you get the ObjectId? Had you saved it? It looks you are using the wrong objectId
Feb 26, 2021 5:06 AM
I got the ID when I run get schema with archived=true. Then I tried to delete/purge it but both failed. After that I can't get the ID from `get` anymore. So the question now is how to get and delete the old object?
Feb 24, 2021 4:08 AM
Hi @JZhao
https://developers.hubspot.com/docs/api/crm/crm-custom-objects
You can only delete a custom object after all object instances of that type are deleted. To delete a custom object, use:
DELETE https://api.hubapi.com/crm/v3/schemas/{objectType}. If you need to create a new custom object with the same name as the deleted object, you must hard delete the schema by DELETE https://api.hubapi.com/crm/v3/schemas/{objectType}?archived=true
There are two endpoints:
DELETE /crm/v3/schemas/{objectType}/purge
DELETE /crm/v3/schemas/{objectType}
I used the NodeJS library of Hubspot and there I have to use to different functions:
hubspotClient.crm.schemas.coreApi.archive(fullyQualifiedName) where fullyQualifiedName = p99688696_car in the Cars Examle in the documentation
hubspotClient.crm.schemas.defaultApi.purge(objectTypeId) where objectTypeId = 2-529881 in the Cars Examle in the documentation;
Greets Ronald
Feb 24, 2021 10:20 PM
I tried to run purge API but it returns this error. Is the object type mean object id? if not what object type I should put in the request?
Feb 24, 2021 2:47 AM
Hi @JZhao ,
After you delete, you will need to purge to fully remove the schema:
/crm-object-schemas/v3/schemas/{objectType}/purge
Greets,
Ronald
Feb 24, 2021 3:53 AM
@RMones could you send me the link for this API doc? I tried but got an error not sure what I did wrong
Aug 18, 2022 9:30 AM
Did you ever sort this out? I am getting the same response trying to purge a deleted object.