Warning: Passing your API key as a query parameter exposes it in server logs, browser history, and referrer headers. Only use this method in server-to-server or controlled environments.
https://simplewebapis.com/api/dnslookup/lookup?domain=example.com&api_key=swa_your_key
curl -X POST https://simplewebapis.com/api/dnslookup \
-H "Content-Type: application/json" \
-H "X-Api-Key: swa_your_key" \
-d '{"domain": "example.com"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-Api-Key", "swa_your_key");
var payload = new { domain = "example.com" };
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(
"https://simplewebapis.com/api/dnslookup", content);
var result = await response.Content
.ReadFromJsonAsync<DnsLookupResponse>();
Console.WriteLine(result?.Data?.ARecords.FirstOrDefault());
// -- Response model --
record DnsLookupResponse(
bool Success,
string? Message,
DnsLookupData? Data);
record DnsLookupData(
string Domain,
List<string> ARecords,
List<string> AaaaRecords,
List<MxRecord> MxRecords,
List<string> NsRecords,
List<string> TxtRecords,
List<string> CnameRecords,
SoaRecord? SoaRecord,
List<SrvRecord> SrvRecords,
List<CaaRecord> CaaRecords,
int QueryTimeMs);
record MxRecord(string Host, ushort Preference);
record SoaRecord(
string PrimaryNameServer,
string ResponsiblePerson,
uint Serial,
int Refresh,
int Retry,
int Expire,
int MinimumTimeToLive);
record SrvRecord(
string Host,
ushort Port,
ushort Priority,
ushort Weight);
record CaaRecord(byte Flags, string Tag, string Value);
$ch = curl_init('https://simplewebapis.com/api/dnslookup');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-Api-Key: swa_your_key',
],
CURLOPT_POSTFIELDS => json_encode([
'domain' => 'example.com',
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
echo $data['data']['aRecords'][0];
const response = await fetch('https://simplewebapis.com/api/dnslookup', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Key': 'swa_your_key',
},
body: JSON.stringify({
domain: 'example.com',
}),
});
const result = await response.json();
console.log(result.data.aRecords);
import requests
response = requests.post(
'https://simplewebapis.com/api/dnslookup',
headers={
'Content-Type': 'application/json',
'X-Api-Key': 'swa_your_key',
},
json={'domain': 'example.com'},
)
data = response.json()
print(data['data']['aRecords'])
body, _ := json.Marshal(map[string]string{
"domain": "example.com",
})
req, _ := http.NewRequest("POST",
"https://simplewebapis.com/api/dnslookup",
bytes.NewReader(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Api-Key", "swa_your_key")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
var result map[string]any
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result["data"])
require 'net/http'
require 'json'
uri = URI('https://simplewebapis.com/api/dnslookup')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['X-Api-Key'] = 'swa_your_key'
request.body = { domain: 'example.com' }.to_json
response = http.request(request)
data = JSON.parse(response.body)
puts data['data']['aRecords']
var client = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.uri(URI.create("https://simplewebapis.com/api/dnslookup"))
.header("Content-Type", "application/json")
.header("X-Api-Key", "swa_your_key")
.POST(HttpRequest.BodyPublishers.ofString(
"{\"domain\":\"example.com\"}"))
.build();
var response = client.send(request,
HttpResponse.BodyHandlers.ofString());
var mapper = new ObjectMapper();
var result = mapper.readTree(response.body());
System.out.println(result.get("data").get("aRecords"));
let client = reqwest::blocking::Client::new();
let response = client
.post("https://simplewebapis.com/api/dnslookup")
.header("Content-Type", "application/json")
.header("X-Api-Key", "swa_your_key")
.json(&serde_json::json!({
"domain": "example.com",
}))
.send()?;
let result: serde_json::Value = response.json()?;
println!("{}", result["data"]["aRecords"]);