Validating an email address

In order to try these examples, head over to Uniserv CONNECT and create an API Key (test accounts are free!).

Basic Validation

Validating an email address using Uniserv’s RESTful API is quick and easy. Just pass the address in JSON format and send it to the validation endpoint at https://api.uniserv.com/ using HTTP POST:

POST /email/v2/validate
Content-Type: application/json
Authorization: Bearer <your-api-key-here>

{
    "email": "example@uniserv.com"
}

When Uniserv receives the request, it will do the following:

  1. Check the email address for syntax and deliverability

  2. Enrich the address with additional information (if requested)

The result will look like this:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "email": "example@uniserv.com",
    "deliverable": "yes"
}

Requesting Additional Information

In addition we can enrich the address with related information, like domain, account or dns information.

POST /email/v2/validate
Content-Type: application/json
Authorization: Bearer <your-api-key-here>

{
    "email": "example@uniserv.com",
    "_options": {
        "includes":  ["domain-info", "account-info", "dns-info"]
    }
}

The response will then contain the requested information:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "email": "example@uniserv.com",
    "deliverable": "yes",
    "domainInfo": {
        "freemailer": "no",
        "disposable": "no",
        "acceptAll": "no"
    },
    "accountInfo": {
        "role": "no",
        "fullMailbox": "no",
        "disabled": "no"
    },
    "dnsInfo": {
        "type": "MX",
        "record": "mail.uniserv-online.de."
    }
}

Troubleshooting

The API returns errors with HTTP status codes and a payload in problem+json format (see RFC 7807):

HTTP/1.1 401 Unauthorized
Content-Type: application/problem+json
X-Uniserv-Request-Id: ea9a76bd3e80875f

{
    "status": 401,
    "type": "https://docs.uniserv.com/location/problems#no-auth-data",
    "title": "No authorization header present"
}

The type attribute is a URI that points to a description of the error and possible solutions. For more information please refer to the list of errors.