How to validate email addresses in Go

Our free API to validate e-mail addresses is really easy to use in Golang


Verify e-mail in Go

package main

import (

func main() {

	url := ""

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-rapidapi-host", "")
	req.Header.Add("x-rapidapi-key", "YOUR-API-KEY")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)




This will return a JSON-array with information about the domain, and if you should block it or not.


You can of course just send it as a regular GET-request to that URL also, in your favorite way, as long as you have the API-key in the header.

You will receive a JSON response, telling you if this is a disposable e-mail to block, or if there are other issues with the domain:


    "valid": true,
    "block": true,
    "disposable": false,
    "domain": "",
    "text": "Suspicious e-mail",
    "reason": "Heuristics (4a)",
    "mx_host": "",
    "mx_info": "Using MX pointer from DNS with priority: 0",
    "mx_ip": ""


This will tell you if you should block the domain or not, and the reason to why the API thinks so (disposable e-mail, etc).

To get started for free, and get an API key, click here!