Receiving a MISSING_SCOPES error when calling the leads API, despite the access token containing crm

RNacif
Member

We are trying to reach https://api.hubapi.com/crm/v3/objects/leads?limit=1 and getting One or more of the following scopes are required.","context":{"requiredGranularScopes":["crm.objects.leads.read"] , but we do have this scope.

Request:

curl  "https://api.hubapi.com/crm/v3/objects/leads?limit=1" \

  -H "Authorization: Bearer $ACCESS_TOKEN"

{"status":"error","message":"This app hasn't been granted all required scopes to make this call. Read more about required scopes here: https://developers.hubspot.com/scopes.","correlationId":"aee8f1fe-41c9-4744-a42e-87c7fdf8e09b","errors":[{"message":"One or more of the following scopes are required.","context":{"requiredGranularScopes":["crm.objects.leads.read"]}}],"links":{"scopes":"https://developers.hubspot.com/scopes"},"category":"MISSING_SCOPES"}%                                                                                   


Confirming we have the scopes:

curl -sS "https://api.hubapi.com/oauth/v1/access-tokens/$ACCESS_TOKEN" | jq '{hub_id, app_id, user, scopes}'


{
"token": "Redacted",
"user": "Redacted",
"hub_domain": "Redacted",
"scopes": [
"oauth",
"crm.lists.read",
"crm.objects.contacts.read",
"crm.objects.marketing_events.read",
"crm.schemas.custom.read",
"crm.objects.custom.read",
"crm.schemas.contacts.read",
"crm.objects.companies.read",
"crm.objects.deals.read",
"crm.schemas.companies.read",
"crm.schemas.deals.read",
"crm.objects.quotes.read",
"crm.objects.invoices.read",
"crm.schemas.invoices.read",
"crm.objects.carts.read",
"crm.pipelines.orders.read",
"crm.schemas.orders.read",
"crm.objects.orders.read",
"crm.objects.leads.read"
],
"signed_access_token": {
"expiresAt": Redacted,
"scopes": Redacted,
"hubId": Redacted,
"userId": Redacted,
"appId": Redacted,
"signature": Redacted,
"scopeToScopeGroupPks": Redacted,
"newSignature": Redacted,
"hublet": "na1",
"trialScopes": "",
"trialScopeToScopeGroupPks": "",
"isUserLevel": false,
"installingUserId": 0,
"isServiceAccount": false,
"isPrivateDistribution": false
},
"token_type": "access",
"user_id": redacted,
"app_id": 3725241,
"hub_id": 20523459,
"expires_in": 1725,
"is_private_distribution": false
}
0 Upvotes
1 Accepted solution
felixmacaspac
Solution
Contributor

Hi @RNacif have you checked if you have setup the leads correctly? check this link "https://knowledge.hubspot.com/object-settings/sync-lead-ownership-and-activities" 

 

It was mentioned in the leads API documentation that it should be setup first. 

"Before using the API, be sure leads have been set up in your account."

 

View solution in original post

0 Upvotes
4 Replies 4
STierney
Community Manager
Community Manager

Hey @RNacif - thanks for posting in the Community!

Can you please confirm whether or not @felixmacaspac 's recommendation assisted with solving for this? If not, can you provide context around what still seems to be an issue for you?

Shane, Community Manager





loop


Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.

Learn More




0 Upvotes
RNacif
Member

Hey Shane,

We double checked that and it's set to true. I don't think it has anything to do with the issue to be honest. I believe it's a bug on the API since the error message is pointing that we are missing a scope (crm.objects.leads.read) but we are 100% sure that scope was authorized (as per the access token request that returns this scope).

I do believe it's a bug and would be awesome if we can get someone internally to investigate it. I tried to open a technical issue but got very frustated since the people in the chat told me they couldn't open up a ticket for that.

0 Upvotes
STierney
Community Manager
Community Manager

Hey @RNacif - thanks for checking in!

@felixmacaspac - any follow-up thoughts here?

Shane, Community Manager





loop


Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.

Learn More




0 Upvotes
felixmacaspac
Solution
Contributor

Hi @RNacif have you checked if you have setup the leads correctly? check this link "https://knowledge.hubspot.com/object-settings/sync-lead-ownership-and-activities" 

 

It was mentioned in the leads API documentation that it should be setup first. 

"Before using the API, be sure leads have been set up in your account."

 

0 Upvotes