Error with datetime property

Hello Developer Community!

I’m trying to create a field that includes date and time using the HubSpot API documentation. I’m using the following endpoint:

I’ve set up all the necessary parameters and added the token from our private app, which is receiving API calls correctly.

The generated payload is as follows:

curl --request POST \

--url https://api.hubapi.com/crm/v3/properties/contact \

--header ‘authorization: Bearer YOUR_ACCESS_TOKEN’ \

--header ‘content-type: application/json’ \

--data '{

“hidden”: false,

“displayOrder”: 2,

“description”: “Recuperar fecha y hora del showroom”,

“label”: “TestDateTime”,

“type”: “datetime”,

“groupName”: “contactinformation”,

“name”: “createdatetime”,

“fieldType”: “date”,

“formField”: true,

“referencedObjectType”: “string”,

“calculationFormula”: “string”,

“hasUniqueValue”: false,

“externalOptions”: true

}’

The error message we’re receiving is as follows:

HTTP 400

{

“status”: “error”,

“message”: “Property failed validation.”,

“correlationId”: “6db07f03-1611-4fbd-a15c-4b454fad7fd9”,

“category”: “VALIDATION_ERROR”,

“subCategory”: “Properties.PROPERTY_CREATE_FAILED_VALIDATION”

}
I’ve carefully checked all the input parameters and everything seems to be in order. Can anyone help me understand why it’s not working or what I might be doing wrong?

Hey @Ael31 ,
I’m guessing you’ve removed the token here from the payload even though you’ve mentioned its the outputed payload but first thing would be to just make sure you have that placed in there correctly, 2nd thing would be to check if the token/private app has the requiered permissions all though that doesn’t seem to be the outputted error.
Can you try making an API call with just these parameters and removing the rest. Its possible you’re trying to set a property that shouldnt be set on datetime properties.

groupName: "groupname"
label: "label"
name: "name"
type: datetime
fieldType: "date"
description: "description"
formField: true

Hello @Ael31
I currently have the same problem, did you find a solution ?

Hi @HSchaefer9 , @Ael31
I saw that this thread hasn’t gotten any further attention so I just wanted to quickly bring up that theres an app (made by us hah) that solves for this.
You can use UI extensions in the record view to create datetime properties via a form without needing to mess with the API.
If you’d like to take a look at app you can find it here.
The UI extensions come unlocked at the proffesional tier of the app so if you’re looking to extend your use with datetime properties (creating, editing, workflows) then this is the app for it.
If not and just want to stick with the API approach I’ve outlined a potential fix below, if that doesn’t work for you could you share what error your getting so I could help investigate further.
Thanks,
Anze