# Custom Object API error

**URL:** <https://community.hubspot.com/t/custom-object-api-error/27476>\
**Category:** APIs & Integrations\
**Tags:** companies, developer-tools, contacts\
**Created:** [November 2, 2020, 7:17am UTC](https://community.hubspot.com/t/custom-object-api-error/27476 "2020-11-02T07:17:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaoki](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kaoki/32/6438_2.png) [@kaoki](https://community.hubspot.com/u/kaoki)\
**Post date:** [November 2, 2020, 7:17am UTC](https://community.hubspot.com/t/custom-object-api-error/27476/1 "2020-11-02T07:17:35Z")

</div>

Hello community.

I`m trying to create a custom object with API（ **POST** /crm-object-schemas/v3/schemas）

I get error when I specify property type “number” or “date”.（only “string” works fine.）

Please advise.

Thank you and best regards.

**error message**

{

“status”: “error”,

“message”: “Unexpected property type ‘date’, expected one of: [string, object\_coordinates, json]”,

“correlationId”: “5caa8194-4a96-4f6f-b832-2e373b25ba7f”,

“category”: “VALIDATION\_ERROR”

}

**request (curl)**

curl --location --request POST ‘[https://api.hubapi.com/crm-object-schemas/v3/schemas?hapikey=](https://api.hubapi.com/crm-object-schemas/v3/schemas?hapikey=){ API\_KEY }’ \

--header ‘Content-Type: application/json’ \

--data-raw '{

“name”: “shipment”,

“labels”: {

“singular”: “出荷”,

“plural”: “出荷”

},

“primaryDisplayProperty”: “name”,

“secondaryDisplayProperty”: [

“code”,

“unit\_price”

],

“requiredProperties”: [

“name”,

“code”,

“unit\_price”

],

“searchableProperties”: [

“name”,

“code”,

“unit\_price”

],

“properties”: [

{

“name”: “no”,

“label”: “出荷伝票No”,

“hasUniqueValue”: true,

“type”: “string”,

“displayOrder”: 1

},

{

“name”: “status”,

“label”: “ステータス”,

“type”: “string”

},

{

“name”: “date”,

“label”: “出荷予定日”,

“type”: “date”

}

]

}’

---

<div class="post-metadata">

**Author:** ![quentin\_lamamy](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/quentin_lamamy/32/20212_2.png) [@quentin\_lamamy](https://community.hubspot.com/u/quentin_lamamy)\
**Post date:** [November 2, 2020, 12:36pm UTC](https://community.hubspot.com/t/custom-object-api-error/27476/2 "2020-11-02T12:36:08Z")

</div>

Hi @kaoki Can you post your api request log ?

 ![33610i7575612D979FF4F0.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/8/483c244e175a736fa9ea5ec82c459d8d7d5d9534.png)

---

<div class="post-metadata">

**Author:** ![Seramlo](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/seramlo/32/29368_2.png) [@Seramlo](https://community.hubspot.com/u/Seramlo)\
**Post date:** [November 17, 2020, 12:02pm UTC](https://community.hubspot.com/t/custom-object-api-error/27476/3 "2020-11-17T12:02:43Z")

</div>

Same error here with property type “date” and “datetime”, using postman and testing from API docs:

HTTP 400

{  
“status”: “error”,  
“message”: “Unexpected property type ‘date’, expected one of: [string, object\_coordinates, json]”,  
“correlationId”: “21ef7877-b0cb-492b-a755-32ed9625b411”,  
“category”: “VALIDATION\_ERROR”  
}

---

<div class="post-metadata">

**Author:** ![spotthehub](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/spotthehub/32/98942_2.png) [@spotthehub](https://community.hubspot.com/u/spotthehub)\
**Post date:** [November 17, 2020, 8:09pm UTC](https://community.hubspot.com/t/custom-object-api-error/27476/4 "2020-11-17T20:09:19Z")

</div>

I also seem to not be able to create a custom object and set a required date/datetime field:

**Here is the request:**

var request = require(“request”);

var options = {

method: ‘POST’,

url: ‘[https://api.hubapi.com/crm/v3/schemas](https://api.hubapi.com/crm/v3/schemas)’,

qs: {hapikey: ‘YOUR\_API\_KEY’},

headers: {accept: ‘application/json’, ‘content-type’: ‘application/json’},

body: {

```
labels: {singular: 'Virtual Event', plural: 'Virtual Events'},

requiredProperties: \['virtual\_event\_title', 'virtual\_event\_date'],

name: 'virtual\_event',

primaryDisplayProperty: 'virtual\_event\_title',

properties: \[

  {

    name: 'virtual\_event\_title',

    label: 'Virtual Event Title',

    isPrimaryDisplayLabel: true,

    type: 'string'

  },

  {name: 'virtual\_event\_date', label: 'Virtual Event Date', type: 'date'}

],

associatedObjects: \['CONTACT', 'COMPANY'],

metaType: 'PORTAL\_SPECIFIC',

secondaryDisplayProperties: \['virtual\_event\_date','date']

```

},

json: true

};

request(options, function (error, response, body) {

if (error) throw new Error(error);

console.log(body);

});

**Response:**

{  
status: ‘error’,  
message: “Unexpected property type ‘date’, expected one of: [string, object\_coordinates, json]”,  
correlationId: ‘300fe4d9-3043-4c06-bacb-e6c46e55fc80’,  
category: ‘VALIDATION\_ERROR’  
}

Not sure if I’m doing something wrong or if there is a bug in the API or documentation.

---

<div class="post-metadata">

**Author:** ![spotthehub](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/spotthehub/32/98942_2.png) [@spotthehub](https://community.hubspot.com/u/spotthehub)\
**Post date:** [November 18, 2020, 4:45pm UTC](https://community.hubspot.com/t/custom-object-api-error/27476/5 "2020-11-18T16:45:51Z")

</div>

I figured out the issue. The documentation on this page: [https://developers.hubspot.com/docs/api/crm/crm-custom-objects?\_ga=2.165441468.2023144461.1605542585-1624948680.1599571013](https://developers.hubspot.com/docs/api/crm/crm-custom-objects?_ga=2.165441468.2023144461.1605542585-1624948680.1599571013)

is missing the field property of [fieldType:'date] when you generate the example code.

This would be the whole request:

{name: ‘date\_property\_name’, label: ‘Date Property Label’, type: ‘date’, fieldType:‘date’}

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [November 18, 2020, 6:46pm UTC](https://community.hubspot.com/t/custom-object-api-error/27476/6 "2020-11-18T18:46:43Z")

</div>

@spotthehub !

You beat me to the punch!

---

<div class="post-metadata">

**Author:** ![kaoki](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kaoki/32/6438_2.png) [@kaoki](https://community.hubspot.com/u/kaoki)\
**Post date:** [November 19, 2020, 1:21am UTC](https://community.hubspot.com/t/custom-object-api-error/27476/7 "2020-11-19T01:21:20Z")

</div>

@spotthehub

This works for me.

Thank you.
