API
Credit balance
GET /v1/credits returns the credits you can spend now, any debt, credits that are still being applied, and your credit lots with their expiry dates. It is free and needs a key with the account:read scope. The balance is the same on https://api.email-validation.org and on the EU endpoint https://api-eu.email-validation.org (EU data residency).
The reference page for GET /v1/credits lists every field and every error and shows the request in seven languages beside the response.
Request
curl
curl https://api.email-validation.org/v1/credits -H "Authorization: Bearer $EV_API_KEY"PowerShell
# Windows PowerShell 5.1 and PowerShell 7 (in 5.1, curl is a short name for another command).
$headers = @{ Authorization = "Bearer $env:EV_API_KEY" }
$credits = Invoke-RestMethod -Uri 'https://api.email-validation.org/v1/credits' -Headers $headers -TimeoutSec 10
"Balance: $($credits.balance)"JavaScript
const res = await fetch('https://api.email-validation.org/v1/credits', {
headers: { Authorization: `Bearer ${process.env.EV_API_KEY}` },
});
const credits = await res.json().catch(() => ({ error: { code: `HTTP ${res.status}`, message: 'not JSON' } }));
if (!res.ok || credits.error) throw new Error(`${credits.error.code}: ${credits.error.message}`);
console.log(`Balance: ${credits.balance}`);Python
import os
import requests # pip install requests
resp = requests.get(
"https://api.email-validation.org/v1/credits",
headers={"Authorization": f"Bearer {os.environ['EV_API_KEY']}"},
timeout=10,
)
resp.raise_for_status()
credits = resp.json()
print("Balance:", credits["balance"])
for lot in credits["lots"]:
print(lot["remaining"], "credits expire on", lot["expires_at"][:10])Response
{
"balance": 24350,
"debt": 0,
"pending": 0,
"lots": [
{
"remaining": 850,
"expires_at": "2027-03-14T12:00:00.000Z"
},
{
"remaining": 23500,
"expires_at": "2028-09-30T08:15:00.000Z"
}
]
}| Field | Type | Description |
|---|---|---|
balance | integer | Credits you can spend now. |
debt | integer | Credits owed after a refund or reversal; new credits pay this off first. |
pending | integer | Credits granted moments ago that are still being applied. They become spendable shortly. |
lots | array of CreditLot | Credit lots with credits left, soonest-expiring first. Credits are spent in this order. |
Each lot is one grant of credits (your sign-up credits, a purchase or an adjustment). Lots are listed soonest-expiring first. We spend them in the same order, so credits that are about to expire are used before newer ones.
Debt and pending credits
debtis above 0 only after credits had to be taken back, for example after a payment was reversed. New credits pay off debt first.pendingcounts credits granted a moment ago, for example right after a purchase, that are still being applied. They become part ofbalancewithin seconds.
Related
- Credits and billing: what costs a credit, packs and the expiry rules.
- Usage: credits used per day or per key.
- Webhooks:
credits.lowandcredits.expiringevents.