# Error when posting/creating datetime property (HTTP 400 error)

**URL:** <https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608>\
**Category:** APIs & Integrations\
**Tags:** timeline-and-extensions-apis\
**Created:** [March 27, 2024, 10:52pm UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608 "2024-03-27T22:52:48Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![CMyhra](https://avatars.discourse-cdn.com/v4/letter/c/4da419/32.png) [@CMyhra](https://community.hubspot.com/u/CMyhra)\
**Post date:** [March 27, 2024, 10:52pm UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/1 "2024-03-27T22:52:48Z")

</div>

When trying to create the datetime property, here’s the error I get. Can someone help??

HTTP 400 { “status”: “error”, “message”: “Property failed validation.”, “correlationId”: “cd9d4de0-6715-46b2-97e0-70ac559142e3”, “category”: “VALIDATION\_ERROR”, “subCategory”: “Properties.PROPERTY\_CREATE\_FAILED\_VALIDATION” }

Here’s my input:

curl --request POST \  
--url [https://api.hubapi.com/crm/v3/properties/contacts](https://api.hubapi.com/crm/v3/properties/contacts) \  
--header ‘authorization: Bearer YOUR\_ACCESS\_TOKEN’ \  
--header ‘content-type: application/json’ \  
--data ‘{  
“hidden”: false,  
“displayOrder”: 2,  
“description”: “datetime”,  
“label”: “DateTime”,  
“type”: “datetime”,  
“groupName”: “contactinformation”,  
“name”: “datetime”,  
“fieldType”: “date”,  
“formField”: true,  
“referencedObjectType”: “string”,  
“calculationFormula”: “string”,  
“hasUniqueValue”: false,  
“externalOptions”: true  
}’

---

<div class="post-metadata">

**Author:** ![Humashankar](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/humashankar/32/30856_2.png) [@Humashankar](https://community.hubspot.com/u/Humashankar)\
**Post date:** [March 28, 2024, 1:53am UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/2 "2024-03-28T01:53:13Z")

</div>

Hi @CMyhra

Please find the technicals of the HTTP 400

[New validation for custom object names (hubspot.com)](https://developers.hubspot.com/changelog/new-validation-for-custom-object-names)

Custom object schemas

[CRM | custom objects (hubspot.com)](https://developers.hubspot.com/docs/api/crm/crm-custom-objects)

Kindly to trouble shoot and keep us posted for additional assistance.

Hope this helps - Happy to help further!!  
Thank you very much and have a great one!

Warm regards

---

<div class="post-metadata">

**Author:** ![HSchaefer9](https://avatars.discourse-cdn.com/v4/letter/h/a9adbd/32.png) [@HSchaefer9](https://community.hubspot.com/u/HSchaefer9)\
**Post date:** [April 18, 2024, 4:31pm UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/3 "2024-04-18T16:31:58Z")

</div>

Hello @CMyhra , i have EXACTLY the same error when trying to post a new datetime property. Do you have a solution ?

---

<div class="post-metadata">

**Author:** ![Humashankar](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/humashankar/32/30856_2.png) [@Humashankar](https://community.hubspot.com/u/Humashankar)\
**Post date:** [April 24, 2024, 2:13am UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/4 "2024-04-24T02:13:37Z")

</div>

Hi @CMyhra - Kindly take a look in to my recent response and code and see if that helps

---

<div class="post-metadata">

**Author:** ![ADitlevsen](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@ADitlevsen](https://community.hubspot.com/u/ADitlevsen)\
**Post date:** [April 22, 2024, 12:13pm UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/5 "2024-04-22T12:13:10Z")

</div>

Was a solution found for this issue?  
The error message is not helpful. I am having the same issue, trying to create a datetime property on contacts.

---

<div class="post-metadata">

**Author:** ![Humashankar](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/humashankar/32/30856_2.png) [@Humashankar](https://community.hubspot.com/u/Humashankar)\
**Post date:** [April 24, 2024, 2:14am UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/6 "2024-04-24T02:14:01Z")

</div>

Hi @ADitlevsen

Kindly take a look in to my recent response and code and see if that helps

---

<div class="post-metadata">

**Author:** ![GIlievski](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/gilievski/32/38539_2.png) [@GIlievski](https://community.hubspot.com/u/GIlievski)\
**Post date:** [April 24, 2024, 1:20am UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/7 "2024-04-24T01:20:04Z")

</div>

Yeah, I am also having the same issues. I can’t find any reason why the validation would fail. I have done this many times in the past. Not sure if there has been a change in the validation requirements?

---

<div class="post-metadata">

**Author:** ![Humashankar](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/humashankar/32/30856_2.png) [@Humashankar](https://community.hubspot.com/u/Humashankar)\
**Post date:** [April 24, 2024, 1:57am UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/8 "2024-04-24T01:57:38Z")

</div>

Hi @GIlievski

Per @CMyhra code,

When I closely looked in to the code, noticed the inconsistency between type and fieldType:

- The type “datetime” which is correct for a datetime property.
- However, the fieldType is set to “date”. This field type expects only date information (year, month, day) and not time.

Can you try change the fieldType to “datetime” to match the type – a sample code reference is given below

JSON

{

“hidden”: false,

“displayOrder”: 2,

“description”: “datetime”,

“label”: “DateTime”,

“type”: “datetime”,

“groupName”: “contactinformation”,

“name”: “datetime”,

“fieldType”: “datetime”, // Change here

“formField”: true,

“referencedObjectType”: “string”,

“calculationFormula”: “string”,

“hasUniqueValue”: false,

“externalOptions”: true

}

Regards

---

<div class="post-metadata">

**Author:** ![AIsmail91](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AIsmail91](https://community.hubspot.com/u/AIsmail91)\
**Post date:** [July 11, 2024, 12:12pm UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/9 "2024-07-11T12:12:23Z")

</div>

Hello,  
I am facing the same issue and when I try to select Datetime as Field Type I cannot find it among the available options:

 ![AIsmail91_1-1720699897821.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/2X/c/c9555dc45d4bf634723bc7d9a09a38743e6d32f7.jpeg)

 ![AIsmail91_2-1720699928100.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/3X/1/c/1c1f208e06e6bba4956d5d2d8f2534db806a1aa5.jpeg)

Thanks,

Aalaa

---

<div class="post-metadata">

**Author:** ![GIlievski](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/gilievski/32/38539_2.png) [@GIlievski](https://community.hubspot.com/u/GIlievski)\
**Post date:** [July 12, 2024, 1:10am UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/10 "2024-07-12T01:10:33Z")

</div>

Hey Aalaa,

You can now create them with the UI. There is a free beta for any HubSpot tier.

Just replace your portal ID in the link below and opt into the beta.

[https://app.hubspot.com/product-updates/[portalID]/?update=13941230](https://app.hubspot.com/product-updates/%5BportalID%5D/?update=13941230)

---

<div class="post-metadata">

**Author:** ![AIsmail91](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AIsmail91](https://community.hubspot.com/u/AIsmail91)\
**Post date:** [July 15, 2024, 7:17am UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/11 "2024-07-15T07:17:25Z")

</div>

Hello Goran,

Thanks for your response.

Yes, for the property type I don’t face any issues, I select datetime:

 ![AIsmail91_1-1721027653043.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/d/b/db39dc68d54088ea3a408aa90f5a4fe589e45619.png)

I mean after I select the type parameter, there is another parameter called fieldTypeI don’t find the same “datetime” in fieldType:

 ![AIsmail91_0-1721027512287.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/f/2/f2f782ca0cd685e2e61391560557561f28d6cea9.png)

I followed the link you provided and joined the beta, but it’s still the same, gives me validation error for all the fieldTypes that I tried since they don’t match the Type (datetime):  
curl --request POST \  
--url [https://api.hubapi.com/crm/v3/properties/contacts](https://api.hubapi.com/crm/v3/properties/contacts) \  
--header ‘authorization: Bearer YOUR\_ACCESS\_TOKEN’ \  
--header ‘content-type: application/json’ \  
--data ‘{  
“hidden”: false,  
“displayOrder”: 2,  
“description”: “string”,  
“label”: “DateTime Test”,  
“type”: “datetime”,  
“groupName”: “contactinformation”,  
“name”: “datetimetest”,  
“fieldType”: “date”,  
“formField”: true,  
“referencedObjectType”: “string”,  
“options”: [  
{  
“label”: “Option A”,  
“value”: “A”,  
“hidden”: false,  
“description”: “Choice number one”,  
“displayOrder”: 1  
},  
{  
“label”: “Option B”,  
“value”: “B”,  
“hidden”: false,  
“description”: “Choice number two”,  
“displayOrder”: 2  
}  
],  
“calculationFormula”: “string”,  
“hasUniqueValue”: false,  
“externalOptions”: true  
}’

---

<div class="post-metadata">

**Author:** ![AIsmail91](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AIsmail91](https://community.hubspot.com/u/AIsmail91)\
**Post date:** [July 15, 2024, 7:24am UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/12 "2024-07-15T07:24:21Z")

</div>

Hello Goran,

thanks for your response!

Yes when I try to select “datetime” for the Type Parameter, that works fine:

 ![AIsmail91_0-1721028166658.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/b/1/b1cf325d1fe72e412e3a4fac21b418dbc12e3e94.png)

However, what I mean is after that, I have to also select the fieldType parameter, that one doesn’t have the datetime option even after I joined the beta and followed the stepsyou provided:

 ![AIsmail91_1-1721028229060.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/3/a/3a90c5a331b776611bde59e4136ad733fcec150d.png)

Please find the request below, which gives me a validation error:

curl --request POST \  
--url [https://api.hubapi.com/crm/v3/properties/contacts](https://api.hubapi.com/crm/v3/properties/contacts) \  
--header ‘authorization: Bearer YOUR\_ACCESS\_TOKEN’ \  
--header ‘content-type: application/json’ \  
--data ‘{  
“hidden”: false,  
“displayOrder”: 2,  
“description”: “string”,  
“label”: “DateTime Test”,  
“type”: “datetime”,  
“groupName”: “contactinformation”,  
“name”: “datetimetest”,  
“fieldType”: “textarea”,  
“formField”: true,  
“referencedObjectType”: “string”,  
“options”: [  
{  
“label”: “Option A”,  
“value”: “A”,  
“hidden”: false,  
“description”: “Choice number one”,  
“displayOrder”: 1  
},  
{  
“label”: “Option B”,  
“value”: “B”,  
“hidden”: false,  
“description”: “Choice number two”,  
“displayOrder”: 2  
}  
],  
“calculationFormula”: “string”,  
“hasUniqueValue”: false,  
“externalOptions”: true  
}’

Thanks,

Aalaa

---

<div class="post-metadata">

**Author:** ![GIlievski](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/gilievski/32/38539_2.png) [@GIlievski](https://community.hubspot.com/u/GIlievski)\
**Post date:** [July 16, 2024, 7:37am UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/13 "2024-07-16T07:37:10Z")

</div>

Hey Aalaa,

The beta now allows you to create Date Time in the HubSpot UI, it has nothing to do with the API. So you would go to create a new property and then choose Datetime

 ![Screenshot 2024-07-16 at 5.29.45 PM.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/c/a/ca4930a2b0526fa53eb22b6994ba2d44c2f6c62c.png)

As for the API creation, the “fieldType” parameter never had DateTime as an option, it always stays as Date. Only the “type” needs to be DateTime.

From your request I can see you have selected “textarea” as fieldType, that should be “Date”. Also make sure you have delete all the “Options” and leave blank the fields “reference object type” and “calculation formula”.

---

<div class="post-metadata">

**Author:** ![Humashankar](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/humashankar/32/30856_2.png) [@Humashankar](https://community.hubspot.com/u/Humashankar)\
**Post date:** [April 24, 2024, 1:58am UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/14 "2024-04-24T01:58:44Z")

</div>

@GIlievski If incase you can share your code, i can look in to the actual issue - the below solution may not be the solution for yours.

---

<div class="post-metadata">

**Author:** ![GIlievski](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/gilievski/32/38539_2.png) [@GIlievski](https://community.hubspot.com/u/GIlievski)\
**Post date:** [April 24, 2024, 2:34am UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/15 "2024-04-24T02:34:02Z")

</div>

Thanks @Humashankar  
We are trying to create a property for Contacts, so it has nothing to do with custom objects.  
Also, the type can be “datetime” or “date”, but the fieldType can only be “date”.  
If you go to this link [Accounts Dashboard | HubSpot](https://developers.hubspot.com/docs/api/crm/properties) under Endpoints \> Create Property (Core) you can see the values for both Type and Field Type. They are dropdown values.  
Again I have done this a few times in the past but something might have changed.

---

<div class="post-metadata">

**Author:** ![GIlievski](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/gilievski/32/38539_2.png) [@GIlievski](https://community.hubspot.com/u/GIlievski)\
**Post date:** [April 24, 2024, 3:25am UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/16 "2024-04-24T03:25:28Z")

</div>

Okay I solved my issue, not sure if it will help you @ADitlevsen @CMyhra @HSchaefer9  
All I did was leave blank the fields “reference object type” and “calculation formula” and it worked.  
I did use the new [Beta docs](https://developers.hubspot.com/beta-docs/reference/api/crm/properties#post-%2Fcrm%2Fv3%2Fproperties%2F%7Bobjecttype%7D), not that it matters.  
cc @Humashankar

 ![965674_1_Screenshot 2024-04-24 at 1.18.38 PM.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/c/4/c4e995ca8f9b63cc390bfcd4402edd0b64ccb588.png)

---

<div class="post-metadata">

**Author:** ![PropelYachts](https://avatars.discourse-cdn.com/v4/letter/p/7cd45c/32.png) [@PropelYachts](https://community.hubspot.com/u/PropelYachts)\
**Post date:** [May 4, 2024, 1:57am UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/17 "2024-05-04T01:57:01Z")

</div>

Hello I’m trying to add a datetime property inside Deals but I’m getting some error

curl --request POST \  
--url [https://api.hubapi.com/crm/v3/properties/string](https://api.hubapi.com/crm/v3/properties/string) \  
--header ‘authorization: Bearer YOUR\_ACCESS\_TOKEN’ \  
--header ‘content-type: application/json’ \  
--data ‘{  
“hidden”: false,  
“displayOrder”: 2,  
“description”: “Depart Time Date”,  
“label”: “Depart Time Date”,  
“type”: “datetime”,  
“groupName”: “dealinformation”,  
“name”: “departdatetime”,  
“fieldType”: “date”,  
“formField”: false,  
“referencedObjectType”: “string”,  
“calculationFormula”: “string”,  
“hasUniqueValue”: false,  
“externalOptions”: false  
}’

AND THE ERROR

HTTP 400

{  
“status”: “error”,  
“message”: “Unable to infer object type from: string”,  
“correlationId”: “396069f9-1f6b-4262-9345-d4f884730b11”  
}

---

<div class="post-metadata">

**Author:** ![GIlievski](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/gilievski/32/38539_2.png) [@GIlievski](https://community.hubspot.com/u/GIlievski)\
**Post date:** [May 4, 2024, 11:24am UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/18 "2024-05-04T11:24:19Z")

</div>

> * * *
> 
> @PropelYachts wrote:
> 
> Hello I’m trying to add a datetime property inside Deals but I’m getting some error
> 
> curl --request POST \  
> --url [https://api.hubapi.com/crm/v3/properties/string](https://api.hubapi.com/crm/v3/properties/string) \  
> --header ‘authorization: Bearer YOUR\_ACCESS\_TOKEN’ \  
> --header ‘content-type: application/json’ \  
> --data ‘{  
> “hidden”: false,  
> “displayOrder”: 2,  
> “description”: “Depart Time Date”,  
> “label”: “Depart Time Date”,  
> “type”: “datetime”,  
> “groupName”: “dealinformation”,  
> “name”: “departdatetime”,  
> “fieldType”: “date”,  
> “formField”: false,  
> “referencedObjectType”: “string”,  
> “calculationFormula”: “string”,  
> “hasUniqueValue”: false,  
> “externalOptions”: false  
> }’
> 
> AND THE ERROR
> 
> HTTP 400
> 
> {  
> “status”: “error”,  
> “message”: “Unable to infer object type from: string”,  
> “correlationId”: “396069f9-1f6b-4262-9345-d4f884730b11”  
> }
> 
> * * *

Try leaving “referencedObjectType” and “calculationFormula” empty not as “string” @PropelYachts. It worked for me

---

<div class="post-metadata">

**Author:** ![PropelYachts](https://avatars.discourse-cdn.com/v4/letter/p/7cd45c/32.png) [@PropelYachts](https://community.hubspot.com/u/PropelYachts)\
**Post date:** [May 6, 2024, 1:57pm UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/19 "2024-05-06T13:57:37Z")

</div>

curl --request POST \  
--url [https://api.hubapi.com/crm/v3/properties/](https://api.hubapi.com/crm/v3/properties/) \  
--header ‘authorization: Bearer YOUR\_ACCESS\_TOKEN’ \  
--header ‘content-type: application/json’ \  
--data ‘{  
“hidden”: false,  
“displayOrder”: 2,  
“description”: “Depart Time Date”,  
“label”: “Depart”,  
“type”: “datetime”,  
“groupName”: “dealinformation”,  
“name”: “departdatetime”,  
“fieldType”: “date”,  
“formField”: true,  
“hasUniqueValue”: false,  
“externalOptions”: true  
}’

AND RESULT NOW IS

HTTP 404

---

<div class="post-metadata">

**Author:** ![GIlievski](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/gilievski/32/38539_2.png) [@GIlievski](https://community.hubspot.com/u/GIlievski)\
**Post date:** [May 7, 2024, 12:22am UTC](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608/20 "2024-05-07T00:22:48Z")

</div>

Hey @PropelYachts I think see the issue. For objectType you have no value. It needs to be Deals in your case.

 ![972247_1_Screenshot 2024-05-07 at 10.21.04 AM.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/6/1/614030d4fa0f2f61f8ade613756f43a75710c927.png)

[Next page](https://community.hubspot.com/t/error-when-posting-creating-datetime-property-http-400-error/103608.md?page=2)
