This page provides practical examples to help you understand how to use the SafeTosSend API in different scenarios. Each example will provide a different result based on the email parameter sent in the SafeToSend request.
Reference
You can find detailed information about the response values of the SafeToSend API in the following pages:
Example 1: Safe to Send Email
This example presents a working email address that is safe to mail and is backed by AtData's 100% deliverable guarantee. You will see in the response a status code 50
, which indicates this email address is valid, and the status of safetosend
.
curl --request GET \
--url 'https://api.atdata.com/v5/ev?api_key=YOUR_SAFETOSEND_API_KEY&email=sales%40atdata.com' \
--header 'accept: application/json'
{
"safe_to_send": {
"domain_type": "biz",
"status_code": 50,
"address": "[email protected]",
"role_account": true,
"status": "safetosend"
}
}
This response indicates the queried email is deliverable and not risky or toxic.
Example 2: Valid Email
This is an example of a valid email response. You will find in the response a status code of 20
, along with a valid
status.
curl --request GET \
--url 'https://api.atdata.com/v5/ev?api_key=YOUR_SAFETOSEND_API_KEY&email=valid%40demo.atdata.co' \
--header 'accept: application/json'
{
"safe_to_send": {
"status_code": 20,
"address": "[email protected]",
"status": "valid"
}
}
Valid emails have passed the majority of our SafeToSend checks, but they cannot be 100% confirmed as deliverable and thus are not covered by our deliverability guarantee. Valid emails may still bounce and should be messaged cautiously. In the right column is the sample request and response.
Example 3: Invalid Email
This is an example of an invalid email response. You will find in the response a status code that is >= 100, along with a invalid
status.
curl --request GET \
--url 'https://api.atdata.com/v5/ev?api_key=YOUR_SAFETOSEND_API_KEY&email=accountnotfound%40atdata.com' \
--header 'accept: application/json'
{
"safe_to_send": {
"status_code": 400,
"address": "[email protected]",
"status": "invalid"
}
}
An email address will be invalid if it has a syntax error, a bad domain, or the mailbox doesn't exist or can not receive email. The status_code in the response can be used to determine the specific reason the address is invalid. In this example, the 400
status indicates that the email's mailbox doesn't exist.
Example 4: Email Corrections
AtData can fix many syntax and spelling errors in email addresses, including misspellings of common domain names. Any suggested fixes to an invalid email address will be in array called "email_corrections" in the response, as shown in the response below. A corrected email will always have an invalid
status.
curl --request GET \
--url 'https://api.atdata.com/v5/ev?api_key=YOUR_SAFETOSEND_API_KEY&email=sales%40%40atdata%2Ccom' \
--header 'accept: application/json'
{
"safe_to_send": {
"status_code": 155,
"address": "sales@@atdata,com",
"status": "invalid",
"role_account": true,
"email_corrections": [
"[email protected]"
]
}
}
In this example, the address has more than one "@" sign.
Example 5: Catchall Email
Some domains don't support email verification. These domains are known as "accept all" or "catchall" domains, and, in these cases, we can't determine whether an address is deliverable or not and it may bounce. These emails will return with a valid
status since they have passed the majority of our SafeToSend checks, and they will have a status code of 45
.
curl --request GET \
--url 'https://api.atdata.com/v5/ev?api_key=YOUR_SAFETOSEND_API_KEY&email=anyuser%40google.com' \
--header 'accept: application/json'
{
"safe_to_send": {
"status_code": 45,
"address": "[email protected]",
"status": "valid"
}
}
This indicates the domain is a catch-all and does not support validation.
Example 6: Trap Email
Trap addresses are deliverable but are confirmed spamtraps, suspected spamtraps, disposable emails, or otherwise considered high risk. You will find in the response a status code of 525
, along with a trap
status. To avoid delivery issues, donβt send email to these addresses.
Emails that are clearly dangerous, such as abuse@ emails, will be marked as invalid.
curl --request GET \
--url 'https://api.atdata.com/v5/ev?api_key=YOUR_SAFETOSEND_API_KEY&email=trap%40demo.atdata.com' \
--header 'accept: application/json'
{
"safe_to_send": {
"status_code": 525,
"address": "[email protected]",
"status": "trap"
}
}
Example 7: Disposable Email
A disposable email address is either for temporary use, to mask the identity of the user or to uniquely identify the website it is registered on. We categorize these emails as traps, but you may have reason to allow them. You will find in the response a status code of 525
, along with a trap
status, and a domain type disposable
.
curl --request GET \
--url 'https://api.atdata.com/v5/ev?api_key=YOUR_SAFETOSEND_API_KEY&email=johndoe%40mailinator.com' \
--header 'accept: application/json'
{
"safe_to_send": {
"domain_type": "disposable",
"status_code": 525,
"address": "[email protected]",
"status": "trap"
}
}