AhaSend

Statistics for your whole account, now in the API

Mark Kraakman
Mark Kraakman
Product Update
On this page

"How many emails did each of our customers send in March?"

If you run a platform or an agency, you get this question from finance every month. Until now it was harder to answer than it should be. The existing statistics in AhaSend are built from your messages, so they go back only as far as your message retention. And short retention is what you want: there is no reason to keep data about individual messages longer than you need it.

The numbers are a different matter. You need them for invoices, for yearly reports and for the board deck, long after the messages themselves are gone.

So we separated the two. The new Get Email Statistics endpoint returns the email counts of your account, or of each of its domains, for any period in your account's history. It is not limited by your retention settings.

What you can do with it

Charge email through per customer. With a breakdown by domain you get the counts of every sending domain per month. If each of your customers sends from their own domain, that is your invoice basis. reception_count is the number of messages AhaSend accepted, and it is the same count our billing uses, so your numbers match ours.

Report without building a counter yourself. Many teams keep their own tally from webhooks, just to be able to say what they sent last quarter. You can stop doing that. Volumes per hour, day, week or month are one request away.

Look back further than a month. Compare this November with last November, or see how a domain grew over the past years. Domains you deleted are still in there.

What is counted

The counts cover transactional mail, campaigns and inbound mail. Inbound mail is counted under the domain that received it. Sandbox mail is not counted.

For every period you get eight counters: messages accepted, delivered, bounced and suppressed, spam complaints, temporary delivery failures, opens and clicks. The last three count events, so one message can add more than one open. Opens and clicks are never fully accurate; we make a reasonable effort to filter out bots and scanners.

How it works

Ask for the monthly counts per domain since January:

curl --request GET \
  --url 'https://api.ahasend.com/v2/accounts/{account_id}/statistics/emails?group_by=month&breakdown=domain&from_time=2026-01-01T00:00:00Z&to_time=2026-11-01T00:00:00Z' \
  --header 'Authorization: Bearer YOUR_API_KEY'

Each row in data is one domain in one period:

{
  "from_timestamp": "2026-03-01T00:00:00Z",
  "to_timestamp": "2026-04-01T00:00:00Z",
  "sender_domain": "customer-one.com",
  "reception_count": 48210,
  "delivered_count": 47655,
  "bounced_count": 498,
  "suppressed_count": 57,
  "complained_count": 3,
  "deferred_count": 1204,
  "opened_count": 0,
  "clicked_count": 0
}

Next to the rows, totals gives the counts of the whole request, which is often all you need.

A few things to know:

  • Periods are in UTC, and weeks start on Monday.
  • A range can be at most 31 days per hour, 366 days per day or week, and 5 years per month.
  • Leave out breakdown=domain and you get one row per period for the whole account. Use sender_domain to select specific domains.
  • The API key needs the statistics:read:all scope, or statistics:read:{domain} for specific domains. The old names, which start with statistics-transactional, still work. A key with domain scopes sees only those domains.

Or just ask

The same statistics are available through the AhaSend MCP server. Connect it to your AI assistant and ask in plain words:

How many emails did each of our domains send per month this year? Put it in a table.

That is the monthly report for finance, without a line of code.

The full reference, with every parameter and the paging of large breakdowns, is in the docs.