# Custom Object API Key

**URL:** <https://community.hubspot.com/t/custom-object-api-key/64021>\
**Category:** APIs & Integrations\
**Tags:** developer-tools, oauth\
**Created:** [August 30, 2022, 9:50am UTC](https://community.hubspot.com/t/custom-object-api-key/64021 "2022-08-30T09:50:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dougfairbro](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dougfairbro/32/87988_2.png) [@dougfairbro](https://community.hubspot.com/u/dougfairbro)\
**Post date:** [August 30, 2022, 9:50am UTC](https://community.hubspot.com/t/custom-object-api-key/64021/1 "2022-08-30T09:50:24Z")

</div>

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: [Accounts Dashboard | HubSpot](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!

---

<div class="post-metadata">

**Author:** ![LeeBartelme](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/leebartelme/32/95647_2.png) [@LeeBartelme](https://community.hubspot.com/u/LeeBartelme)\
**Post date:** [August 30, 2022, 3:10pm UTC](https://community.hubspot.com/t/custom-object-api-key/64021/2 "2022-08-30T15:10:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![PPaduch](https://avatars.discourse-cdn.com/v4/letter/p/cab0a1/32.png) [@PPaduch](https://community.hubspot.com/u/PPaduch)\
**Post date:** [August 31, 2022, 3:18pm UTC](https://community.hubspot.com/t/custom-object-api-key/64021/3 "2022-08-31T15:18:42Z")

</div>

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](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!

---

<div class="post-metadata">

**Author:** ![LeeBartelme](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/leebartelme/32/95647_2.png) [@LeeBartelme](https://community.hubspot.com/u/LeeBartelme)\
**Post date:** [August 31, 2022, 3:21pm UTC](https://community.hubspot.com/t/custom-object-api-key/64021/4 "2022-08-31T15:21:28Z")

</div>

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.

```lia-code-sample
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"
}'

```

---

<div class="post-metadata">

**Author:** ![PPaduch](https://avatars.discourse-cdn.com/v4/letter/p/cab0a1/32.png) [@PPaduch](https://community.hubspot.com/u/PPaduch)\
**Post date:** [August 31, 2022, 4:02pm UTC](https://community.hubspot.com/t/custom-object-api-key/64021/5 "2022-08-31T16:02:46Z")

</div>

Thank you!

---

<div class="post-metadata">

**Author:** ![dougfairbro](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dougfairbro/32/87988_2.png) [@dougfairbro](https://community.hubspot.com/u/dougfairbro)\
**Post date:** [September 1, 2022, 8:05am UTC](https://community.hubspot.com/t/custom-object-api-key/64021/6 "2022-09-01T08:05:17Z")

</div>

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.
