Dear Team,
I hope you are doing well. I am working on a project where i need to get all leads exists in contactlist. Here is the V3 endpoint used.
https://api.hubapi.com/crm/v3/objects/leads
I have a contactlistId and expecting all leads exists in that contactlist to appear on the postman response. As part of this requirement, first i have added the lead scopes (read& write) to the REQUIRED_SCOPE in hubspot app(Oauth) as below. From config point of time, everything looks fine. But when i tried to fetch the leads from postman, I am getting below 403 error even after configuration. Could you please help me on how to resolve this issue?
Hey @RKOSURI
If the app was previously installed with different scopes, changing the scope after installation will not modify the scope of the existing token. Our developers team suggests trying to reinstall the app and see if that resolves the issue.
@AddaxLab Thanks for your reply. I will forward this to my teammate. Currently hubspot app has lot of configurations like webhook configs. Bit concerned of its backup if it needs a reinstall.
Hey , @RKOSURI
Here is no one API endpoint to retrieve all contacts from contact list, but you can do it in 2 steps
- Retrieve all members from a list with a GET request to https://api.hubapi.com/crm/v3/lists/{listId}/memberships (replace {listId} with your actual id). Here, you retrieve a list of all member’s (contacts in our case) records ids. Like that:
{ “results”: [ { “recordId”: “19625561285”, “membershipTimestamp”: “2024-07-08T13:22:18.815Z” } ], “total”: 1 }
2. Get contact IDs from the response and map them to body payload for the next POST request to https://api.hubapi.com/crm/v3/objects/contacts/batch/read
const body = { propertiesWithHistory: [“string”], inputs: [ { “id”: “19625561285” }, // … ADD MORE IDS HERE FROM THE RESPONSE OF THE PREVIOUS REQUEST ], properties: [“firstName”, “email”, “lastName”] // ADD PROPERTIES HERE };
Hey @RKOSURI
Here is no one API endpoint to retrieve all contacts from contact list, but you can do it in 2 steps
- Retrieve all members from a list with a GET request to https://api.hubapi.com/crm/v3/lists/{listId}/memberships (replace {listId} with your actual id). Here, you retrieve a list of all member’s (contacts in our case) records ids. Like that:
{ “results”:[ { “recordId”: “19625561285”, “membershipTimestamp”: “2024-07-08T13:22:18.815Z” } ],
“total”: 1 }
2. Get contact IDs from the response and map them to body payload for the next POST request to https://api.hubapi.com/crm/v3/objects/contacts/batch/read
const body = {propertiesWithHistory: [“string”], inputs: [
{ “id”: “19625561285” }, // … ADD MORE IDS HERE FROM THE RESPONSE OF THE PREVIOUS REQUEST ], properties: [“firstName”, “email”, “lastName”] // ADD PROPERTIES HERE };
Hey, @AddaxLab
It looks like one of later replies got hung up in the spam filter. I moved it back out. I appreciate your help in this thread
— Jaycee