EMAIL API

send

Send an email to a specified recipient with optional Bcc and attachments
Credits Required: 1.0

PARAMETERS

NAME TYPE REQUIRED DESCRIPTION ADDITIONAL CREDITS PER ITEM EXAMPLE
to string Yes Email Recipient (max 255 chars) None
receiver_name@gmail.com
subject string Yes Email subject (max 255 chars) None
Company Newsletter - August 2026
message string Yes Email message body (HTML allowed, max 65535 chars) None
<h1>Welcome to our Newsletter</h1><p>Thank you for subscribing!</p>
from_email string Yes Sender email address (max 255 chars) None
sender_name@company.com
from_name string Yes Sender name (max 255 chars) None
Company Support
Bcc array No Array of Bcc email addresses (max 20 addresses, each max 255 chars and billed 0.5 credits more per email) 0.5
[
    "bcc_1@company.com",
    "bcc_2@company.com",
    "bcc_3@company.com"
]
Attachments array No Array of files to attach to the email (max 5 attachments, max total size 10MB, each file billed 0.5 credits more) 0.5
[
    {
        "filename": "document.pdf",
        "data": "base64_encoded_string_here"
    },
    {
        "filename": "image.png",
        "data": "base64_encoded_string_here"
    }
]

RESPONSE EXAMPLE

{
    "status": "success",
    "message": "The email has been sent successfully"
}

ADDITIONAL INFO

Records in your domain DNS (to improve email deliverability and prevent spoofing):

Type        Host/Name	                Value

TXT         @ (or empty)                v=spf1 include:_spf.apicentral.dev -all
CNAME	    default._domainkey          dkim-relay._domainkey.apicentral.dev
TXT         _dmarc                      v=DMARC1; p=quarantine;

WARNING:
Only send emails from domains you own and have properly configured with the above DNS records.
Sending from unverified domains may lead to email delivery issues.
NO SPAM ALLOWED or your account will be suspended!

CODE EXAMPLES

<?php

$Curl = curl_init();

$PostFields = 
[
  'to' => 'receiver_name@gmail.com',
  'subject' => 'Company Newsletter - August 2026',
  'message' => 'Welcome to our NewsletterThank you for subscribing!',
  'from_email' => 'sender_name@company.com',
  'from_name' => 'Company Support',
  'Bcc' => 
  [
    '0' => 'bcc_1@company.com',
    '1' => 'bcc_2@company.com',
    '2' => 'bcc_3@company.com',
  ],
  'Attachments' => 
  [
    '0' => 
    [
      'filename' => 'document.pdf',
      'data' => 'base64_encoded_string_here',
    ],
    '1' => 
    [
      'filename' => 'image.png',
      'data' => 'base64_encoded_string_here',
    ],
  ],
];

curl_setopt_array(
    $Curl,
    [
        CURLOPT_URL => 'https://apicentral.dev/Email/send',
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => http_build_query($PostFields),
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTPHEADER => 
        [
            'Authorization: Bearer YOUR_API_TOKEN_HERE',
            'Content-Type: application/x-www-form-urlencoded'
        ]
    ]
);

$Response = curl_exec($Curl);
$Data = json_decode($Response, true);

if (curl_errno($Curl))
    $Error = curl_error($Curl);
else
{
    $status = $Data['status'];
    $message = $Data['message'];
    $data = $Data['data'] ?? null;
}

curl_close($Curl); // Omit in PHP 8 and above
?>

import requests
import json

url = 'https://apicentral.dev/Email/send'
Headers = {'Authorization': 'Bearer YOUR_API_TOKEN_HERE'}
Data = 
{
  "to": "receiver_name@gmail.com",
  "subject": "Company Newsletter - August 2026",
  "message": "Welcome to our NewsletterThank you for subscribing!",
  "from_email": "sender_name@company.com",
  "from_name": "Company Support",
  "Bcc": 
  {
    "0": "bcc_1@company.com",
    "1": "bcc_2@company.com",
    "2": "bcc_3@company.com"
  },
  "Attachments": 
  {
    "0": 
    {
      "filename": "document.pdf",
      "data": "base64_encoded_string_here"
    },
    "1": 
    {
      "filename": "image.png",
      "data": "base64_encoded_string_here"
    }
  }
}

try:
    Response = requests.post(url, json=Data, headers=Headers)
    ResData = Response.json()
    status = ResData.get('status')
    message = ResData.get('message')
    data = ResData.get('data')
except Exception as e:
    error = str(e)

const axios = require('axios');

const Data = 
{
  "to": "receiver_name@gmail.com",
  "subject": "Company Newsletter - August 2026",
  "message": "Welcome to our NewsletterThank you for subscribing!",
  "from_email": "sender_name@company.com",
  "from_name": "Company Support",
  "Bcc": 
  {
    "0": "bcc_1@company.com",
    "1": "bcc_2@company.com",
    "2": "bcc_3@company.com"
  },
  "Attachments": 
  {
    "0": 
    {
      "filename": "document.pdf",
      "data": "base64_encoded_string_here"
    },
    "1": 
    {
      "filename": "image.png",
      "data": "base64_encoded_string_here"
    }
  }
};

axios.post(
    'https://apicentral.dev/Email/send',
    Data,
    {
        headers: {'Authorization': 'Bearer YOUR_API_TOKEN_HERE'}
    }
)
.then(Response =>
{
    const status = Response.data.status;
    const message = Response.data.message;
    const data = Response.data.data;
})
.catch(Error => { const error = Error.message; });

import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import java.time.Duration;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

public class ApiExample
{
    public static void main(String[] args)
    {
        String url = "https://apicentral.dev/Email/send";
        String JsonPayload = """
        
        {
          "to": "receiver_name@gmail.com",
          "subject": "Company Newsletter - August 2026",
          "message": "Welcome to our NewsletterThank you for subscribing!",
          "from_email": "sender_name@company.com",
          "from_name": "Company Support",
          "Bcc": 
          {
            "0": "bcc_1@company.com",
            "1": "bcc_2@company.com",
            "2": "bcc_3@company.com"
          },
          "Attachments": 
          {
            "0": 
            {
              "filename": "document.pdf",
              "data": "base64_encoded_string_here"
            },
            "1": 
            {
              "filename": "image.png",
              "data": "base64_encoded_string_here"
            }
          }
        }
        """;

        HttpClient Client = HttpClient.newBuilder()
            .connectTimeout(Duration.ofSeconds(30))
            .build();

        HttpRequest Request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("Authorization", "Bearer YOUR_API_TOKEN_HERE")
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(JsonPayload))
            .build();

        try
        {
            HttpResponse Response = Client.send(Request, HttpResponse.BodyHandlers.ofString());
            JsonObject ResData = JsonParser.parseString(Response.body()).getAsJsonObject();
            String status = ResData.get("status").getAsString();
            String message = ResData.get("message").getAsString();
            Object data = ResData.has("data") ? ResData.get("data") : null;
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
}

using System;
using System.Net.Http;
using System.Text;
using Newtonsoft.Json;

public class ApiExample
{
    public static async Task Main()
    {
        using var Client = new HttpClient();
        Client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_TOKEN_HERE");

        var json_payload = @"
        {
          "to": "receiver_name@gmail.com",
          "subject": "Company Newsletter - August 2026",
          "message": "Welcome to our NewsletterThank you for subscribing!",
          "from_email": "sender_name@company.com",
          "from_name": "Company Support",
          "Bcc": 
          {
            "0": "bcc_1@company.com",
            "1": "bcc_2@company.com",
            "2": "bcc_3@company.com"
          },
          "Attachments": 
          {
            "0": 
            {
              "filename": "document.pdf",
              "data": "base64_encoded_string_here"
            },
            "1": 
            {
              "filename": "image.png",
              "data": "base64_encoded_string_here"
            }
          }
        }";
        var content = new StringContent(json_payload, Encoding.UTF8, "application/json");

        var Response = await Client.PostAsync("https://apicentral.dev/Email/send", content);
        var Result = await Response.Content.ReadAsStringAsync();
        dynamic ResData = JsonConvert.DeserializeObject(Result);
        string status = ResData.status;
        string message = ResData.message;
        object data = ResData.data;
    }
}

package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
    "io"
)

func main() {
        JsonPayload := []byte(`
        {
          "to": "receiver_name@gmail.com",
          "subject": "Company Newsletter - August 2026",
          "message": "Welcome to our NewsletterThank you for subscribing!",
          "from_email": "sender_name@company.com",
          "from_name": "Company Support",
          "Bcc": 
          {
            "0": "bcc_1@company.com",
            "1": "bcc_2@company.com",
            "2": "bcc_3@company.com"
          },
          "Attachments": 
          {
            "0": 
            {
              "filename": "document.pdf",
              "data": "base64_encoded_string_here"
            },
            "1": 
            {
              "filename": "image.png",
              "data": "base64_encoded_string_here"
            }
          }
        }`)

        Client := &http.Client{}
        Request, _ := http.NewRequest("POST", "https://apicentral.dev/Email/send", bytes.NewBuffer(JsonPayload))
        Request.Header.Set("Authorization", "Bearer YOUR_API_TOKEN_HERE")
        Request.Header.Set("Content-Type", "application/json")

        Response, err := Client.Do(Request)

        if err != nil {
            fmt.Println("Error:", err)
            return
        }

        defer Response.Body.Close()

        Body, _ := io.ReadAll(Response.Body)

        var ResData map[string]interface{}
        json.Unmarshal(Body, &ResData)

        status := ResData["status"]
        message := ResData["message"]
        data := ResData["data"]

        fmt.Println(status, message, data)
}

require 'net/http'
require 'uri'
require 'json'

uri = URI('https://apicentral.dev/Email/send')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer YOUR_API_TOKEN_HERE'
request['Content-Type'] = 'application/json'
request.body = 
{
  "to": "receiver_name@gmail.com",
  "subject": "Company Newsletter - August 2026",
  "message": "Welcome to our NewsletterThank you for subscribing!",
  "from_email": "sender_name@company.com",
  "from_name": "Company Support",
  "Bcc": 
  {
    "0": "bcc_1@company.com",
    "1": "bcc_2@company.com",
    "2": "bcc_3@company.com"
  },
  "Attachments": 
  {
    "0": 
    {
      "filename": "document.pdf",
      "data": "base64_encoded_string_here"
    },
    "1": 
    {
      "filename": "image.png",
      "data": "base64_encoded_string_here"
    }
  }
}.to_json

response = http.request(request)
res_data = JSON.parse(response.body)

status = res_data['status']
message = res_data['message']
data = res_data['data']

import Foundation

let url = URL(string: "https://apicentral.dev/Email/send")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer YOUR_API_TOKEN_HERE", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")

let JsonPayload = """

    {
      "to": "receiver_name@gmail.com",
      "subject": "Company Newsletter - August 2026",
      "message": "Welcome to our NewsletterThank you for subscribing!",
      "from_email": "sender_name@company.com",
      "from_name": "Company Support",
      "Bcc": 
      {
        "0": "bcc_1@company.com",
        "1": "bcc_2@company.com",
        "2": "bcc_3@company.com"
      },
      "Attachments": 
      {
        "0": 
        {
          "filename": "document.pdf",
          "data": "base64_encoded_string_here"
        },
        "1": 
        {
          "filename": "image.png",
          "data": "base64_encoded_string_here"
        }
      }
    }
""".data(using: .utf8)!
request.httpBody = JsonPayload

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    if let error = error {
        print("Error: \(error)")
        return
    }

    guard let data = data else { return }

    if let resData = try? JSONSerialization.jsonObject(with: data) as? [String: Any] {
        let status = resData["status"] as? String
        let message = resData["message"] as? String
        let data = resData["data"]
    }
}

task.resume()

import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.net.URI
import java.time.Duration
import com.google.gson.JsonParser

fun main() {
        val url = "https://apicentral.dev/Email/send"
        val jsonPayload = """
        
        {
          "to": "receiver_name@gmail.com",
          "subject": "Company Newsletter - August 2026",
          "message": "Welcome to our NewsletterThank you for subscribing!",
          "from_email": "sender_name@company.com",
          "from_name": "Company Support",
          "Bcc": 
          {
            "0": "bcc_1@company.com",
            "1": "bcc_2@company.com",
            "2": "bcc_3@company.com"
          },
          "Attachments": 
          {
            "0": 
            {
              "filename": "document.pdf",
              "data": "base64_encoded_string_here"
            },
            "1": 
            {
              "filename": "image.png",
              "data": "base64_encoded_string_here"
            }
          }
        }
        """.trimIndent()

        val client = HttpClient.newBuilder()
            .connectTimeout(Duration.ofSeconds(30))
            .build()

        val request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("Authorization", "Bearer YOUR_API_TOKEN_HERE")
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
            .build()

        try {
            val response = client.send(request, HttpResponse.BodyHandlers.ofString())
            val resData = JsonParser.parseString(response.body()).asJsonObject
            val status = resData.get("status").asString
            val message = resData.get("message").asString
            val data = if (resData.has("data")) resData.get("data") else null
        } catch (e: Exception) {
            e.printStackTrace()
        }
}

import 'dart:convert';
import 'package:http/http.dart' as http;

void main() async {
    final url = Uri.parse('https://apicentral.dev/Email/send');
    final headers = {
        'Authorization': 'Bearer YOUR_API_TOKEN_HERE',
        'Content-Type': 'application/json'
    };

    final body = jsonEncode(
    {
      "to": "receiver_name@gmail.com",
      "subject": "Company Newsletter - August 2026",
      "message": "Welcome to our NewsletterThank you for subscribing!",
      "from_email": "sender_name@company.com",
      "from_name": "Company Support",
      "Bcc": 
      {
        "0": "bcc_1@company.com",
        "1": "bcc_2@company.com",
        "2": "bcc_3@company.com"
      },
      "Attachments": 
      {
        "0": 
        {
          "filename": "document.pdf",
          "data": "base64_encoded_string_here"
        },
        "1": 
        {
          "filename": "image.png",
          "data": "base64_encoded_string_here"
        }
      }
    });

    try {
        final response = await http.post(url, headers: headers, body: body);
        final resData = jsonDecode(response.body);
        final status = resData['status'];
        final message = resData['message'];
        final data = resData['data'];
    } catch (e) {
        print('Error: $e');
    }
}

use reqwest::blocking::Client;
use serde_json::Value;

fn main() -> Result<(), Box> {
        let client = Client::new();

        let json_payload = r#"
        
        {
          "to": "receiver_name@gmail.com",
          "subject": "Company Newsletter - August 2026",
          "message": "Welcome to our NewsletterThank you for subscribing!",
          "from_email": "sender_name@company.com",
          "from_name": "Company Support",
          "Bcc": 
          {
            "0": "bcc_1@company.com",
            "1": "bcc_2@company.com",
            "2": "bcc_3@company.com"
          },
          "Attachments": 
          {
            "0": 
            {
              "filename": "document.pdf",
              "data": "base64_encoded_string_here"
            },
            "1": 
            {
              "filename": "image.png",
              "data": "base64_encoded_string_here"
            }
          }
        }
        "#;

        let response = client
            .post("https://apicentral.dev/Email/send")
            .header("Authorization", "Bearer YOUR_API_TOKEN_HERE")
            .header("Content-Type", "application/json")
            .body(json_payload.to_string())
            .send()?;

        let res_data: Value = serde_json::from_str(&response.text()?)?;
        let status = &res_data["status"];
        let message = &res_data["message"];
        let data = &res_data["data"];

        println!("{} {} {:?}", status, message, data);

        Ok(())
}

curl -X POST 'https://apicentral.dev/Email/send' \
    -H 'Authorization: Bearer YOUR_API_TOKEN_HERE' \
    -H 'Content-Type: application/json' \
    -d '
    {
      "to": "receiver_name@gmail.com",
      "subject": "Company Newsletter - August 2026",
      "message": "Welcome to our NewsletterThank you for subscribing!",
      "from_email": "sender_name@company.com",
      "from_name": "Company Support",
      "Bcc": 
      {
        "0": "bcc_1@company.com",
        "1": "bcc_2@company.com",
        "2": "bcc_3@company.com"
      },
      "Attachments": 
      {
        "0": 
        {
          "filename": "document.pdf",
          "data": "base64_encoded_string_here"
        },
        "1": 
        {
          "filename": "image.png",
          "data": "base64_encoded_string_here"
        }
      }
    }'

validate

Validate an email address format and check DNS MX records
Credits Required: 0.5

PARAMETERS

NAME TYPE REQUIRED DESCRIPTION ADDITIONAL CREDITS PER ITEM EXAMPLE
email string Yes Email address to validate (max 255 chars) None
user@example.com
check_dns boolean No Check DNS MX records for the email domain (increases validation accuracy but costs 0.5 more credits) 0.5
1

RESPONSE EXAMPLE

{
    "status": "success",
    "message": "Email validation completed successfully",
    "data":
    {
        "email": "user@example.com",
        "format_valid": true,
        "dns_valid": true,
        "overall_status": "valid"
    }
}

CODE EXAMPLES

<?php

$Curl = curl_init();

$PostFields = 
[
  'email' => 'user@example.com',
  'check_dns' => true,
];

curl_setopt_array(
    $Curl,
    [
        CURLOPT_URL => 'https://apicentral.dev/Email/validate',
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => http_build_query($PostFields),
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTPHEADER => 
        [
            'Authorization: Bearer YOUR_API_TOKEN_HERE',
            'Content-Type: application/x-www-form-urlencoded'
        ]
    ]
);

$Response = curl_exec($Curl);
$Data = json_decode($Response, true);

if (curl_errno($Curl))
    $Error = curl_error($Curl);
else
{
    $status = $Data['status'];
    $message = $Data['message'];
    $data = $Data['data'] ?? null;
}

curl_close($Curl); // Omit in PHP 8 and above
?>

import requests
import json

url = 'https://apicentral.dev/Email/validate'
Headers = {'Authorization': 'Bearer YOUR_API_TOKEN_HERE'}
Data = 
{
  "email": "user@example.com",
  "check_dns": true
}

try:
    Response = requests.post(url, json=Data, headers=Headers)
    ResData = Response.json()
    status = ResData.get('status')
    message = ResData.get('message')
    data = ResData.get('data')
except Exception as e:
    error = str(e)

const axios = require('axios');

const Data = 
{
  "email": "user@example.com",
  "check_dns": true
};

axios.post(
    'https://apicentral.dev/Email/validate',
    Data,
    {
        headers: {'Authorization': 'Bearer YOUR_API_TOKEN_HERE'}
    }
)
.then(Response =>
{
    const status = Response.data.status;
    const message = Response.data.message;
    const data = Response.data.data;
})
.catch(Error => { const error = Error.message; });

import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import java.time.Duration;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

public class ApiExample
{
    public static void main(String[] args)
    {
        String url = "https://apicentral.dev/Email/validate";
        String JsonPayload = """
        
        {
          "email": "user@example.com",
          "check_dns": true
        }
        """;

        HttpClient Client = HttpClient.newBuilder()
            .connectTimeout(Duration.ofSeconds(30))
            .build();

        HttpRequest Request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("Authorization", "Bearer YOUR_API_TOKEN_HERE")
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(JsonPayload))
            .build();

        try
        {
            HttpResponse Response = Client.send(Request, HttpResponse.BodyHandlers.ofString());
            JsonObject ResData = JsonParser.parseString(Response.body()).getAsJsonObject();
            String status = ResData.get("status").getAsString();
            String message = ResData.get("message").getAsString();
            Object data = ResData.has("data") ? ResData.get("data") : null;
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
}

using System;
using System.Net.Http;
using System.Text;
using Newtonsoft.Json;

public class ApiExample
{
    public static async Task Main()
    {
        using var Client = new HttpClient();
        Client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_TOKEN_HERE");

        var json_payload = @"
        {
          "email": "user@example.com",
          "check_dns": true
        }";
        var content = new StringContent(json_payload, Encoding.UTF8, "application/json");

        var Response = await Client.PostAsync("https://apicentral.dev/Email/validate", content);
        var Result = await Response.Content.ReadAsStringAsync();
        dynamic ResData = JsonConvert.DeserializeObject(Result);
        string status = ResData.status;
        string message = ResData.message;
        object data = ResData.data;
    }
}

package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
    "io"
)

func main() {
        JsonPayload := []byte(`
        {
          "email": "user@example.com",
          "check_dns": true
        }`)

        Client := &http.Client{}
        Request, _ := http.NewRequest("POST", "https://apicentral.dev/Email/validate", bytes.NewBuffer(JsonPayload))
        Request.Header.Set("Authorization", "Bearer YOUR_API_TOKEN_HERE")
        Request.Header.Set("Content-Type", "application/json")

        Response, err := Client.Do(Request)

        if err != nil {
            fmt.Println("Error:", err)
            return
        }

        defer Response.Body.Close()

        Body, _ := io.ReadAll(Response.Body)

        var ResData map[string]interface{}
        json.Unmarshal(Body, &ResData)

        status := ResData["status"]
        message := ResData["message"]
        data := ResData["data"]

        fmt.Println(status, message, data)
}

require 'net/http'
require 'uri'
require 'json'

uri = URI('https://apicentral.dev/Email/validate')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer YOUR_API_TOKEN_HERE'
request['Content-Type'] = 'application/json'
request.body = 
{
  "email": "user@example.com",
  "check_dns": true
}.to_json

response = http.request(request)
res_data = JSON.parse(response.body)

status = res_data['status']
message = res_data['message']
data = res_data['data']

import Foundation

let url = URL(string: "https://apicentral.dev/Email/validate")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer YOUR_API_TOKEN_HERE", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")

let JsonPayload = """

    {
      "email": "user@example.com",
      "check_dns": true
    }
""".data(using: .utf8)!
request.httpBody = JsonPayload

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    if let error = error {
        print("Error: \(error)")
        return
    }

    guard let data = data else { return }

    if let resData = try? JSONSerialization.jsonObject(with: data) as? [String: Any] {
        let status = resData["status"] as? String
        let message = resData["message"] as? String
        let data = resData["data"]
    }
}

task.resume()

import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.net.URI
import java.time.Duration
import com.google.gson.JsonParser

fun main() {
        val url = "https://apicentral.dev/Email/validate"
        val jsonPayload = """
        
        {
          "email": "user@example.com",
          "check_dns": true
        }
        """.trimIndent()

        val client = HttpClient.newBuilder()
            .connectTimeout(Duration.ofSeconds(30))
            .build()

        val request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("Authorization", "Bearer YOUR_API_TOKEN_HERE")
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
            .build()

        try {
            val response = client.send(request, HttpResponse.BodyHandlers.ofString())
            val resData = JsonParser.parseString(response.body()).asJsonObject
            val status = resData.get("status").asString
            val message = resData.get("message").asString
            val data = if (resData.has("data")) resData.get("data") else null
        } catch (e: Exception) {
            e.printStackTrace()
        }
}

import 'dart:convert';
import 'package:http/http.dart' as http;

void main() async {
    final url = Uri.parse('https://apicentral.dev/Email/validate');
    final headers = {
        'Authorization': 'Bearer YOUR_API_TOKEN_HERE',
        'Content-Type': 'application/json'
    };

    final body = jsonEncode(
    {
      "email": "user@example.com",
      "check_dns": true
    });

    try {
        final response = await http.post(url, headers: headers, body: body);
        final resData = jsonDecode(response.body);
        final status = resData['status'];
        final message = resData['message'];
        final data = resData['data'];
    } catch (e) {
        print('Error: $e');
    }
}

use reqwest::blocking::Client;
use serde_json::Value;

fn main() -> Result<(), Box> {
        let client = Client::new();

        let json_payload = r#"
        
        {
          "email": "user@example.com",
          "check_dns": true
        }
        "#;

        let response = client
            .post("https://apicentral.dev/Email/validate")
            .header("Authorization", "Bearer YOUR_API_TOKEN_HERE")
            .header("Content-Type", "application/json")
            .body(json_payload.to_string())
            .send()?;

        let res_data: Value = serde_json::from_str(&response.text()?)?;
        let status = &res_data["status"];
        let message = &res_data["message"];
        let data = &res_data["data"];

        println!("{} {} {:?}", status, message, data);

        Ok(())
}

curl -X POST 'https://apicentral.dev/Email/validate' \
    -H 'Authorization: Bearer YOUR_API_TOKEN_HERE' \
    -H 'Content-Type: application/json' \
    -d '
    {
      "email": "user@example.com",
      "check_dns": true
    }'