Fidro + Go Integration
Block disposable emails and detect fraud in your Go app. Follow this guide to add email validation and IP intelligence in minutes.
Overview
To integrate Fidro with Go, use the standard net/http package to send a POST request to the Fidro API with the user's email and IP address. Fidro returns email validation, disposable domain checks, IP geolocation, VPN detection, and a fraud risk score in a single JSON response. Go's standard library handles everything — no third-party dependencies or SDKs are needed.
Fidro is a fraud detection API that combines email validation, IP intelligence, geolocation analysis, and Stripe chargeback prevention in a single API call. It returns a risk score with a clear recommendation — allow, review, or block — so you can stop fraud without building your own scoring logic.
1. Install Dependencies
# No external dependencies needed
You will also need a Fidro API key. Sign up for free to get one.
2. Email Validation
Send a POST request to Fidro's /v1/validate endpoint with the user's email address and optional IP. Fidro validates the email, checks for disposable domains, analyzes the IP for VPN/proxy/Tor usage, and returns a risk score with a clear recommendation — allow, review, or block.
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
type ValidateRequest struct {
Email string `json:"email"`
IP string `json:"ip"`
}
type ValidateResponse struct {
Data struct {
RiskScore float64 `json:"risk_score"`
Recommendation string `json:"recommendation"`
} `json:"data"`
}
func validateEmail(email, ip string) (*ValidateResponse, error) {
apiKey := os.Getenv("FIDRO_API_KEY")
payload, _ := json.Marshal(ValidateRequest{Email: email, IP: ip})
req, err := http.NewRequest("POST", "https://api.fidro.io/v1/validate", bytes.NewBuffer(payload))
if err != nil {
return nil, fmt.Errorf("creating request: %w", err)
}
req.Header.Set("Authorization", "Bearer "+apiKey)
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
return nil, fmt.Errorf("sending request: %w", err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("API error: %s", resp.Status)
}
var result ValidateResponse
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return nil, fmt.Errorf("decoding response: %w", err)
}
return &result, nil
}
func main() {
result, err := validateEmail("test@example.com", "8.8.8.8")
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
fmt.Printf("Risk score: %.2f\n", result.Data.RiskScore)
fmt.Printf("Recommendation: %s\n", result.Data.Recommendation)
}
3. IP Lookup
Send a POST request to Fidro's /v1/ip-lookup endpoint with an IP address. Fidro returns geolocation data (country, city, ISP), VPN and proxy detection, Tor exit node identification, and threat intelligence — all in a single API call.
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
type IPLookupRequest struct {
IP string `json:"ip"`
}
type IPLookupResponse struct {
Data struct {
Country string `json:"country"`
IsVPN bool `json:"is_vpn"`
} `json:"data"`
}
func lookupIP(ip string) (*IPLookupResponse, error) {
apiKey := os.Getenv("FIDRO_API_KEY")
payload, _ := json.Marshal(IPLookupRequest{IP: ip})
req, err := http.NewRequest("POST", "https://api.fidro.io/v1/ip-lookup", bytes.NewBuffer(payload))
if err != nil {
return nil, fmt.Errorf("creating request: %w", err)
}
req.Header.Set("Authorization", "Bearer "+apiKey)
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
return nil, fmt.Errorf("sending request: %w", err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("API error: %s", resp.Status)
}
var result IPLookupResponse
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return nil, fmt.Errorf("decoding response: %w", err)
}
return &result, nil
}
func main() {
result, err := lookupIP("8.8.8.8")
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
fmt.Printf("Country: %s\n", result.Data.Country)
fmt.Printf("Is VPN: %v\n", result.Data.IsVPN)
}
Test the IP lookup response format with our free IP checker tool before integrating.
Next steps
Explore the full API reference, try the free email checker, or see how Fidro compares to other solutions.
Frequently Asked Questions
How do I add fraud detection to Go?
Does Fidro have a Go SDK?
Is Fidro free to use with Go?
Start catching bad signups in the next 5 minutes
Create your account, grab your API key, and send your first request. Free plan with 200 validations/month. No credit card. Cancel anytime.
Get Started Free