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

// ================================================================
// Generic function - copy once, reuse for all APIs
// ================================================================
function processAPIRequest($endpoint, $PostFields)
{
    $token = 'YOUR_API_TOKEN_HERE'; // Configure your token here
    $base_url = 'https://apicentral.dev';

    $Curl = curl_init();

    curl_setopt_array(
        $Curl,
        [
            CURLOPT_URL => $base_url . '/' . $endpoint,
            CURLOPT_POST => true,
            CURLOPT_POSTFIELDS => http_build_query($PostFields),
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_HTTPHEADER =>
            [
                'Authorization: Bearer ' . $token,
                'Content-Type: application/x-www-form-urlencoded'
            ]
        ]
    );

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

    if (curl_errno($Curl))
        return ['error' => curl_error($Curl)];

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

    return $Data;
}

// ================================================================
// API-specific usage
// ================================================================
$endpoint = 'Email/send';
$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',
    ],
  ],
];

$Data = processAPIRequest($endpoint, $PostFields);

$status = $Data['status'];
$message = $Data['message'];
$data = $Data['data'] ?? null;
?>

import requests
import json

# ================================================================
# Generic function - copy once, reuse for all APIs
# ================================================================
def process_api_request(endpoint, Data):
    token = 'YOUR_API_TOKEN_HERE'  # Configure your token here
    base_url = 'https://apicentral.dev'
    Headers = {'Authorization': 'Bearer ' + token}

    try:
        Response = requests.post(base_url + '/' + endpoint, json=Data, headers=Headers)
        return Response.json()
    except Exception as e:
        return {'error': str(e)}

# ================================================================
# API-specific usage
# ================================================================
endpoint = 'Email/send'
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"
    }
  }
}

ResData = process_api_request(endpoint, Data)

status = ResData.get('status')
message = ResData.get('message')
data = ResData.get('data')

const axios = require('axios');

// ================================================================
// Generic function - copy once, reuse for all APIs
// ================================================================
function processAPIRequest(endpoint, Data)
{
    const token = 'YOUR_API_TOKEN_HERE'; // Configure your token here
    const base_url = 'https://apicentral.dev';

    return axios.post(
        base_url + '/' + endpoint,
        Data,
        {
            headers: {'Authorization': 'Bearer ' + token}
        }
    );
}

// ================================================================
// API-specific usage
// ================================================================
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"
    }
  }
};

processAPIRequest('Email/send', Data)
.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
{
    // ================================================================
    // Generic method - copy once, reuse for all APIs
    // ================================================================
    public static JsonObject processAPIRequest(String endpoint, String jsonPayload) throws Exception
    {
        String token = "YOUR_API_TOKEN_HERE"; // Configure your token here
        String base_url = "https://apicentral.dev";

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

        HttpRequest Request = HttpRequest.newBuilder()
            .uri(URI.create(base_url + "/" + endpoint))
            .header("Authorization", "Bearer " + token)
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
            .build();

        HttpResponse<String> Response = Client.send(Request, HttpResponse.BodyHandlers.ofString());

        return JsonParser.parseString(Response.body()).getAsJsonObject();
    }

    // ================================================================
    // API-specific usage
    // ================================================================
    public static void main(String[] args)
    {
        String endpoint = "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"
            }
          }
        }
        """;

        try
        {
            JsonObject ResData = processAPIRequest(endpoint, JsonPayload);
            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 System.Threading.Tasks;
using Newtonsoft.Json;

public class ApiExample
{
    // ================================================================
    // Generic method - copy once, reuse for all APIs
    // ================================================================
    public static async Task<dynamic> ProcessAPIRequest(string endpoint, string jsonPayload)
    {
        string token = "YOUR_API_TOKEN_HERE"; // Configure your token here
        string base_url = "https://apicentral.dev";

        using var Client = new HttpClient();
        Client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token);

        var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");

        var Response = await Client.PostAsync(base_url + "/" + endpoint, content);
        var Result = await Response.Content.ReadAsStringAsync();

        return JsonConvert.DeserializeObject(Result);
    }

    // ================================================================
    // API-specific usage
    // ================================================================
    public static async Task Main()
    {
        var endpoint = "Email/send";
        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"
            }
          }
        }";

        dynamic ResData = await ProcessAPIRequest(endpoint, json_payload);

        string status = ResData.status;
        string message = ResData.message;
        object data = ResData.data;
    }
}

package main

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

// ================================================================
// Generic function - copy once, reuse for all APIs
// ================================================================
func processAPIRequest(endpoint string, jsonPayload []byte) (map[string]interface{}, error) {
    token := "YOUR_API_TOKEN_HERE" // Configure your token here
    base_url := "https://apicentral.dev"

    Client := &http.Client{}
    Request, err := http.NewRequest("POST", base_url+"/"+endpoint, bytes.NewBuffer(jsonPayload))

    if err != nil {
        return nil, err
    }

    Request.Header.Set("Authorization", "Bearer " + token)
    Request.Header.Set("Content-Type", "application/json")

    Response, err := Client.Do(Request)

    if err != nil {
        return nil, err
    }

    defer Response.Body.Close()

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

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

    return ResData, nil
}

// ================================================================
// API-specific usage
// ================================================================
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"
        }
      }
    }`)

    ResData, err := processAPIRequest("Email/send", JsonPayload)

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

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

    fmt.Println(status, message, data)
}

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

# ================================================================
# Generic function - copy once, reuse for all APIs
# ================================================================
def process_api_request(endpoint, data)
    token = 'YOUR_API_TOKEN_HERE'  # Configure your token here
    base_url = 'https://apicentral.dev'

    uri = URI(base_url + '/' + endpoint)
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true

    request = Net::HTTP::Post.new(uri)
    request['Authorization'] = 'Bearer ' + token
    request['Content-Type'] = 'application/json'
    request.body = data.to_json

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

# ================================================================
# API-specific usage
# ================================================================
endpoint = 'Email/send'
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"
    }
  }
}

res_data = process_api_request(endpoint, data)

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

import Foundation

// ================================================================
// Generic function - copy once, reuse for all APIs
// ================================================================
func processAPIRequest(endpoint: String, jsonPayload: Data, completion: @escaping ([String: Any]?) -> Void)
{
    let token = "YOUR_API_TOKEN_HERE" // Configure your token here
    let base_url = "https://apicentral.dev"

    let requestUrl = URL(string: base_url + "/" + endpoint)!
    var request = URLRequest(url: requestUrl)
    request.httpMethod = "POST"
    request.setValue("Bearer " + token, forHTTPHeaderField: "Authorization")
    request.setValue("application/json", forHTTPHeaderField: "Content-Type")
    request.httpBody = jsonPayload

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

        guard let data = data else {
            completion(nil)
            return
        }

        let resData = try? JSONSerialization.jsonObject(with: data) as? [String: Any]
        completion(resData)
    }

    task.resume()
}

// ================================================================
// API-specific usage
// ================================================================
let endpoint = "Email/send"
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)!

processAPIRequest(endpoint: endpoint, jsonPayload: JsonPayload) { resData in
    let status = resData?["status"] as? String
    let message = resData?["message"] as? String
    let data = resData?["data"]
}

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

// ================================================================
// Generic function - copy once, reuse for all APIs
// ================================================================
fun processAPIRequest(endpoint: String, jsonPayload: String): JsonObject
{
    val token = "YOUR_API_TOKEN_HERE" // Configure your token here
    val base_url = "https://apicentral.dev"

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

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

    val response = client.send(request, HttpResponse.BodyHandlers.ofString())

    return JsonParser.parseString(response.body()).asJsonObject
}

// ================================================================
// API-specific usage
// ================================================================
fun main() {
    val endpoint = "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()

    try {
        val resData = processAPIRequest(endpoint, jsonPayload)
        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;

// ================================================================
// Generic function - copy once, reuse for all APIs
// ================================================================
Future<Map<String, dynamic>> processAPIRequest(String endpoint, Map<String, dynamic> data) async
{
    final token = 'YOUR_API_TOKEN_HERE'; // Configure your token here
    final base_url = 'https://apicentral.dev';
    final headers = {
        'Authorization': 'Bearer ' + token,
        'Content-Type': 'application/json'
    };

    final response = await http.post(Uri.parse(base_url + '/' + endpoint), headers: headers, body: jsonEncode(data));

    return jsonDecode(response.body);
}

// ================================================================
// API-specific usage
// ================================================================
void main() async {
    final endpoint = 'Email/send';
    final 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 {
        final resData = await processAPIRequest(endpoint, data);
        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;

// ================================================================
// Generic function - copy once, reuse for all APIs
// ================================================================
fn process_api_request(endpoint: &str, json_payload: &str) -> Result<Value, Box<dyn std::error::Error>>
{
    let token = "YOUR_API_TOKEN_HERE"; // Configure your token here
    let base_url = "https://apicentral.dev";

    let client = Client::new();

    let response = client
        .post(format!("{}/{}", base_url, endpoint))
        .header("Authorization", format!("Bearer {}", token))
        .header("Content-Type", "application/json")
        .body(json_payload.to_string())
        .send()?;

    let res_data: Value = serde_json::from_str(&response.text()?)?;

    Ok(res_data)
}

// ================================================================
// API-specific usage
// ================================================================
fn main() -> Result<(), Box<dyn std::error::Error>> {
    let endpoint = "Email/send";
    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 res_data = process_api_request(endpoint, json_payload)?;

    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

// ================================================================
// Generic function - copy once, reuse for all APIs
// ================================================================
function processAPIRequest($endpoint, $PostFields)
{
    $token = 'YOUR_API_TOKEN_HERE'; // Configure your token here
    $base_url = 'https://apicentral.dev';

    $Curl = curl_init();

    curl_setopt_array(
        $Curl,
        [
            CURLOPT_URL => $base_url . '/' . $endpoint,
            CURLOPT_POST => true,
            CURLOPT_POSTFIELDS => http_build_query($PostFields),
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_HTTPHEADER =>
            [
                'Authorization: Bearer ' . $token,
                'Content-Type: application/x-www-form-urlencoded'
            ]
        ]
    );

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

    if (curl_errno($Curl))
        return ['error' => curl_error($Curl)];

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

    return $Data;
}

// ================================================================
// API-specific usage
// ================================================================
$endpoint = 'Email/validate';
$PostFields = 
[
  'email' => 'user@example.com',
  'check_dns' => true,
];

$Data = processAPIRequest($endpoint, $PostFields);

$status = $Data['status'];
$message = $Data['message'];
$data = $Data['data'] ?? null;
?>

import requests
import json

# ================================================================
# Generic function - copy once, reuse for all APIs
# ================================================================
def process_api_request(endpoint, Data):
    token = 'YOUR_API_TOKEN_HERE'  # Configure your token here
    base_url = 'https://apicentral.dev'
    Headers = {'Authorization': 'Bearer ' + token}

    try:
        Response = requests.post(base_url + '/' + endpoint, json=Data, headers=Headers)
        return Response.json()
    except Exception as e:
        return {'error': str(e)}

# ================================================================
# API-specific usage
# ================================================================
endpoint = 'Email/validate'
Data = 
{
  "email": "user@example.com",
  "check_dns": true
}

ResData = process_api_request(endpoint, Data)

status = ResData.get('status')
message = ResData.get('message')
data = ResData.get('data')

const axios = require('axios');

// ================================================================
// Generic function - copy once, reuse for all APIs
// ================================================================
function processAPIRequest(endpoint, Data)
{
    const token = 'YOUR_API_TOKEN_HERE'; // Configure your token here
    const base_url = 'https://apicentral.dev';

    return axios.post(
        base_url + '/' + endpoint,
        Data,
        {
            headers: {'Authorization': 'Bearer ' + token}
        }
    );
}

// ================================================================
// API-specific usage
// ================================================================
const Data = 
{
  "email": "user@example.com",
  "check_dns": true
};

processAPIRequest('Email/validate', Data)
.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
{
    // ================================================================
    // Generic method - copy once, reuse for all APIs
    // ================================================================
    public static JsonObject processAPIRequest(String endpoint, String jsonPayload) throws Exception
    {
        String token = "YOUR_API_TOKEN_HERE"; // Configure your token here
        String base_url = "https://apicentral.dev";

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

        HttpRequest Request = HttpRequest.newBuilder()
            .uri(URI.create(base_url + "/" + endpoint))
            .header("Authorization", "Bearer " + token)
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
            .build();

        HttpResponse<String> Response = Client.send(Request, HttpResponse.BodyHandlers.ofString());

        return JsonParser.parseString(Response.body()).getAsJsonObject();
    }

    // ================================================================
    // API-specific usage
    // ================================================================
    public static void main(String[] args)
    {
        String endpoint = "Email/validate";
        String JsonPayload = """
        
        {
          "email": "user@example.com",
          "check_dns": true
        }
        """;

        try
        {
            JsonObject ResData = processAPIRequest(endpoint, JsonPayload);
            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 System.Threading.Tasks;
using Newtonsoft.Json;

public class ApiExample
{
    // ================================================================
    // Generic method - copy once, reuse for all APIs
    // ================================================================
    public static async Task<dynamic> ProcessAPIRequest(string endpoint, string jsonPayload)
    {
        string token = "YOUR_API_TOKEN_HERE"; // Configure your token here
        string base_url = "https://apicentral.dev";

        using var Client = new HttpClient();
        Client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token);

        var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");

        var Response = await Client.PostAsync(base_url + "/" + endpoint, content);
        var Result = await Response.Content.ReadAsStringAsync();

        return JsonConvert.DeserializeObject(Result);
    }

    // ================================================================
    // API-specific usage
    // ================================================================
    public static async Task Main()
    {
        var endpoint = "Email/validate";
        var json_payload = @"
        {
          "email": "user@example.com",
          "check_dns": true
        }";

        dynamic ResData = await ProcessAPIRequest(endpoint, json_payload);

        string status = ResData.status;
        string message = ResData.message;
        object data = ResData.data;
    }
}

package main

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

// ================================================================
// Generic function - copy once, reuse for all APIs
// ================================================================
func processAPIRequest(endpoint string, jsonPayload []byte) (map[string]interface{}, error) {
    token := "YOUR_API_TOKEN_HERE" // Configure your token here
    base_url := "https://apicentral.dev"

    Client := &http.Client{}
    Request, err := http.NewRequest("POST", base_url+"/"+endpoint, bytes.NewBuffer(jsonPayload))

    if err != nil {
        return nil, err
    }

    Request.Header.Set("Authorization", "Bearer " + token)
    Request.Header.Set("Content-Type", "application/json")

    Response, err := Client.Do(Request)

    if err != nil {
        return nil, err
    }

    defer Response.Body.Close()

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

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

    return ResData, nil
}

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

    ResData, err := processAPIRequest("Email/validate", JsonPayload)

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

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

    fmt.Println(status, message, data)
}

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

# ================================================================
# Generic function - copy once, reuse for all APIs
# ================================================================
def process_api_request(endpoint, data)
    token = 'YOUR_API_TOKEN_HERE'  # Configure your token here
    base_url = 'https://apicentral.dev'

    uri = URI(base_url + '/' + endpoint)
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true

    request = Net::HTTP::Post.new(uri)
    request['Authorization'] = 'Bearer ' + token
    request['Content-Type'] = 'application/json'
    request.body = data.to_json

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

# ================================================================
# API-specific usage
# ================================================================
endpoint = 'Email/validate'
data = 
{
  "email": "user@example.com",
  "check_dns": true
}

res_data = process_api_request(endpoint, data)

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

import Foundation

// ================================================================
// Generic function - copy once, reuse for all APIs
// ================================================================
func processAPIRequest(endpoint: String, jsonPayload: Data, completion: @escaping ([String: Any]?) -> Void)
{
    let token = "YOUR_API_TOKEN_HERE" // Configure your token here
    let base_url = "https://apicentral.dev"

    let requestUrl = URL(string: base_url + "/" + endpoint)!
    var request = URLRequest(url: requestUrl)
    request.httpMethod = "POST"
    request.setValue("Bearer " + token, forHTTPHeaderField: "Authorization")
    request.setValue("application/json", forHTTPHeaderField: "Content-Type")
    request.httpBody = jsonPayload

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

        guard let data = data else {
            completion(nil)
            return
        }

        let resData = try? JSONSerialization.jsonObject(with: data) as? [String: Any]
        completion(resData)
    }

    task.resume()
}

// ================================================================
// API-specific usage
// ================================================================
let endpoint = "Email/validate"
let JsonPayload = """

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

processAPIRequest(endpoint: endpoint, jsonPayload: JsonPayload) { resData in
    let status = resData?["status"] as? String
    let message = resData?["message"] as? String
    let data = resData?["data"]
}

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

// ================================================================
// Generic function - copy once, reuse for all APIs
// ================================================================
fun processAPIRequest(endpoint: String, jsonPayload: String): JsonObject
{
    val token = "YOUR_API_TOKEN_HERE" // Configure your token here
    val base_url = "https://apicentral.dev"

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

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

    val response = client.send(request, HttpResponse.BodyHandlers.ofString())

    return JsonParser.parseString(response.body()).asJsonObject
}

// ================================================================
// API-specific usage
// ================================================================
fun main() {
    val endpoint = "Email/validate"
    val jsonPayload = """
    
    {
      "email": "user@example.com",
      "check_dns": true
    }
    """.trimIndent()

    try {
        val resData = processAPIRequest(endpoint, jsonPayload)
        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;

// ================================================================
// Generic function - copy once, reuse for all APIs
// ================================================================
Future<Map<String, dynamic>> processAPIRequest(String endpoint, Map<String, dynamic> data) async
{
    final token = 'YOUR_API_TOKEN_HERE'; // Configure your token here
    final base_url = 'https://apicentral.dev';
    final headers = {
        'Authorization': 'Bearer ' + token,
        'Content-Type': 'application/json'
    };

    final response = await http.post(Uri.parse(base_url + '/' + endpoint), headers: headers, body: jsonEncode(data));

    return jsonDecode(response.body);
}

// ================================================================
// API-specific usage
// ================================================================
void main() async {
    final endpoint = 'Email/validate';
    final data = 
    {
      "email": "user@example.com",
      "check_dns": true
    };

    try {
        final resData = await processAPIRequest(endpoint, data);
        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;

// ================================================================
// Generic function - copy once, reuse for all APIs
// ================================================================
fn process_api_request(endpoint: &str, json_payload: &str) -> Result<Value, Box<dyn std::error::Error>>
{
    let token = "YOUR_API_TOKEN_HERE"; // Configure your token here
    let base_url = "https://apicentral.dev";

    let client = Client::new();

    let response = client
        .post(format!("{}/{}", base_url, endpoint))
        .header("Authorization", format!("Bearer {}", token))
        .header("Content-Type", "application/json")
        .body(json_payload.to_string())
        .send()?;

    let res_data: Value = serde_json::from_str(&response.text()?)?;

    Ok(res_data)
}

// ================================================================
// API-specific usage
// ================================================================
fn main() -> Result<(), Box<dyn std::error::Error>> {
    let endpoint = "Email/validate";
    let json_payload = r#"
    
    {
      "email": "user@example.com",
      "check_dns": true
    }
    "#;

    let res_data = process_api_request(endpoint, json_payload)?;

    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
    }'