# Missing or Unknown Hub ID

**URL:** <https://community.hubspot.com/t/missing-or-unknown-hub-id/19182>\
**Category:** APIs & Integrations\
**Tags:** oauth\
**Created:** [March 3, 2020, 5:50pm UTC](https://community.hubspot.com/t/missing-or-unknown-hub-id/19182 "2020-03-03T17:50:58Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![avyer](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/avyer/32/1529_2.png) [@avyer](https://community.hubspot.com/u/avyer)\
**Post date:** [March 3, 2020, 5:50pm UTC](https://community.hubspot.com/t/missing-or-unknown-hub-id/19182/1 "2020-03-03T17:50:58Z")

</div>

Just wanted to clarify what is the cause of this error:

“status”: “BAD\_HUB”,  
“message”: “missing or unknown hub id”

Deleted hubspot and expired test portals doesnt seemed to produce the same error

Thanks!

---

<div class="post-metadata">

**Author:** ![WendyGoh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wendygoh/32/42320_2.png) [@WendyGoh](https://community.hubspot.com/u/WendyGoh)\
**Post date:** [March 4, 2020, 2:05am UTC](https://community.hubspot.com/t/missing-or-unknown-hub-id/19182/2 "2020-03-04T02:05:32Z")

</div>

Hey @avyer,

Based on [this forum post](https://community.hubspot.com/t5/APIs-Integrations/Started-to-get-Error-missing-or-unknown-hub-id/td-p/238881), it looks like expired test portal may cause this error. However, in order for me to further dig into this, could you share with me the following:

1. The exact endpoint you are using

2. Are you using hapikey/OAuth?

3. The portal ID in question that you’re sending the request to

---

<div class="post-metadata">

**Author:** ![avyer](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/avyer/32/1529_2.png) [@avyer](https://community.hubspot.com/u/avyer)\
**Post date:** [March 4, 2020, 2:29pm UTC](https://community.hubspot.com/t/missing-or-unknown-hub-id/19182/3 "2020-03-04T14:29:49Z")

</div>

Hi @WendyGoh,

As I’ve tested agian today it finally produced the BAD\_HUB status, it turns out a freshly deleted portal produced BAD\_SCOPE at first which sparked the confusion, this clarifies my issue.

Thank you!

---

<div class="post-metadata">

**Author:** ![annapurna](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/annapurna/32/89259_2.png) [@annapurna](https://community.hubspot.com/u/annapurna)\
**Post date:** [July 16, 2020, 2:49pm UTC](https://community.hubspot.com/t/missing-or-unknown-hub-id/19182/4 "2020-07-16T14:49:13Z")

</div>

We have some requests returning this error. Sent you PM for details.

---

<div class="post-metadata">

**Author:** ![annapurna](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/annapurna/32/89259_2.png) [@annapurna](https://community.hubspot.com/u/annapurna)\
**Post date:** [July 20, 2020, 7:58am UTC](https://community.hubspot.com/t/missing-or-unknown-hub-id/19182/5 "2020-07-20T07:58:53Z")

</div>

Hi @WendyGoh

Is the error returned only when a portal is deleted? Are there any other situations when this error is returned?

I am able to reproduce after deleting a portal and requesting to refresh token as below

REQUEST

```auto
curl --location --request POST 'https://api.hubapi.com/oauth/v1/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=refresh_token' \
--data-urlencode 'client_id={client_id}' \
--data-urlencode 'client_secret={client_secret}' \
--data-urlencode 'refresh_token={refresh_token}'

```

RESPONSE:

```auto
{
 "status": "BAD_HUB",
 "message": "missing or unknown hub id",
 "correlationId": "{correlationId}"
}

```

---

<div class="post-metadata">

**Author:** ![WendyGoh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wendygoh/32/42320_2.png) [@WendyGoh](https://community.hubspot.com/u/WendyGoh)\
**Post date:** [July 21, 2020, 6:36am UTC](https://community.hubspot.com/t/missing-or-unknown-hub-id/19182/6 "2020-07-21T06:36:06Z")

</div>

Hey @annapurna,

This error is likely because the app that we are attempting to install the app is deleted/it’s an unknown portal ID.

In this case, since your team deleted the portal, it is likely that that was causing the error.

---

<div class="post-metadata">

**Author:** ![annapurna](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/annapurna/32/89259_2.png) [@annapurna](https://community.hubspot.com/u/annapurna)\
**Post date:** [July 21, 2020, 9:12am UTC](https://community.hubspot.com/t/missing-or-unknown-hub-id/19182/7 "2020-07-21T09:12:37Z")

</div>

Hi @WendyGoh

Thank you for your answer. Can you please confirm that the deleted portal is the only reason that causes this error?

Does that mean that the user won’t have access to the portal ever again?

---

<div class="post-metadata">

**Author:** ![WendyGoh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wendygoh/32/42320_2.png) [@WendyGoh](https://community.hubspot.com/u/WendyGoh)\
**Post date:** [July 22, 2020, 4:22am UTC](https://community.hubspot.com/t/missing-or-unknown-hub-id/19182/8 "2020-07-22T04:22:01Z")

</div>

Hey @annapurna,

In order to answer your first question, I’ll have to check in with our internal team to ensure that I’m not missing any use case that may cause the bad hub error.

If that’s the only cause of it, it would be a yes for the second question.

---

<div class="post-metadata">

**Author:** ![annapurna](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/annapurna/32/89259_2.png) [@annapurna](https://community.hubspot.com/u/annapurna)\
**Post date:** [July 23, 2020, 4:24pm UTC](https://community.hubspot.com/t/missing-or-unknown-hub-id/19182/9 "2020-07-23T16:24:59Z")

</div>

Hi @WendyGoh

Did you have the chance to talk with your internal team about cases when BAD\_HUB error occurs?

---

<div class="post-metadata">

**Author:** ![WendyGoh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wendygoh/32/42320_2.png) [@WendyGoh](https://community.hubspot.com/u/WendyGoh)\
**Post date:** [July 24, 2020, 1:47am UTC](https://community.hubspot.com/t/missing-or-unknown-hub-id/19182/10 "2020-07-24T01:47:42Z")

</div>

Hey @annapurna,

Here’s an update from our internal team!

While we ain’t able to provide a 100% confirmation on all the cases that may cause the `BAD HUB` error, for the most part:

That error could be thrown in a situation where the Hub ID provided is **invalid** for use in that request for some reason, such as being **inactive** / **deleted** Hub, missing hubId param, conflicting auth information, etc. Making sure that the hub in the request is valid and active is a good start.

Having said that, if you’re seeing this error in which you’re certain that the Hub exists, we’d be happy to look into it. Otherwise, this should only pop up when the Hub ID doesn’t exist.

---

<div class="post-metadata">

**Author:** ![annapurna](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/annapurna/32/89259_2.png) [@annapurna](https://community.hubspot.com/u/annapurna)\
**Post date:** [July 24, 2020, 9:24am UTC](https://community.hubspot.com/t/missing-or-unknown-hub-id/19182/11 "2020-07-24T09:24:17Z")

</div>

Hi @WendyGoh ,

Thank you so much for the last answer. It clears a lot of things. Is there a way to know if a hub exists or not using API?

---

<div class="post-metadata">

**Author:** ![WendyGoh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wendygoh/32/42320_2.png) [@WendyGoh](https://community.hubspot.com/u/WendyGoh)\
**Post date:** [July 27, 2020, 7:13am UTC](https://community.hubspot.com/t/missing-or-unknown-hub-id/19182/12 "2020-07-27T07:13:02Z")

</div>

Hey @annapurna,

Currently, there isn’t an API to check if a portal ID exists/is invalid.

The best way to check is probably by attempting to see if you can login to the portal (assuming _you’re a user of the HubSpot portal_).
