Send your first API request
Check an API key with GET /v1/account and understand the first successful or failed response.
Start with GET /v1/account. It is a read-only request that confirms the API key works and shows which MailGraf account it belongs to. It does not expose billing details, users or other account settings.
Before you start
Create an API key under Settings > API keys and copy it when it is shown. If you have not prepared the Authorization header yet, read Authentication.
Check the connection
Open a terminal
Use a terminal on a trusted computer. Do not run a request containing a live key in a shared browser console or public code playground.Send the account request
Replacemg_live_...with your key and run the command below.
curl https://api.mailgraf.com/v1/account \
-H "Authorization: Bearer mg_live_..."
Read the response
A successful request returns HTTP 200 with the account id and name.
{
"id": 42,
"name": "Northstar Studio"
}
The values come from the account connected to your key, so your response will be different.
Resolve a failed request
- 401 Unauthorized: check that the header starts with
Bearerand that the key has not been revoked. - 403 Forbidden: the account's current plan does not include API access.
- 429 Too Many Requests: wait for the number of seconds in the
Retry-Afterresponse header before trying again.
Do not keep retrying a 401 or 403 response. Correct the key or account access first.
Where the full reference lives
See GET /v1/account in the API reference for the current response schema and all documented errors.
Frequently asked questions
Does this request change my account?
No. GET /v1/account only returns the id and name of the account connected to the API key.
What does a 401 response mean?
The Authorization header is missing or the API key is invalid or revoked.
Why do I receive a 403 response?
The account's current plan does not include API access.
Related articles
Was this helpful?
Still need help?
Write to us and a person will answer.

