Usage API

The Usage API is a free REST API that provides programmatic access and visibility into activity consumption across products for your account. It is the most important and best tool for helping to monitor and manage usage across the different APIs under your account.

Get usage

client.usage.get()

This call retrieves the API usage for current month.

Arguments

None

Returns

This call returns an API usage object, and returns an error otherwise.

The usage object has the following fields:

Attribute Type Description
geoip_requests number The number of Geolocation API requests used in the current month
mail_requests number The number of Mail API requests used in the current month

Example

const objectia = require("objectia")

const client = new objectia({
	apiKey: "your-api-key",
})

try {
	let usage = await client.usage.get()
	console.log("Number of GeoLocation requests: " + usage.geoip_requests)
} catch (err) {
	console.log("Failed to get API usage")
}