Want to get all the companies/contacts from create company/contact based list

I am getting below response only using below code:
but, I am looking for all the companies and contacts details not only count.

client = hubspot.Client.create(access_token=access_token)

list_search_request = ListSearchRequest(

offset=0,

count=0,

additional_properties=[“string”]

)

response = client.crm.lists.lists_api.do_search(

list_search_request=list_search_request

)

Response:
{‘additional_properties’: {‘hs_list_reference_count’: ‘0’, ‘hs_list_size’: ‘0’}, ‘created_at’: datetime.datetime(2024, 3, 11, 4, 44, 42, 369000, tzinfo=tzlocal()), ‘created_by_id’: 63849904, ‘deleted_at’: None, ‘filters_updated_at’: datetime.datetime(2024, 3, 11, 4, 44, 42, 369000, tzinfo=tzlocal()), ‘list_id’: 2, ‘list_version’: 1, ‘name’: ‘MyCompanyList’, ‘object_type_id’: ‘0-2’, ‘processing_status’: ‘COMPLETE’, ‘processing_type’: ‘DYNAMIC’, ‘updated_at’: datetime.datetime(2024, 3, 11, 4, 44, 46, 996000, tzinfo=tzlocal()), ‘updated_by_id’: 63849904}{‘additional_properties’: {‘hs_last_record_added_at’: ‘1710235822948’, ‘hs_list_reference_count’: ‘0’, ‘hs_list_size’: ‘3’}, ‘created_at’: datetime.datetime(2024, 3, 11, 9, 41, 5, 304000, tzinfo=tzlocal()), ‘created_by_id’: 63849904, ‘deleted_at’: None, ‘filters_updated_at’: datetime.datetime(2024, 3, 12, 9, 30, 20, 889000, tzinfo=tzlocal()), ‘list_id’: 3, ‘list_version’: 2, ‘name’: ‘MyContactList’, ‘object_type_id’: ‘0-1’, ‘processing_status’: ‘COMPLETE’, ‘processing_type’: ‘DYNAMIC’, ‘updated_at’: datetime.datetime(2024, 3, 12, 9, 30, 23, 113000, tzinfo=tzlocal()), ‘updated_by_id’: 63849904}{‘additional_properties’: {‘hs_list_reference_count’: ‘0’, ‘hs_list_size’: ‘0’}, ‘created_at’: datetime.datetime(2024, 3, 12, 6, 14, 18, 967000, tzinfo=tzlocal()), ‘created_by_id’: 63849904, ‘deleted_at’: None, ‘filters_updated_at’: datetime.datetime(2024, 3, 12, 6, 14, 18, 967000, tzinfo=tzlocal()), ‘list_id’: 4, ‘list_version’: 1, ‘name’: ‘Static-ContactList’, ‘object_type_id’: ‘0-1’, ‘processing_status’: ‘COMPLETE’, ‘processing_type’: ‘MANUAL’, ‘updated_at’: datetime.datetime(2024, 3, 12, 6, 14, 19, 129000, tzinfo=tzlocal()), ‘updated_by_id’: 63849904}

Hi @HSuryvanshi,
Thank you for asking the Community!
Could you please share which API documentation you are using?
Is it this documentation?
I have moved your post to the Developers Forum for more visibility and so that experts in this field can help you!
I’d like to invite a couple of subject matter experts to this conversation: Hi @zach_threadint, @Teun and @MBERARD do you have tips to help @HSuryvanshi, please?
Also, if anybody else has anything to add and/or share, please feel free to join in the conversation :slightly_smiling_face:
Thank you so much and have a fantastic day!
Best,
Bérangère

/crm/v3/lists/search
I am using the above API endpoint
using the below documentation:
developers.hubspot.com/docs/api/crm/lists
Thanks
Hariom

Hi @HSuryvanshi :waving_hand:

As far as I’m aware, the “Search Lists” endpoint will only return “Lists” as an object-type (not the Contacts/Companies/Deals etc. contained in the given List). If you want to get IDs of all records contained within a List, you might need to consider making some additional API calls, first to the “Fetch List Memberships Ordered by ID” endpoint (see “Endpoints” tab in Lists API docs). For example, imagine I want to get all record IDs belonging to List ID 123:

GET /crm/v3/lists/123/memberships?limit=2

Response:

{
 "results": [
 {
 "recordId": "301",
 "membershipTimestamp": "2023-09-05T04:41:19.090Z"
 },
 {
 "recordId": "551",
 "membershipTimestamp": "2023-09-05T04:41:19.103Z"
 }
 ],
 "paging": {
 "next": {
 "after": "AAAAAAAAA1M%3D",
 "link": "https://api.hubapi.com/crm/v3/lists/123/memberships?limit=2&after=AAAAAAAAA1M%3D"
 }
 },
 "total": 6
}

If I need information relating to those records (IDs 301, 551 and subsequent IDs discovered in paged results), I’d then have to make some more calls to a “Get Batch {Object-Type}” endpoint.

I hope that proves helpful. Please let me know if you have any follow-up questions.