Authentication
Let's learn how to authenticate with the Mails API in just a few minutes.
Getting Started
To use the Mails API, you'll need to authenticate your requests using an API key.
What you'll need
- A Mails API key
- A tool to make HTTP requests (like curl, Postman, or your preferred programming language's HTTP client)
Obtain an API key
If you haven't already, sign up for a Mails account to obtain your API key. Your API key is a unique identifier that authenticates your requests to the Mails API.
Using your API key
To authenticate your requests, include your API key in the x-mails-api-key
header of your HTTP requests.
Here's an example using curl:
curl \
-H "x-mails-api-key: YOUR_API_KEY_HERE" \
"https://api.mails.so/v1/[email protected]"
Replace YOUR_API_KEY_HERE
with your actual Mails API key.
API key security
Keep your API key secure:
- Never share your API key publicly or commit it to version control systems.
- Use environment variables or secure key management systems to store your API key.
- Rotate your API key periodically for enhanced security.
Start using the API
Now that you know how to authenticate, you can start making requests to the Mails API. Here's a simple example to validate an email address:
curl \
-H "x-mails-api-key: 31eefbda-b8be-41fa-ae02-a6ecd6a97f19" \
"https://api.mails.so/v1/[email protected]"
This request will return a JSON response with information about the validity of the email address.
Open your preferred code editor and try making an authenticated request to the Mails API. Experiment with different endpoints and parameters to explore the API's capabilities.
Remember to replace the example API key with your own when making actual requests.