Authentication
Create an API key in the app and send it as a bearer token on every request.
Every request to the MailGraf API carries an API key. Keys belong to your account and are created in the app, not through the API.
Create a key
Open Settings > API keys
Keys are managed under API keys in the app settings.Create a key and copy it
Click Create API key, give the key a name you will recognise later and copy it. The full key is shown only once.Store the key
Save it in a secret manager or secure server configuration. Read API key security before connecting a production service.
Send it as a bearer token
Add an Authorization header to every request:
Authorization: Bearer mg_live_...
A revoked key stops working immediately. After repeated failed attempts from one IP address, access from that address is locked for a while, so correct the key rather than retrying the same request.
Check the connection
Use the read-only account check in Send your first API request to confirm that the header and key work together.
Where the full reference lives
Every endpoint, its parameters, response schemas and error codes are documented in the API reference. These guides do not repeat them, so the two cannot drift apart.
Frequently asked questions
Where do I create an API key?
Open Settings > API keys in MailGraf and click Create API key.
I lost my key. Can I see it again?
No. A key is shown once, when it is created. Create a new key and revoke the old one.
Why does my request return 401?
The Authorization header is missing or the API key is invalid or revoked.
Related articles
Was this helpful?
Still need help?
Write to us and a person will answer.

