Create a batch email validation job
Creates an asynchronous batch validation job for up to 1,000 email addresses.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const EmailValidationBatch = await client.emailValidations.batch.create({
emails: [],
});
console.log(EmailValidationBatch.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
email_validation_batch = client.email_validations.batch.create(
emails=[],
)
print(email_validation_batch.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
batch, err := client.EmailValidations.Batch.New(
context.TODO(),
telnyx.EmailValidationBatchNewParams{
Emails: "emails",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", batch.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.emailValidations.batch.BatchCreateParams;
import java.util.List;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
BatchCreateParams params = BatchCreateParams.builder()
.emails(List.of())
.build();
var response = client.emailValidations().batch().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
email_validation_batch = telnyx.email_validations.batch.create(emails: [])
puts(email_validation_batch)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$email_validation_batch = $client->emailValidations->batch->create(
emails: [],
);
var_dump($email_validation_batch);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-validations:batch create \
--api-key 'My API Key' \
--emails emailscurl --request POST \
--url https://api.telnyx.com/v2/email_validations/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"emails": [
"[email protected]",
"[email protected]"
],
"webhook_url": "https://example.com/webhooks/email-validation"
}
'{
"data": {
"record_type": "email_validation_batch",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"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": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured."
}
]
}{
"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
Telnyx API key supplied as Authorization: Bearer <token>. In production, auth may be validated by the API gateway and forwarded via Telnyx auth headers.
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. Poll GET /email_validations/batch/{id} with the returned batch id to retrieve results.
Shape returned by the create endpoint. Includes duplicates_removed.
Show child attributes
Show child attributes
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const EmailValidationBatch = await client.emailValidations.batch.create({
emails: [],
});
console.log(EmailValidationBatch.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
email_validation_batch = client.email_validations.batch.create(
emails=[],
)
print(email_validation_batch.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
batch, err := client.EmailValidations.Batch.New(
context.TODO(),
telnyx.EmailValidationBatchNewParams{
Emails: "emails",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", batch.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.emailValidations.batch.BatchCreateParams;
import java.util.List;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
BatchCreateParams params = BatchCreateParams.builder()
.emails(List.of())
.build();
var response = client.emailValidations().batch().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
email_validation_batch = telnyx.email_validations.batch.create(emails: [])
puts(email_validation_batch)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$email_validation_batch = $client->emailValidations->batch->create(
emails: [],
);
var_dump($email_validation_batch);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-validations:batch create \
--api-key 'My API Key' \
--emails emailscurl --request POST \
--url https://api.telnyx.com/v2/email_validations/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"emails": [
"[email protected]",
"[email protected]"
],
"webhook_url": "https://example.com/webhooks/email-validation"
}
'{
"data": {
"record_type": "email_validation_batch",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"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": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured."
}
]
}{
"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."
}
]
}