APIs & Integrations

dougfairbro
Contributor | Diamond Partner
Contributor | Diamond Partner

Custom Object API Key

SOLVE

I'm trying to set up a custom object in my demo portal to get more of an understanding of how custom objects work for my personal development. 

 

I've followed the schema set-up here: https://developers.hubspot.com/docs/api/crm/crm-custom-objects

 

As API keys have been sunsetted I've set up a private app labelled Fields_Custom_Object and gave it scope for all read & writing options. 

 

However when I run the schema it comes up with an error that my API key is invalid. Can anyone please advise?

 

Thanks!

0 Upvotes
1 Accepted solution
dougfairbro
Solution
Contributor | Diamond Partner
Contributor | Diamond Partner

Custom Object API Key

SOLVE

Forgive me I figured it out. I simply needed to select the four custom object options in the scope (nothing else) and then use Postman to push it live. 

 

Thanks all for your contributions.

View solution in original post

0 Upvotes
5 Replies 5
dougfairbro
Solution
Contributor | Diamond Partner
Contributor | Diamond Partner

Custom Object API Key

SOLVE

Forgive me I figured it out. I simply needed to select the four custom object options in the scope (nothing else) and then use Postman to push it live. 

 

Thanks all for your contributions.

0 Upvotes
LeeBartelme
HubSpot Employee
HubSpot Employee

Custom Object API Key

SOLVE

Can you provide the code of your call? Did you make sure to implement the new key differently than the old key. The new key goes in an authorization header.

0 Upvotes
PPaduch
Member

Custom Object API Key

SOLVE

HI @LeeBartelme I got the same issue

Here is the code: 

curl --request POST \
--url 'https://api.hubapi.com/crm/v3/schemas?hapikey=YOUR_ACCESS_TOKEN' \
--header 'content-type: application/json' \
--data '{
"labels": {
"singular": "Plausible ",
"plural": "Plausile"
},
"requiredProperties": [
"Device"
],
"secondaryDisplayProperties": [
"Country"
],
"properties": [
{
"name": "device",
"label": "Device",
"isPrimaryDisplayLabel": true,
"type": "string"
}
],
"associatedObjects": [
"CONTACT"
],
"name": "Plausible",
"primaryDisplayProperty": "Device",
"metaType": "PORTAL_SPECIFIC"
}'


Thank you in advance!

 

0 Upvotes
LeeBartelme
HubSpot Employee
HubSpot Employee

Custom Object API Key

SOLVE

I don't know why the documentation currently doesn't have the example correct. But the private app key should go as a header. See other endpoints for similar examples of token usage.

 

curl --request POST \
--url 'https://api.hubapi.com/crm/v3/schemas' \
--header 'content-type: application/json' \
--header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
--data '{
"labels": {
"singular": "Plausible ",
"plural": "Plausile"
},
"requiredProperties": [
"Device"
],
"secondaryDisplayProperties": [
"Country"
],
"properties": [
{
"name": "device",
"label": "Device",
"isPrimaryDisplayLabel": true,
"type": "string"
}
],
"associatedObjects": [
"CONTACT"
],
"name": "Plausible",
"primaryDisplayProperty": "Device",
"metaType": "PORTAL_SPECIFIC"
}'

 

0 Upvotes
PPaduch
Member

Custom Object API Key

SOLVE

Thank you! 

0 Upvotes