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

public static APIUsage get()

This call retrieves the API usage for current month.




This call returns an APIUsage object, and throws an APIException otherwise.


package examples;

import com.salesfly.SalesflyClient;
import com.salesfly.api.Usage;
import com.salesfly.exceptions.APIException;
import com.salesfly.exceptions.ResponseException;
import com.salesfly.models.APIUsage;

public class Example {
    public static void main(String[] args) {
        String apiKey = System.getenv("SALESFLY_APIKEY");

        try {
            APIUsage usage = Usage.get();
            System.out.println("Mail requests: " + usage.getMailRequests());
        } catch (ResponseException e) {
            System.err.println("Response error: " + e.getMessage());
        } catch (APIException e) {
            System.err.println("API error: " + e.getMessage());