curl --request POST \
--url https://api.datalegion.ai/utility/clean \
--header 'API-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"fields": {
"email": "John.Doe+tag@gmail.com",
"phone": "(555) 123-4567",
"domain": "https://www.Google.com/about",
"company": "Google LLC"
}
}
'import requests
url = "https://api.datalegion.ai/utility/clean"
payload = { "fields": {
"email": "John.Doe+tag@gmail.com",
"phone": "(555) 123-4567",
"domain": "https://www.Google.com/about",
"company": "Google LLC"
} }
headers = {
"API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fields: {
email: 'John.Doe+tag@gmail.com',
phone: '(555) 123-4567',
domain: 'https://www.Google.com/about',
company: 'Google LLC'
}
})
};
fetch('https://api.datalegion.ai/utility/clean', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.datalegion.ai/utility/clean",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'fields' => [
'email' => 'John.Doe+tag@gmail.com',
'phone' => '(555) 123-4567',
'domain' => 'https://www.Google.com/about',
'company' => 'Google LLC'
]
]),
CURLOPT_HTTPHEADER => [
"API-Key: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.datalegion.ai/utility/clean"
payload := strings.NewReader("{\n \"fields\": {\n \"email\": \"John.Doe+tag@gmail.com\",\n \"phone\": \"(555) 123-4567\",\n \"domain\": \"https://www.Google.com/about\",\n \"company\": \"Google LLC\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.datalegion.ai/utility/clean")
.header("API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"fields\": {\n \"email\": \"John.Doe+tag@gmail.com\",\n \"phone\": \"(555) 123-4567\",\n \"domain\": \"https://www.Google.com/about\",\n \"company\": \"Google LLC\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalegion.ai/utility/clean")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fields\": {\n \"email\": \"John.Doe+tag@gmail.com\",\n \"phone\": \"(555) 123-4567\",\n \"domain\": \"https://www.Google.com/about\",\n \"company\": \"Google LLC\"\n }\n}"
response = http.request(request)
puts response.read_body{
"results": {
"email": {
"original": "John.Doe+tag@gmail.com",
"cleaned": "johndoe@gmail.com",
"normalized": true
},
"phone": {
"original": "(555) 123-4567",
"cleaned": "+15551234567",
"normalized": true
},
"domain": {
"original": "https://www.Google.com/about",
"cleaned": "google.com",
"normalized": true
},
"company": {
"original": "Google LLC",
"cleaned": {
"name": "google",
"type": "name"
},
"normalized": true
}
}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}Field Cleaning
Clean and normalize person fields (email, phone, name, state, country, social URL) and company fields (domain, company name, LinkedIn URL, ticker symbol) to match API format before using search.
curl --request POST \
--url https://api.datalegion.ai/utility/clean \
--header 'API-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"fields": {
"email": "John.Doe+tag@gmail.com",
"phone": "(555) 123-4567",
"domain": "https://www.Google.com/about",
"company": "Google LLC"
}
}
'import requests
url = "https://api.datalegion.ai/utility/clean"
payload = { "fields": {
"email": "John.Doe+tag@gmail.com",
"phone": "(555) 123-4567",
"domain": "https://www.Google.com/about",
"company": "Google LLC"
} }
headers = {
"API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fields: {
email: 'John.Doe+tag@gmail.com',
phone: '(555) 123-4567',
domain: 'https://www.Google.com/about',
company: 'Google LLC'
}
})
};
fetch('https://api.datalegion.ai/utility/clean', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.datalegion.ai/utility/clean",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'fields' => [
'email' => 'John.Doe+tag@gmail.com',
'phone' => '(555) 123-4567',
'domain' => 'https://www.Google.com/about',
'company' => 'Google LLC'
]
]),
CURLOPT_HTTPHEADER => [
"API-Key: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.datalegion.ai/utility/clean"
payload := strings.NewReader("{\n \"fields\": {\n \"email\": \"John.Doe+tag@gmail.com\",\n \"phone\": \"(555) 123-4567\",\n \"domain\": \"https://www.Google.com/about\",\n \"company\": \"Google LLC\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.datalegion.ai/utility/clean")
.header("API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"fields\": {\n \"email\": \"John.Doe+tag@gmail.com\",\n \"phone\": \"(555) 123-4567\",\n \"domain\": \"https://www.Google.com/about\",\n \"company\": \"Google LLC\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalegion.ai/utility/clean")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fields\": {\n \"email\": \"John.Doe+tag@gmail.com\",\n \"phone\": \"(555) 123-4567\",\n \"domain\": \"https://www.Google.com/about\",\n \"company\": \"Google LLC\"\n }\n}"
response = http.request(request)
puts response.read_body{
"results": {
"email": {
"original": "John.Doe+tag@gmail.com",
"cleaned": "johndoe@gmail.com",
"normalized": true
},
"phone": {
"original": "(555) 123-4567",
"cleaned": "+15551234567",
"normalized": true
},
"domain": {
"original": "https://www.Google.com/about",
"cleaned": "google.com",
"normalized": true
},
"company": {
"original": "Google LLC",
"cleaned": {
"name": "google",
"type": "name"
},
"normalized": true
}
}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}Supported Fields
Person Fields
| Field | What It Does |
|---|---|
email | Removes plus tags, normalizes Gmail dots, lowercases |
phone | Normalizes to E.164 format (e.g., +15551234567) |
full_name | Strips prefixes/suffixes, normalizes whitespace |
first_name | Strips prefixes, normalizes whitespace |
last_name | Strips suffixes, normalizes whitespace |
state | Returns full name and code (e.g., CA → {"full_name": "california", "code": "CA"}) |
country | Returns full name and code (e.g., US → {"full_name": "united states", "code": "US"}) |
social_url | Normalizes LinkedIn, Twitter/X, GitHub, Facebook URLs |
school | Accepts name, website URL, or domain — detects type and normalizes |
Company Fields
| Field | What It Does |
|---|---|
domain | Extracts domain from URL, removes www. prefix |
company | Accepts name, website URL, or domain — detects type and normalizes |
linkedin_company_url | Normalizes LinkedIn company page URL |
ticker_symbol | Uppercases and strips whitespace |
Authorizations
Body
Request model for batch field cleaning.
Map of field names to values to clean (e.g., {'email': 'John.Doe+tag@gmail.com', 'domain': 'https://www.Google.com/about'}). Supported person fields: email, phone, full_name, first_name, last_name, state, country, social_url, school. Supported company fields: company, domain, linkedin_company_url, ticker_symbol.
Show child attributes
Show child attributes
Default region for phone number normalization (ISO 3166-1 alpha-2 code)
Response
Success - fields cleaned and normalized
Response model for batch field cleaning.
Map of field names to cleaning results
Show child attributes
Show child attributes
Was this page helpful?