Losing data looping through API Keys

Our company works with many different hubspot accounts and I’m working on creating a program that allows us to export call data from each account. I’m running into an issue when looping through mutiple API keys.

Currently using the recent engagements endpoint, everything works except for each time the program loops through a new api key, less engagement variables are returned.

For example

  • First pass returns 40 variables
  • Second pass returns 37 or 35 and since it’s missing the variables I need, my program breaks.

Any thoughts on what could be causing less data to return in subsequent GET requests?

I’ve figured out that it’s since there was no recording url for a completed call with no answer, therefore it wasn’t bringing in the metadata for it in the GET request which caused some errors.

My thoughts are to parse through each record individually to accomodate but this would increase runtime. Would there be another workaround to this?