Hi,
I have been using the HS API’s for a while now, but now run into an issue using an API we have not used before (the V4 associations API’s).
In Basics, we wanted to start with something simple, just to retrieve all ticket IDs linked to a certain company.
For most of our API-projects we use Google Sheets / Google App Script, which has workedf for us for past projects.
Code we have tried:
function getLinkedTickets(){
var comp = //removed company ID
const options = {
"method" : "GET",
"muteHttpExceptions": true,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer pat-na1-REMOVED_API_KEY",
}
};
var r = UrlFetchApp.fetch("https://api.hubspot.com/crm/v4/objects/Company/" + comp + "/associations/Ticket", options);
let x = JSON.parse(r);
console.log(x)
}
This yields the following error:
{ status: 'error',
message: 'Authentication credentials not found. This API supports OAuth 2.0 authentication and you can find more details at https://developers.hubspot.com/docs/methods/auth/oauth-overview',
correlationId: '',
category: 'INVALID_AUTHENTICATION' }
Things we tried:
- Generate a new API token with more/all permissions
- Use the V3 API (yielded the same error)
Anyone able to point us in the right direction?
Hi @_Jelmer ,
The above issue is because HubSpot’s CRM v4 associations API doesn’t support Private App Token and mandatorily requires OAuth 2.0 authentication.
-
To resolve this u
se v3 Endpoints as it supports private app token without need OAuth
-
If you require v4 this requires OAuth 2.0 which needs to be implemented
Refer here: Working with OAuth - HubSpot docs
This should help resolve your authentication issue. If this helps, feel free to mark it as the solution

and give it an upvote

!
EDIT: after some puzzling around it suddenly worked wit the v3 API, not sure what changed but we will take it from here. Thanks!
---------------------------------------------------------
Thanks for the quick reply, but even with the V3 API we get the same error, could it be that the v3 API was also upgraded to Oauth2?
function getLinkedTickets(){
var comp = "REMOVED";
let bc ={
"inputs":[
{
"id":comp
},
{
"id":comp
}
]
}
const options = {
"method" : "POST",
"muteHttpExceptions": true,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer pat-na1-API TOKEN",
},
"payload": JSON.stringify(bc)
};
var r = UrlFetchApp.fetch("https://api.hubspot.com/crm/v3/associations/Company/Ticket/batch/read", options);
let x = JSON.parse(r);
console.log(x)
}
This code yields the exact same error