Get current usage
/api/v1/billing/usageWhat your organization has sent this period, against its plan allowance and any purchased credits.
Request
/api/v1/billing/usagecurl -X GET 'https://app.mailyte.com/api/v1/billing/usage' \
-H 'Authorization: Bearer mk_live_YOUR_API_KEY'const response = await fetch('https://app.mailyte.com/api/v1/billing/usage', {
method: 'GET',
headers: {
Authorization: 'Bearer mk_live_YOUR_API_KEY',
},
});
const { data } = await response.json();import requests
response = requests.get(
"https://app.mailyte.com/api/v1/billing/usage",
headers={"Authorization": "Bearer mk_live_YOUR_API_KEY"},
)
data = response.json()["data"]<?php
$response = Http::withToken('mk_live_YOUR_API_KEY')
->get('https://app.mailyte.com/api/v1/billing/usage');
$data = $response->json('data');require "net/http"
require "json"
uri = URI("https://app.mailyte.com/api/v1/billing/usage")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer mk_live_YOUR_API_KEY"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request) }Response
Success.
dataobjectobjectstringusagemailboxesobjectfree_usedintegerFree-tier mailboxes in use. Counted locally with a SQL count, so a number here is always a real count and an organization with none reads `0`. **null means UNKNOWN — the count was not supplied**, never zero.
free_limitintegerHow many free-tier mailboxes are allowed. **null means NO LIMIT, not unknown** — an organization holding paid seats genuinely has no ceiling on free mailboxes. This is a limit, computed from the catalogue on our side, so it is never unreadable and the two meanings of null cannot collide here.
seatsobjectPaid seats, per tier.
standardobjectSeats of the standard tier. Counted from the catalogue on our side, so neither figure goes null when the mail server is unreachable.
proobjectSeats of the pro tier. Counted from the catalogue on our side, so neither figure goes null when the mail server is unreachable.
workplaceobjectSeats of the workplace tier. Counted from the catalogue on our side, so neither figure goes null when the mail server is unreachable.
send_creditsobjectbalanceintegerSend credits remaining — a COUNT OF EMAILS, not money. Read `source` to know which side answered. An exhausted balance reads `0`. **null means UNKNOWN — neither side produced a figure.** Note this field does NOT go null merely because the mail server is unreachable, unlike the meters around it: the ledger answers in that case and `source` says `ledger`.
sourcestringenforcer | ledgerWhich side produced `balance`. `enforcer` is the mail server's live counter. `ledger` is our accounting copy, returned when the mail server could not be reached — both are real numbers, which is why this one does not go null, but they are measured at different moments. SMTP-relay sends create no rows on our side, so the ledger can trail reality by up to fifteen minutes: `ledger` is a signal that the figure may be STALE, not that it is wrong.
used_this_monthintegerCredits consumed this calendar month. **null means UNKNOWN — the mail server could not be reached.** Never read it as zero; retry instead.
app_sendobjectSending through the API and webmail, as opposed to SMTP relay. EVERY METER IN THIS OBJECT GOES NULL TOGETHER when the mail server is unreachable, so a caller can never see a half-read meter. Three cases to tell apart: `used: 4, included: 400` (sent 4 of 400), `used: 0, included: 400` (sent nothing), and `used: null, included: null` (we could not read the meter — a transient on our side; retry rather than conclude anything about the customer).
monthlyobjectincludedintegerEmails a month included. Computed from the catalogue here, so an unreachable mail server cannot make it unknown and it does NOT go null with the meter beside it. An organization with no monthly allowance reads `0`. **null means UNKNOWN — the figure was not supplied**, never zero.
usedintegerEmails sent this month. **null means UNKNOWN — the mail server could not be reached**, never zero.
dailyobjectincludedintegerThe daily allowance ACTUALLY IN FORCE at the mail server today — **not the free floor in the price list**. Those are different numbers. The floor is granted only to an organization with no credit balance and no Send-plan volume, so an account holding either reads `0` here AND THAT 0 IS CORRECT: it is not an outage and not a bug. If you are comparing this against a figure on our pricing page and they differ, this field is the one that governs what you may send. Publishing the catalogue number instead would tell a paying customer they have free sends stacked on what they bought. **null means UNKNOWN — the mail server could not be reached.**
usedintegerEmails sent today. **null means UNKNOWN — the mail server could not be reached**, never zero.
Returned inside the standard envelope.
Errors
| Status | When |
|---|---|
401 | The API key is missing, unknown, revoked or expired. All four answer identically, on purpose: distinguishing them would confirm which keys exist. |
403 | The key is valid but may not do this: it lacks the required scope, its IP allowlist does not include you, or this endpoint does not accept API keys. |
404 | No such resource in this organization. |
422 | The request was understood but the values were not acceptable. |
429 | Too many requests, or the organization has spent its sending allowance. `Retry-After` says how long to wait. |
Every status, with what causes it and what to do, is on the error reference.