How to delete property

I’m doing the following thing,
Im using ‘@hubspot/api-client’

I’m creating a schema with 3 properties (let’s call them prop1/2/3).
after a while, I need to delete one of the props, lets say prop3.
while trying to archive it by the use of `.crm.properties.coreApi.archive`
and I’m getting the following error:
```

“message”:“Property: prop2_9ixvlsia of object type 2-11327296 is currently used in 1 places and cannot be deleted”,“correlationId”:“234b23af-d50e-44bb-b1ba-92f8f6bcfdc8”,“errors”:[{“subCategory”:“PropertyValidationError.PROPERTY_USAGE”,“message”:“Property prop2_9ixvlsia of object type 2-11327296 in use by OBJECT_REQUIREMENT (display type OBJECT_REQUIREMENT) ID 2-11327296/150701085: Object Manager Settings”

```

what am I doing wrong here?
I already realized that its because my schema is still configured to use it, but I don’t know how to change my schema props list…any hint about how to do that?

Hey, @ExpliuM :waving_hand: I haven’t tested this yet, but have you tried updating your schema by making a PATCH request to — https://api.hubapi.com/crm/v3/schemas/*{objectTypeId}?* I am curious if we send a request with Prop 1 and Prop 2 set as required but don’t include Prop3 in the Required group, if it removes the “required” flag it and resolves the error.

I’ll try a test using Postman and post back here as well.

Talk soon! — Jaycee

Well, I’m afraid that’s not the solution because `ObjectTypeDefinitionPatch` gets only labels, requiredProperties, searchableProperties, primaryDisplayProperty, secondaryDisplayProperties and restorable.

I noticed that the response sends me to a page where I can change the schema
https://app.hubspot.com/object-manager-settings/23362975/creator-editor/2-11327296
after updating the schema via this link I do manage to archive the required property
but I’m interested in doing this same action via the API, any ideas?

adding here, ObjectTypeDefinitionPatch definition:
```

export declare class ObjectTypeDefinitionPatch {

‘labels’?: ObjectTypeDefinitionLabels;

‘requiredProperties’?: Array<string>;

‘searchableProperties’?: Array<string>;

‘primaryDisplayProperty’?: string;

‘secondaryDisplayProperties’?: Array<string>;

‘restorable’?: boolean;

```
and a Use example:
```

hubspot.Client({“accessToken”:“YOUR_ACCESS_TOKEN”});

const labels = {
“singular”: “My object”,
“plural”: “My objects”
};
const ObjectTypeDefinitionPatch = { labels, requiredProperties: [“my_object_property”], searchableProperties: [“my_object_property”], primaryDisplayProperty: “my_object_property” };
const objectType = “objectType”;
const apiResponse = await hubspotClient.crm.schemas.coreApi.update(objectType, ObjectTypeDefinitionPatch);
console.log(JSON.stringify(apiResponse.body, null, 2));
```

Found the solution, I should update the property not to be form field (formField=false) before I try to archive it.

Does this still work for you?

I’ve set a property to have formField = false and I still get told it’s on a form so I can’t remove it.

The form seems to be one that’s automatically created for any custom object schema, and it doesn’t show up if I fetch a list of forms via the API, so I’m stuck with how to delete a property via API.

HubSpot support tell me there’s no way to do it any more, so I started a discussion thread in ideas.