3 Ways to Reduce Your API Spend with Smarter Calls

Get more value from your API plan

Published 12 Jan, 2021

Using APIs to add location intelligence to your forms can be an effective way to increase customer engagement, collect accurate address data and maximise your revenue. However, if you’re not smart about how you use APIs, you can quickly chew through your credits.

And with organisations around the country tightening their budgets, naturally everyone is looking to get more value out of their investments.

The good news is there are several features included in Predictive API and Addresses API to help you reduce the amount of calls you need. Here are three ways to be smarter with your code and get more value from your address verification API usage.

image
Bloodhound is used in this example to debounce requests to lower the load on the API.

2. ‘Include’ parameter

Another way to reduce the number of calls you make to both the Predictive API and Addresses API –  and therefore how much it will cost you – is to make smart use of the ‘include’ parameter.

The ‘include’ parameter specifies what information you want returned from the API. You can just ask for basic information, like the geocode. But you can also ask for more advanced data, like the ABS remoteness index, which tells you if the user is in a major metropolitan centre or a regional town.

If you need more than one type of information returned, the smart way is to set ‘include’ to return ‘all’. This will return everything known about the address in one call.

The ‘include all’ parameter saves you money since you only require one call to the API to get all the information you need.

image
Python – Requests (include all) This code snippet returns all possible attributes of an address using the include all query parameter.
image
JavaScript – jQuery (include some) This code snippet returns only selected attributes of an address using the include (geo, addressDetails and stateElectorate) query parameter.

3. Response headers

Keeping an eye on how much your API is costing you is a good way to take control of your spending.

Your API subscription plan allows you a certain number of transactions per month. The type of API call you make determines how many transactions it costs.

To help you keep track of your balance, each API call returns the cost of the transaction in the ‘x-attr-basicTransaction’ response header. This can help you optimise your code to save you money.

image
Response headers in action.

Code smarter to save money

Reducing the number of times you call your address validation APIs will save you money. You can do this by coding smarter – using debounce and the include ‘all’ parameter, and by tracking your spend from information supplied in the response header.

Want more advice about getting the most out of your API subscription? Contact our helpful support team at support@geoscape.com.au.

Get in touch

Let’s discuss what you can achieve with location intelligence

Contact us