As many developers using the Bing Maps Platform know, some Bing Maps API calls generate billable transactions while other Bing Maps API calls don’t. The Bing Maps Platform team has documented which Bing Maps API calls are billable vs. non-billable (and when). As a side note, understanding and accessing your Bing Maps usage reports was previously discussed in a previous Bing Maps blog post about the Bing Maps Dev Center.
An important thing to understand when it comes to what causes billable vs. non-billable transactions is whether the API call was done within a Bing Maps ‘session’. A session begins anytime the Bing Maps Web Control, Bing Maps Windows Control, Bing Maps Android Control or Bing Maps iOS Control is loaded. For example, if you were to first load any of these Map Controls, then subsequently call the Bing Maps REST Locations API (i.e. to geocode a location), that REST Locations API call would generate a non-billable transaction. This is because the REST Locations API call was done within the Map Control session.
This is fine if your application loads the Map Control prior to making additional Bing Maps API calls (i.e. a REST Locations API call). However, what if you first wanted to call the REST Locations API prior to loading the map? In such a scenario, the REST Locations API call would be deemed billable because it occurred before the Map Control was loaded (and thus before the session started). The sequence of events is obviously important here when it comes to what constitutes a billable transaction vs. non-billable transaction. This goes for several other Bing Maps API calls (as outlined on the Understanding Bing Maps Transactions page.).
With this in mind, and to ensure that the Bing Maps API call (i.e. REST Locations API call) is done within a map session, you need to be sure to load the Map Control prior to making the REST Locations API call. For more tips like these, check out our helpful documentation at Bing Maps API Best Practices.