Create a custom object

I have a POST request to https://api.hubapi.com/crm/v3/schemas in order to create a custom object. I`m using a private app access token to authenticate. I also enabled the following scopes on the private app

  • crm.objects.custom.write
  • crm.objects.custom.read
  • crm.schemas.custom.write
  • crm.schemas.custom.read

The object passed is exactly the same from this example How to Build a Custom Object Using Private Apps

{
 "associatedObjects": [
 "CONTACT"
 ],
 "labelPlural": "Boats",
 "labelSingular": "Boat",
 "name": "boat",
 "primaryDisplayProperty": "model",
 "properties": [
 {
 "name": "condition",
 "label": "Condition",
 "type": "enumeration",
 "fieldType": "select",
 "options": [
 {
 "label": "New",
 "value": "new"
 },
 {
 "label": "Used",
 "value": "used"
 }
 ]
 },
 {
 "name": "date_received",
 "label": "Date received",
 "type": "date",
 "fieldType": "date"
 },
 {
 "name": "year",
 "label": "Year",
 "type": "number",
 "fieldType": "number"
 },
 {
 "name": "make",
 "label": "Make",
 "type": "string",
 "fieldType": "text"
 },
 {
 "name": "model",
 "label": "Model",
 "type": "string",
 "fieldType": "text"
 },
 {
 "name": "hin",
 "label": "HIN",
 "type": "string",
 "hasUniqueValue": true,
 "fieldType": "text"
 },
 {
 "name": "color",
 "label": "Color",
 "type": "string",
 "fieldType": "text"
 },
 {
 "name": "mileage",
 "label": "Mileage",
 "type": "number",
 "fieldType": "number"
 },
 {
 "name": "price",
 "label": "Price",
 "type": "number",
 "fieldType": "number"
 },
 {
 "name": "notes",
 "label": "Notes",
 "type": "string",
 "fieldType": "text"
 }
 ],
 "requiredProperties": [
 "year",
 "make",
 "hin",
 "model"
 ],
 "searchableProperties": [
 "year",
 "make",
 "hin",
 "model"
 ],
 "secondaryDisplayProperties": [
 "make"
 ]
}

I`m getting a 401 error, though:

 "message": "401 Unauthorized",
 "exceptionName": "org.springframework.web.client.HttpClientErrorException",
 "exceptionString": "org.springframework.web.client.HttpClientErrorException: 401 Unauthorized"

Other calls work ok. Anyone knows if is it possible to access POST https://api.hubapi.com/crm/v3/schemas via AccessToken?

Thanks.

Hey @rugregme,

Custom Objects is an enterprise feature so the first thing I’d do is check your subscription. You’ll need an enterprise edition of any of the following - Marketing, Sales, Service, CMS or Operations.

Let me know if that isn’t the case and we can go back to the drawing board. It seems like the most likely reason given that you’re getting a 401 error and all other requests are working.