# Error with V3 List API

**URL:** <https://community.hubspot.com/t/error-with-v3-list-api/104091>\
**Category:** APIs & Integrations\
**Tags:** workflows, developer-tools, professional\
**Created:** [April 4, 2024, 10:31am UTC](https://community.hubspot.com/t/error-with-v3-list-api/104091 "2024-04-04T10:31:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![EddBrisley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/eddbrisley/32/56651_2.png) [@EddBrisley](https://community.hubspot.com/u/EddBrisley)\
**Post date:** [April 4, 2024, 10:31am UTC](https://community.hubspot.com/t/error-with-v3-list-api/104091/1 "2024-04-04T10:31:37Z")

</div>

Hi All 👋

I’ve been attempting to make use of the V3 List Membership API, but I’m coming up against an issue.

```lia-code-sample
const hubspot = require('@hubspot/api-client');

const hubspotClient = new hubspot.Client({"accessToken":"YOUR_ACCESS_TOKEN"});

const listId = "listId";
const after = undefined;
const before = undefined;
const limit = 100;

try {
 const apiResponse = await hubspotClient.crm.lists.listAppMembershipApi.getPage(listId, after, before, limit);
 console.log(JSON.stringify(apiResponse, null, 2));
} catch (e) {
 e.message === 'HTTP request failed'
 ? console.error(JSON.stringify(e.response, null, 2))
 : console.error(e)
}

```

I’m getting this type error

`TypeError: Cannot read properties of undefined (reading 'listAppMembershipApi')`

The auth token is correct, and the listId is also correct. Any ideas what might be causing this?

I know it’s currently in Beta, so maybe it’s just not working?

Many thanks in advance

---

<div class="post-metadata">

**Author:** ![Berangere](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/berangere/32/220784_2.png) [@Berangere](https://community.hubspot.com/u/Berangere)\
**Post date:** [April 5, 2024, 7:55am UTC](https://community.hubspot.com/t/error-with-v3-list-api/104091/2 "2024-04-05T07:55:44Z")

</div>

Hi @EddBrisley,  
Thank you for asking the Community!  
So you are using the [Lists (Beta) API](https://developers.hubspot.com/docs/api/crm/lists), right?  
Which action are you trying to do exactly with this endpoint, please?  
I’d like to invite a couple of subject matter experts to this conversation: Hi @Bob2245, @GRajput and @himanshurauthan do you have suggestions to help @EddBrisley, please?  
Also, if anybody else has anything to add and/or share, please feel free to join in the conversation 🙂  
Thank you very much and have a lovely day!  
Best,  
Bérangère

---

<div class="post-metadata">

**Author:** ![EddBrisley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/eddbrisley/32/56651_2.png) [@EddBrisley](https://community.hubspot.com/u/EddBrisley)\
**Post date:** [April 5, 2024, 8:37am UTC](https://community.hubspot.com/t/error-with-v3-list-api/104091/3 "2024-04-05T08:37:23Z")

</div>

Hi Bérangère, yeah absolutely, and thanks for your response 🙌

Yes it’s the Lists Beta API. The specific endpoint I’m working on is the list membership endpoint \</crm/v3/lists/{listId}/memberships\>

I’m essentially trying to return a list of deal IDs of the current members of a specific list.

If I try to access the endpoint via something like Postman it’ll work just fine. Also if I structure the API call differently and use the axios library it’ll work too. For example:

```lia-code-sample
 const options = {
 method: 'GET',
 url: `https://api.hubapi.com/crm/v3/lists/${listId}/memberships`,
 headers: {
 Authorization: `Bearer ${hubspotApiKey}`
 }
 };

```

but it’s just odd that you’ll run into a type error when using the standard method shown in the documentation. i.e:

```auto
try {
 const apiResponse = await hubspotClient.crm.lists.listAppMembershipApi.getPage(listId, after, before, limit);

```

Perhaps I’m just showing my inexperience! But i suspect others might run into an issue (?)  
Let me know if I’m just barking up the wrong tree 😅  
Many thanks

---

<div class="post-metadata">

**Author:** ![cpradalier](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@cpradalier](https://community.hubspot.com/u/cpradalier)\
**Post date:** [April 16, 2024, 2:34pm UTC](https://community.hubspot.com/t/error-with-v3-list-api/104091/4 "2024-04-16T14:34:13Z")

</div>

Hi, I have exactly the same issue. Did you have found any solution?

Thanks,

---

<div class="post-metadata">

**Author:** ![EddBrisley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/eddbrisley/32/56651_2.png) [@EddBrisley](https://community.hubspot.com/u/EddBrisley)\
**Post date:** [April 16, 2024, 4:35pm UTC](https://community.hubspot.com/t/error-with-v3-list-api/104091/5 "2024-04-16T16:35:24Z")

</div>

Hi @cpradalier  
Yeah I found a solution (if you can call it that) by using the Axios library. Feel free to use the below as a starting point to resolving your issue, and let me know if you have any questions 👍

```lia-code-sample
const axios = require('axios');

exports.main = async (event, callback) => {

 let toObjectIds = event.inputFields['toObjectIds']; // in this example, we're pulling in an array of data from a previous step, for comparison, but adjust this to your needs
 toObjectIds = JSON.parse(event.inputFields['toObjectIds']); 

 const hubspotApiKey = << put your secret here >>;
 const listId = 1111; // this represents the list you're targeting

 const options = {
 method: 'GET',
 url: `https://api.hubapi.com/crm/v3/lists/${listId}/memberships`,
 headers: {
 Authorization: `Bearer ${hubspotApiKey}` 
 }
 };

 let responseData = null;
 let recordIds = [];

 try {
 const response = await axios(options);
 responseData = response.data;
 console.log(responseData);

 recordIds = responseData.results.map(item => item.recordId); // In this example I'm mapping the returned data to an array, but you don't necesserily have to do this. If you don't, it'll simply return as a string literal. 

 } catch (error) {
 console.error('Error:', error);
 throw error
 }

 callback({
 outputFields: {
 responseData: JSON.stringify(responseData)
 }
 });
};

```

---

<div class="post-metadata">

**Author:** ![Berangere](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/berangere/32/220784_2.png) [@Berangere](https://community.hubspot.com/u/Berangere)\
**Post date:** [May 10, 2024, 11:41am UTC](https://community.hubspot.com/t/error-with-v3-list-api/104091/6 "2024-05-10T11:41:58Z")

</div>

Hi @EddBrisley, I hope that you are well!  
Really glad to see that it is now working for you!  
Thank you so much for sharing the solution with the Community!  
This will be useful for many other Members!  
Have a great day and weekend!  
Best,  
Bérangère

---

<div class="post-metadata">

**Author:** ![cpradalier](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@cpradalier](https://community.hubspot.com/u/cpradalier)\
**Post date:** [April 18, 2024, 8:49am UTC](https://community.hubspot.com/t/error-with-v3-list-api/104091/7 "2024-04-18T08:49:53Z")

</div>

thanks a lot, it’s all good
