Create a batch email validation job
Creates an asynchronous batch validation job for up to 1,000 email addresses.
curl --request POST \
--url https://api.telnyx.com/v2/email_validations/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"emails": [
"user@example.com",
"admin@example.org"
],
"webhook_url": "https://example.com/webhooks/email-validation"
}
'import requests
url = "https://api.telnyx.com/v2/email_validations/batch"
payload = {
"emails": ["user@example.com", "admin@example.org"],
"webhook_url": "https://example.com/webhooks/email-validation"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
emails: ['user@example.com', 'admin@example.org'],
webhook_url: 'https://example.com/webhooks/email-validation'
})
};
fetch('https://api.telnyx.com/v2/email_validations/batch', 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.telnyx.com/v2/email_validations/batch",
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([
'emails' => [
'user@example.com',
'admin@example.org'
],
'webhook_url' => 'https://example.com/webhooks/email-validation'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.telnyx.com/v2/email_validations/batch"
payload := strings.NewReader("{\n \"emails\": [\n \"user@example.com\",\n \"admin@example.org\"\n ],\n \"webhook_url\": \"https://example.com/webhooks/email-validation\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.telnyx.com/v2/email_validations/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"emails\": [\n \"user@example.com\",\n \"admin@example.org\"\n ],\n \"webhook_url\": \"https://example.com/webhooks/email-validation\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/email_validations/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"emails\": [\n \"user@example.com\",\n \"admin@example.org\"\n ],\n \"webhook_url\": \"https://example.com/webhooks/email-validation\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"record_type": "email_validation_batch",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"total": 1,
"duplicates_removed": 1,
"webhook_url": "<string>"
}
}{
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "emails is required and must be an array"
}
]
}{
"errors": [
{
"code": "10006",
"title": "Not authorized",
"detail": "Invalid API key",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10006"
}
}
]
}{
"errors": [
{
"code": "10036",
"title": "Resource is being processed",
"detail": "A request with this Idempotency-Key is already being processed.",
"source": {
"pointer": "/header/Idempotency-Key"
}
}
]
}{
"errors": [
{
"title": "<string>",
"detail": "<string>",
"source": {},
"meta": {}
}
],
"suppressed": [
{
"to": "jsmith@example.com",
"reason": "<string>",
"scope": "<string>",
"override_allowed": true
}
]
}{
"errors": [
{
"code": "10015",
"title": "Validation Failed",
"detail": "webhook_url must be an HTTP or HTTPS URL",
"source": {
"pointer": "/data/attributes/webhook_url"
}
}
]
}{
"errors": [
{
"code": "10019",
"title": "Internal Server Error",
"detail": "Failed to create batch validation"
}
]
}{
"errors": [
{
"code": "10016",
"title": "Service Unavailable",
"detail": "The email domain service is temporarily unavailable. Please try again later."
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Optional opaque, unquoted key for safely retrying the same logical request. Keys must contain 1 to 255 letters, numbers, hyphens, or underscores. Generate a unique UUID v4 for each operation and reuse it only when retrying that operation with the same request. Invalid headers—including duplicate, empty, malformed, or overlong values—return 400 with error code 10015. A request already in progress with the same key returns 409; reusing the key with a different request returns 422. Only successful responses are replayed, for up to 24 hours. Do not include sensitive data in the key.
1 - 255^[A-Za-z0-9_-]{1,255}$Body
1 - 1000 elementsEmail address to validate. Any string is accepted; validation results indicate whether the address is valid. Blank strings are discarded and counted in duplicates_removed; if all entries are blank, returns 400.
URL for batch completion webhook. Empty string is treated as omitted. SSRF-protected; private/reserved IPs and internal hostnames are rejected.
2048^https?://Response
Batch validation job accepted.
Shape returned by the create endpoint. Includes duplicates_removed.
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://api.telnyx.com/v2/email_validations/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"emails": [
"user@example.com",
"admin@example.org"
],
"webhook_url": "https://example.com/webhooks/email-validation"
}
'import requests
url = "https://api.telnyx.com/v2/email_validations/batch"
payload = {
"emails": ["user@example.com", "admin@example.org"],
"webhook_url": "https://example.com/webhooks/email-validation"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
emails: ['user@example.com', 'admin@example.org'],
webhook_url: 'https://example.com/webhooks/email-validation'
})
};
fetch('https://api.telnyx.com/v2/email_validations/batch', 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.telnyx.com/v2/email_validations/batch",
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([
'emails' => [
'user@example.com',
'admin@example.org'
],
'webhook_url' => 'https://example.com/webhooks/email-validation'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.telnyx.com/v2/email_validations/batch"
payload := strings.NewReader("{\n \"emails\": [\n \"user@example.com\",\n \"admin@example.org\"\n ],\n \"webhook_url\": \"https://example.com/webhooks/email-validation\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.telnyx.com/v2/email_validations/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"emails\": [\n \"user@example.com\",\n \"admin@example.org\"\n ],\n \"webhook_url\": \"https://example.com/webhooks/email-validation\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/email_validations/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"emails\": [\n \"user@example.com\",\n \"admin@example.org\"\n ],\n \"webhook_url\": \"https://example.com/webhooks/email-validation\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"record_type": "email_validation_batch",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"total": 1,
"duplicates_removed": 1,
"webhook_url": "<string>"
}
}{
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "emails is required and must be an array"
}
]
}{
"errors": [
{
"code": "10006",
"title": "Not authorized",
"detail": "Invalid API key",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10006"
}
}
]
}{
"errors": [
{
"code": "10036",
"title": "Resource is being processed",
"detail": "A request with this Idempotency-Key is already being processed.",
"source": {
"pointer": "/header/Idempotency-Key"
}
}
]
}{
"errors": [
{
"title": "<string>",
"detail": "<string>",
"source": {},
"meta": {}
}
],
"suppressed": [
{
"to": "jsmith@example.com",
"reason": "<string>",
"scope": "<string>",
"override_allowed": true
}
]
}{
"errors": [
{
"code": "10015",
"title": "Validation Failed",
"detail": "webhook_url must be an HTTP or HTTPS URL",
"source": {
"pointer": "/data/attributes/webhook_url"
}
}
]
}{
"errors": [
{
"code": "10019",
"title": "Internal Server Error",
"detail": "Failed to create batch validation"
}
]
}{
"errors": [
{
"code": "10016",
"title": "Service Unavailable",
"detail": "The email domain service is temporarily unavailable. Please try again later."
}
]
}