Receiving a 400 BAD_GRANT_TYPE error when requesting a client_credentials token from HubSpot’s OAuth

I’m trying to use the new Journal polling mechanism and need to set up the Journal API (create subscriptions, ecc.)
Can my app (Distribution: Private, Auth Type: OAuth) request a client_credentials token at the endpoint: https://api.hubapi.com/oauth/v1/token using the following scopes?
developer.webhooks_journal.read
developer.webhooks_journal.subscriptions.read
developer.webhooks_journal.subscriptions.write
developer.webhooks_journal.snapshots.read
developer.webhooks_journal.snapshots.write
The app is correctly installed on the Hubspot account.
When I attempt to request the token to set up the Journal, I receive the following error:

HTTP Error: 400 Bad Request
{"status":"BAD_GRANT_TYPE","message":"missing or unknown grant type","correlationId":"1fd8fddc-cb6b-447e-845a-5aa9a741dc98"}

I’m following the documentation here:
- https://developers.hubspot.com/docs/apps/developer-platform/build-apps/overview#features(shows that Webhooks v4 is an enabled feature for OAuth Private Apps)
- https://developers.hubspot.com/docs/apps/developer-platform/build-apps/authentication/overview#client-credentials (shows the example API call I’m following exactly)
- https://developers.hubspot.com/docs/api-reference/webhooks-webhooks-v4/webhooks-journal#authentication

Here’s my Python code in case something obvious is missing:

import urllib.request
import urllib.parse

scopes = [
 "developer.webhooks_journal.read",
 "developer.webhooks_journal.subscriptions.read",
 "developer.webhooks_journal.subscriptions.write",
 "developer.webhooks_journal.snapshots.read",
 "developer.webhooks_journal.snapshots.write",
]

data = {
 "grant_type": "client_credentials",
 "client_id": client_id,
 "client_secret": client_secret,
 "scope": " ".join(scopes),
}

encoded_data = urllib.parse.urlencode(data, quote_via=urllib.parse.quote).encode("utf-8")

url = "https://api.hubapi.com/oauth/v1/token"
headers = {"Content-Type": "application/x-www-form-urlencoded"}

req = urllib.request.Request(
 url, data=encoded_data, headers=headers, method="POST"
)

try:
 with urllib.request.urlopen(req) as response:
 response_data = response.read().decode("utf-8")
 print("Response:")
 print(response_data)
except urllib.error.HTTPError as e:
 print("HTTP Error:", e.code, e.reason)
 print(e.read().decode())
except urllib.error.URLError as e:
 print("URL Error:", e.reason)

UP

Hi @EdoardoP and welcome, it’s a pleasure to have you here!
Thanks for reaching out to the HubSpot Community!
Here are some documentation that might help you:
- Authentication overview
- Webhooks journal and management APIs (BETA)
- OAuth Quickstart Guide
Also, I’d love to put you in touch with our Top Experts: Hi @Anton, @sylvain_tirreau and @SteveHTM do you have suggestions to help @EdoardoP, please?
Have a wonderful day and thanks so much!
Bérangère

I am experiencing the exact same issue - even the curl example from the HubSpot docs isn’t working for me.
(I did replace the client id and secret with my own app’s id and secret)

curl --location 'https://api.hubapi.com/oauth/v1/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX' \
--data-urlencode 'client_secret=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX' \
--data-urlencode 'scope=developer.webhooks_journal.read developer.webhooks_journal.subscriptions.read developer.webhooks_journal.subscriptions.write developer.webhooks_journal.snapshots.read developer.webhooks_journal.snapshots.write'

The response from that command:

{"status":"BAD_GRANT_TYPE","message":"missing or unknown grant type","correlationId":"aa915519-7ad4-414c-ace4-3d1e6533676b"}%

PS: Platform version is 2025.2

Hi @EdoardoP ,

Normally, if you’re using the new development platform and your project is configured as a private application, you should have received an error message about the scopes when you uploaded it. Because there is indeed an error message about these scopes (I get it immediately when I upload the project to my developer account, and I’ve tested it with each scope).

Either the documentation is referring to scopes that haven’t been deployed yet, or you need to sign up for the beta version (but I haven’t found anything like that in “your-cloud.hubspot.com/product-updates/your-portal-id” to potentially sign up for the feature).

So there’s definitely an issue here that isn’t on the user’s end. Others have the same problem.

I think only people from Hubspot will be able to unblock you here.

Hi @sylvain_tirreau and thanks so much for your help!
Hi @EdoardoP, @emmett_p, @AlexShestakov and @albandum, to understand where the issue is coming from, can you please confirm the following:
1. Can you please make sure that you are on 2025.2 and not using Serverless Functions.
If you are using Serverless Functions, then you would need to be on 2025.1. Here is a documentation about this: “Navigating Serverless Functions on HubSpot’s New Developer Platform”.

2. The following scopes are needed on the API request’s token, but don’t need to be explicitly requested by the project:
webhooks.journal.data.access: access journal data and snapshots.
webhooks.journal.subscription.read: retrieve subscription information.
webhooks.journal.subscription.manage: create, update, and delete subscriptions.
webhooks.journal.snapshot.manage: create and manage object snapshots.
So, you will need a project on our new platform, but you won’t need the 4 scopes above in your project’s list of Scopes.
Please make sure to remove the scopes listed above.
3. Are you still seeing this behavior after following steps 1 and 2?
Thanks and let us know how it goes!
Bérangère

Hi @BérangèreL ,

Thank you for your message.

1. App version is indeed 2025.2 and no Serverless Functions.

2. The scopes are requested when hitting /oauth/v1/token and are not in the project scopes.
3. The behavior was being seen by followin exactly poitn 1 and 2, that’s in fact the problem.
Thank you again!

Hi @EdoardoP and thanks for confirming the details.
Hi @emmett_p, @AlexShestakov and @albandum, could you let us know if you’re seeing the same behavior?

Thank you,
Bérangère

Yes, experiencing the exact same behavior as @EdoardoP described.

Hi @emmett_p thanks getting back to us!
Hi @AlexShestakov and @albandum can you please check the 3 points from my previous message and let me know, please?
Once I get feedback from you both, I can start investigating internally.
Thanks so much and have a great day!
Bérangère

Hi Emmett.

I think this is fixed as of a few weeks ago. Can you try again? Otherwise, I posted a workaround above for picking a specific data center that would be tied to our account. ap1 is for Edoardo, but your could be na2/na3/eu1/ap1. Worth trying api-{datacenter}.hubapi.com if it doesn’t work and one of them will work.

Apologize if api.hubapi.com does not work, and can reach back out to the relevant team if that doesn’t work for you.

I guess this is not high priority for Hubspot team? @BérangèreL

Hi @EdoardoP and thanks for your message.
We’re here to help with the 400 BAD_GRANT_TYPE error you’re seeing when requesting a client_credentials token.
I’ll make sure our team reviews this and we will get back to you with more information as soon as possible.
If you have any additional details about your request setup, feel free to share, they can be very helpful in troubleshooting.
Thanks for your patience,
Bérangère

Hi Edoardo. Sorry for the confusion and delay. We have a known bug where we’re not routing certain regions to the correct data center.

Can you try calling https://api-ap1.hubapi.com/oauth/v1/token for your client credential token exchange? I believe that will work. Once you have the token, you can go back to hitting the api load balancer, but we have various data centers and by default you are getting routed to `na1` which is for US east coast. I’ll work with the relevant teams so we can address this, but this should be a workaround for now.

Also, I think the validation check we did months ago has since been fixed as of Nov 26th, so I think you can actually try again with the regular api LB.

Hey @cconnors - thanks so much for these updates!
I’d like to tag in @EdoardoP to highlight this context. @EdoardoP, can you please confirm when you see this context, as well as provide a confirmation of whether or not this additional information helped solve for the issue?
Shane, Senior Community Moderator

Hi @cconnors

Apologies for the delay in getting back to you. I’ve rerun my code and the token endpoint is now working as expected, so it looks like the routing/data center issue has been resolved.

I’ll proceed with testing the webhook (Journal) endpoints next and will follow up with another comment if I run into any issues.

Thanks again for the help!

Thank you so much for confirming this @EdoardoP!
Have a great end of year!
Shane, Senior Community Moderator

The BAD_GRANT_TYPE error you are seeing is not about your code syntax or missing parameters. HubSpot does not support the client_credentials grant type for accessing the Journal API or most other HubSpot APIs, even though the OAuth token endpoint technically accepts a grant_type parameter.

Here is what is happening:

HubSpot’s OAuth is designed for user-approved access flows, not pure machine-to-machine authentication like some other platforms support. When you send grant_type=client_credentials, HubSpot returns BAD_GRANT_TYPE because that grant type simply is not supported for this use case.

What you need to do instead:

You must use the standard authorization_code OAuth flow even for private apps. Here is how to set it up:

1. Keep your app as Auth Type OAuth and make sure all the required scopes are added, including the developer.webhooks_journal scopes you need.

2. Install your app into the HubSpot account by going through the OAuth install URL one time. This requires a browser visit where a user clicks to authorize the app.

3. When HubSpot redirects back to your redirect_uri with a code parameter, exchange that code for tokens by calling the token endpoint with:
grant_type=authorization_code
client_id
client_secret
redirect_uri (must exactly match what is in your app settings)
code (the authorization code from the redirect)

4. Store the refresh_token from the response. This is what you will use going forward.

5. For all future API calls, use the refresh_token with grant_type=refresh_token to get new access tokens without any user interaction.

This one-time install step gives your app long-lived access through the refresh token, and after that your backend can operate autonomously. HubSpot does not offer a way to skip the initial OAuth install for production APIs like the Journal API.

If you want to share your exact Python code, I can help you rewrite it to use the authorization_code and refresh_token flow that HubSpot requires.