API call limits to first 10 records

I am calling the API to retrieve the deal data that always returns the first 10 deals for me. Any pointers on how to lift this limit are greatly appreciated.

API that I am using: https://api.hubapi.com/crm/v3/objects/deals

Hi @rahulshah

"To retrieve all deals using the API endpoint `https://api.hubapi.com/crm/v3/objects/deals\`, you will need to include the `limit` query parameter. For example, specifying `limit=100` will allow you to retrieve the first 100 deals.

However, if you need to retrieve more deals, you must pass an additional query parameter, `after`. This value must be obtained from the response of the initial API request, specifically from the ““paging”” section. Once you have this value, you can append it to the API endpoint URL to retrieve the next set of 100 deals.

Please note that this is necessary to paginate the results correctly and to avoid retrieving duplicate deals. If you have any questions or concerns about implementing this approach, please don’t hesitate to reach out."

I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!

Thanks for the pointer Gaurav. Really appreciated. Now it returns the 100 records.

However, I am not so expert in following your further suggestion to retrieve the next set of 100 records using the after keyword. Would you be able to help me with the sample code?
This is what PowerBI generated as a backend code.
let
Source = Json.Document(Web.Contents(“https://api.hubapi.com/crm/v3/objects/deals” & “?limit=100”, [Headers=[Authorization=“Bearer <Key>”]])),
#“Converted to Table” = Table.FromRecords({Source}),
#“Expanded results” = Table.ExpandListColumn(#“Converted to Table”, “results”),
#“Expanded results1” = Table.ExpandRecordColumn(#“Expanded results”, “results”, {“id”, “properties”, “createdAt”, “updatedAt”, “archived”}, {“results.id”, “results.properties”, “results.createdAt”, “results.updatedAt”, “results.archived”}),
#“Expanded results.properties” = Table.ExpandRecordColumn(#“Expanded results1”, “results.properties”, {“amount”, “closedate”, “createdate”, “dealname”, “dealstage”, “hs_lastmodifieddate”, “hs_object_id”, “pipeline”}, {“results.properties.amount”, “results.properties.closedate”, “results.properties.createdate”, “results.properties.dealname”, “results.properties.dealstage”, “results.properties.hs_lastmodifieddate”, “results.properties.hs_object_id”, “results.properties.pipeline”}),
#“Expanded paging” = Table.ExpandRecordColumn(#“Expanded results.properties”, “paging”, {“next”}, {“paging.next”}),
#“Expanded paging.next” = Table.ExpandRecordColumn(#“Expanded paging”, “paging.next”, {“after”, “link”}, {“paging.next.after”, “paging.next.link”}),
#“Changed Type” = Table.TransformColumnTypes(#“Expanded paging.next”,{{“results.id”, Int64.Type}, {“results.properties.amount”, Int64.Type}, {“results.properties.closedate”, type datetime}, {“results.properties.createdate”, type datetime}, {“results.properties.dealname”, type text}, {“results.properties.dealstage”, type text}, {“results.properties.hs_lastmodifieddate”, type datetime}, {“results.properties.hs_object_id”, Int64.Type}, {“results.properties.pipeline”, type text}, {“results.createdAt”, type datetime}, {“results.updatedAt”, type datetime}, {“results.archived”, type logical}, {“paging.next.after”, Int64.Type}, {“paging.next.link”, type text}})
in
#“Changed Type”

ChatGPT helped me here. It is sorted out. Thank you for your help Gaurav once again.