Tools Ninja API

Access 20+ developer tools programmatically. Simple REST API with JSON responses.

Base URL: https://tools-ninja.com/api/v1/

Authentication

All API requests require authentication using an API key. You can get your API key from the dashboard after registering.

Header Authentication (Recommended)

Pass your API key in the X-API-Key header:

curl -H "X-API-Key: tn_your_api_key_here" \
     https://tools-ninja.com/api/v1/dns?domain=example.com

Bearer Token

Use the Authorization header with Bearer scheme:

curl -H "Authorization: Bearer tn_your_api_key_here" \
     https://tools-ninja.com/api/v1/dns?domain=example.com

Query Parameter

Pass API key as query parameter (not recommended for production):

https://tools-ninja.com/api/v1/dns?domain=example.com&api_key=tn_your_api_key_here

Rate Limits

Monthly request limits vary by plan:

Free

100
requests/month

Starter

5,000
requests/month

Pro

25,000
requests/month

Enterprise

Unlimited
requests/month

Rate Limit Headers

Header Description
X-RateLimit-Limit Maximum requests per minute
X-RateLimit-Remaining Requests remaining in current window
X-Monthly-Limit Monthly request limit
X-Monthly-Used Requests used this month

Error Handling

The API uses standard HTTP status codes and returns JSON error responses:

200 Success - Request completed successfully
400 Bad Request - Invalid parameters
401 Unauthorized - Invalid or missing API key
429 Too Many Requests - Rate limit exceeded
500 Server Error - Something went wrong

Error Response Format

{
    "success": false,
    "error": "Description of what went wrong",
    "code": "ERROR_CODE",
    "status": 400
}

Network Tools

DNS Lookup

Query DNS records for any domain including A, AAAA, MX, NS, TXT, CNAME, and SOA records.

GET /api/v1/dns 1 credit

Parameters

Name Type Description
domain required string The domain to lookup (e.g., example.com)
type optional string Record type: A, AAAA, MX, NS, TXT, CNAME, SOA, ALL (default: ALL)

Code Examples

curl -X GET "https://tools-ninja.com/api/v1/dns?domain=google.com&type=A" \
     -H "X-API-Key: tn_your_api_key_here"
import requests

API_KEY = "tn_your_api_key_here"
BASE_URL = "https://tools-ninja.com/api/v1"

response = requests.get(
    f"{BASE_URL}/dns",
    params={"domain": "google.com", "type": "A"},
    headers={"X-API-Key": API_KEY}
)

data = response.json()
print(data)

# Access specific records
if data["success"]:
    for record in data["records"].get("A", []):
        print(f"A Record: {record}")
<?php
$apiKey = "tn_your_api_key_here";
$baseUrl = "https://tools-ninja.com/api/v1";

$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => "$baseUrl/dns?" . http_build_query([
        "domain" => "google.com",
        "type" => "A"
    ]),
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-API-Key: $apiKey"
    ]
]);

$response = curl_exec($ch);
$data = json_decode($response, true);

curl_close($ch);

if ($data["success"]) {
    foreach ($data["records"]["A"] ?? [] as $record) {
        echo "A Record: $record\n";
    }
}
?>
const API_KEY = "tn_your_api_key_here";
const BASE_URL = "https://tools-ninja.com/api/v1";

async function getDnsRecords(domain, type = "ALL") {
    const params = new URLSearchParams({ domain, type });

    const response = await fetch(`${BASE_URL}/dns?${params}`, {
        headers: {
            "X-API-Key": API_KEY
        }
    });

    const data = await response.json();

    if (data.success) {
        console.log("DNS Records:", data.records);
        return data.records;
    } else {
        throw new Error(data.error);
    }
}

// Usage
getDnsRecords("google.com", "A")
    .then(records => console.log(records))
    .catch(err => console.error(err));
// jQuery AJAX
$.ajax({
    url: "https://tools-ninja.com/api/v1/dns",
    method: "GET",
    data: {
        domain: "google.com",
        type: "A"
    },
    headers: {
        "X-API-Key": "tn_your_api_key_here"
    },
    success: function(data) {
        if (data.success) {
            console.log("DNS Records:", data.records);
            $.each(data.records.A || [], function(i, record) {
                console.log("A Record:", record);
            });
        }
    },
    error: function(xhr, status, error) {
        console.error("Error:", error);
    }
});

Example Response

{
    "success": true,
    "domain": "google.com",
    "records": {
        "A": ["142.250.185.46"],
        "AAAA": ["2607:f8b0:4004:800::200e"],
        "MX": [{"priority": 10, "host": "smtp.google.com"}],
        "NS": ["ns1.google.com", "ns2.google.com"],
        "TXT": ["v=spf1 include:_spf.google.com ~all"]
    }
}

WHOIS Lookup

Get domain registration information including registrar, creation date, expiry, and nameservers.

GET /api/v1/whois 2 credits

Parameters

Name Type Description
domain required string The domain to lookup

Code Examples

curl -X GET "https://tools-ninja.com/api/v1/whois?domain=example.com" \
     -H "X-API-Key: tn_your_api_key_here"
import requests

response = requests.get(
    "https://tools-ninja.com/api/v1/whois",
    params={"domain": "example.com"},
    headers={"X-API-Key": "tn_your_api_key_here"}
)

data = response.json()
if data["success"]:
    print(f"Registrar: {data['registrar']}")
    print(f"Expires: {data['expiry_date']}")
<?php
$ch = curl_init("https://tools-ninja.com/api/v1/whois?domain=example.com");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["X-API-Key: tn_your_api_key_here"]
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);

if ($data["success"]) {
    echo "Registrar: " . $data["registrar"] . "\n";
    echo "Expires: " . $data["expiry_date"] . "\n";
}
?>
const response = await fetch(
    "https://tools-ninja.com/api/v1/whois?domain=example.com",
    { headers: { "X-API-Key": "tn_your_api_key_here" } }
);
const data = await response.json();

if (data.success) {
    console.log(`Registrar: ${data.registrar}`);
    console.log(`Expires: ${data.expiry_date}`);
}
$.ajax({
    url: "https://tools-ninja.com/api/v1/whois",
    data: { domain: "example.com" },
    headers: { "X-API-Key": "tn_your_api_key_here" },
    success: function(data) {
        if (data.success) {
            console.log("Registrar:", data.registrar);
            console.log("Expires:", data.expiry_date);
        }
    }
});

Example Response

{
    "success": true,
    "domain": "example.com",
    "registrar": "ICANN",
    "created_date": "1995-08-14",
    "expiry_date": "2025-08-13",
    "updated_date": "2024-01-15",
    "nameservers": ["a.iana-servers.net", "b.iana-servers.net"],
    "status": ["clientDeleteProhibited", "clientTransferProhibited"]
}

IP Geolocation

Get geographic location and network information for any IP address.

GET /api/v1/ip-geolocation 1 credit

Parameters

Name Type Description
ip optional string IP address to lookup (defaults to requester's IP)

Code Examples

curl -X GET "https://tools-ninja.com/api/v1/ip-geolocation?ip=8.8.8.8" \
     -H "X-API-Key: tn_your_api_key_here"
import requests

response = requests.get(
    "https://tools-ninja.com/api/v1/ip-geolocation",
    params={"ip": "8.8.8.8"},
    headers={"X-API-Key": "tn_your_api_key_here"}
)

data = response.json()
if data["success"]:
    print(f"Location: {data['city']}, {data['country']}")
    print(f"ISP: {data['isp']}")
<?php
$ch = curl_init("https://tools-ninja.com/api/v1/ip-geolocation?ip=8.8.8.8");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["X-API-Key: tn_your_api_key_here"]
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);

if ($data["success"]) {
    echo "Location: {$data['city']}, {$data['country']}\n";
    echo "ISP: {$data['isp']}\n";
}
?>
const response = await fetch(
    "https://tools-ninja.com/api/v1/ip-geolocation?ip=8.8.8.8",
    { headers: { "X-API-Key": "tn_your_api_key_here" } }
);
const data = await response.json();

if (data.success) {
    console.log(`Location: ${data.city}, ${data.country}`);
    console.log(`ISP: ${data.isp}`);
}
$.ajax({
    url: "https://tools-ninja.com/api/v1/ip-geolocation",
    data: { ip: "8.8.8.8" },
    headers: { "X-API-Key": "tn_your_api_key_here" },
    success: function(data) {
        if (data.success) {
            console.log("Location:", data.city + ", " + data.country);
            console.log("ISP:", data.isp);
        }
    }
});

Example Response

{
    "success": true,
    "ip": "8.8.8.8",
    "country": "United States",
    "country_code": "US",
    "region": "California",
    "city": "Mountain View",
    "zip": "94035",
    "latitude": 37.386,
    "longitude": -122.0838,
    "timezone": "America/Los_Angeles",
    "isp": "Google LLC",
    "org": "Google Public DNS",
    "asn": "AS15169"
}

SSL Certificate Checker

Analyze SSL/TLS certificates including validity, issuer, and security configuration.

GET /api/v1/ssl-check 2 credits

Parameters

Name Type Description
domain required string Domain to check SSL certificate
port optional integer Port number (default: 443)

Code Examples

curl -X GET "https://tools-ninja.com/api/v1/ssl-check?domain=google.com" \
     -H "X-API-Key: tn_your_api_key_here"
import requests

response = requests.get(
    "https://tools-ninja.com/api/v1/ssl-check",
    params={"domain": "google.com"},
    headers={"X-API-Key": "tn_your_api_key_here"}
)

data = response.json()
if data["success"]:
    print(f"Valid: {data['valid']}")
    print(f"Days Remaining: {data['days_remaining']}")
<?php
$ch = curl_init("https://tools-ninja.com/api/v1/ssl-check?domain=google.com");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["X-API-Key: tn_your_api_key_here"]
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);

if ($data["success"]) {
    echo "Valid: " . ($data["valid"] ? "Yes" : "No") . "\n";
    echo "Days Remaining: " . $data["days_remaining"] . "\n";
}
?>
const response = await fetch(
    "https://tools-ninja.com/api/v1/ssl-check?domain=google.com",
    { headers: { "X-API-Key": "tn_your_api_key_here" } }
);
const data = await response.json();

if (data.success) {
    console.log(`Valid: ${data.valid}`);
    console.log(`Days Remaining: ${data.days_remaining}`);
}
$.ajax({
    url: "https://tools-ninja.com/api/v1/ssl-check",
    data: { domain: "google.com" },
    headers: { "X-API-Key": "tn_your_api_key_here" },
    success: function(data) {
        if (data.success) {
            console.log("Valid:", data.valid);
            console.log("Days Remaining:", data.days_remaining);
        }
    }
});

Example Response

{
    "success": true,
    "domain": "google.com",
    "valid": true,
    "issuer": "GTS CA 1C3",
    "subject": "*.google.com",
    "valid_from": "2024-01-01T00:00:00Z",
    "valid_until": "2024-03-25T23:59:59Z",
    "days_remaining": 83,
    "protocol": "TLSv1.3",
    "cipher": "TLS_AES_256_GCM_SHA384"
}

SEO Analyzer

Complete SEO audit with scores, recommendations, and detailed analysis of meta tags, headings, content, and technical factors.

POST /api/v1/seo-analyze 5 credits

Parameters (JSON Body)

Name Type Description
url required string URL of the website to analyze

Code Examples

import requests

response = requests.post(
    "https://tools-ninja.com/api/v1/seo-analyze",
    json={"url": "https://example.com"},
    headers={"X-API-Key": "tn_your_api_key_here"}
)
data = response.json()
print(f"Overall Score: {data['overall_score']}/100")
print(f"Meta Score: {data['scores']['meta']}")
print(f"Content Score: {data['scores']['content']}")
<?php
$ch = curl_init("https://tools-ninja.com/api/v1/seo-analyze");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-API-Key: tn_your_api_key_here",
        "Content-Type: application/json"
    ],
    CURLOPT_POSTFIELDS => json_encode(["url" => "https://example.com"])
]);
$data = json_decode(curl_exec($ch), true);
echo "Overall Score: " . $data["overall_score"] . "/100\n";
echo "Issues: " . count($data["issues"]) . "\n";
?>
const response = await fetch("https://tools-ninja.com/api/v1/seo-analyze", {
    method: "POST",
    headers: {
        "X-API-Key": "tn_your_api_key_here",
        "Content-Type": "application/json"
    },
    body: JSON.stringify({ url: "https://example.com" })
});
const data = await response.json();
console.log(`Overall Score: ${data.overall_score}/100`);
console.log(`Recommendations: ${data.recommendations.length}`);

Example Response

{
    "url": "https://example.com",
    "overall_score": 78,
    "scores": {
        "meta": 85,
        "content": 72,
        "technical": 80,
        "performance": 75,
        "mobile": 82,
        "security": 70
    },
    "meta": {
        "title": "Example Domain",
        "title_length": 14,
        "description": "This domain is for use in examples...",
        "description_length": 42
    },
    "headings": {
        "h1_count": 1,
        "h2_count": 0,
        "h3_count": 0
    },
    "content_stats": {
        "word_count": 28,
        "paragraph_count": 1
    },
    "issues": [
        {"type": "warning", "message": "Missing meta description"},
        {"type": "info", "message": "Consider adding more content"}
    ],
    "recommendations": [
        "Add a meta description between 150-160 characters",
        "Include more heading tags (H2, H3) for better structure"
    ]
}

Web Check - Comprehensive Security Analysis

Complete website security and infrastructure analysis with 48+ checks including SSL, DNS, headers, tech stack, performance, and more. Similar to web-check.xyz.

POST /api/v1/web-check 10 credits

Parameters (JSON Body)

Name Type Description
url required string Full URL of the website to analyze (e.g., https://example.com)
checks optional array Specific checks to run. If omitted, all 48 checks are executed.

Available Checks

Security: ssl_chain, ssl_expiry, cookies, hsts, dnssec, http_security, firewall, open_ports, security_txt, malware_detection, block_detection, tls_cipher_suites, tls_security_config, tls_handshake, csp_analysis, sri_check, mixed_content
Network: ip_info, server_location, server_status, server_info, redirect_chain, traceroute, whois, domain_info, subdomains
DNS: dns_records, txt_records, dns_server, associated_hosts, email_config, dns_doh_dot, bimi_record
Performance: quality_metrics, tech_stack, carbon_footprint, performance_metrics, lighthouse_scores
SEO: crawl_rules, site_features, listed_pages, linked_pages, social_tags, meta_tags, link_analysis
Other: headers, archive_history, global_ranking, screenshot

Code Examples

# Run all checks
curl -X POST "https://tools-ninja.com/api/v1/web-check" \
     -H "X-API-Key: tn_your_api_key_here" \
     -H "Content-Type: application/json" \
     -d '{"url": "https://example.com"}'

# Run specific checks only
curl -X POST "https://tools-ninja.com/api/v1/web-check" \
     -H "X-API-Key: tn_your_api_key_here" \
     -H "Content-Type: application/json" \
     -d '{"url": "https://example.com", "checks": ["ssl_chain", "dns_records", "tech_stack"]}'
import requests

# Run all checks
response = requests.post(
    "https://tools-ninja.com/api/v1/web-check",
    json={"url": "https://example.com"},
    headers={"X-API-Key": "tn_your_api_key_here"}
)
data = response.json()

# Access specific check results
print(f"SSL Valid: {data['ssl_chain']['data']['valid']}")
print(f"Server: {data['server_info']['data']['server']}")
print(f"Technologies: {data['tech_stack']['data']['count']}")

# Run specific checks only
response = requests.post(
    "https://tools-ninja.com/api/v1/web-check",
    json={
        "url": "https://example.com",
        "checks": ["ssl_chain", "lighthouse_scores", "tech_stack"]
    },
    headers={"X-API-Key": "tn_your_api_key_here"}
)
<?php
$ch = curl_init("https://tools-ninja.com/api/v1/web-check");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-API-Key: tn_your_api_key_here",
        "Content-Type: application/json"
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "url" => "https://example.com"
    ])
]);

$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);

echo "SSL Certificate: " . ($data['ssl_chain']['data']['valid'] ? 'Valid' : 'Invalid') . "\n";
echo "Server Location: " . $data['server_location']['data']['country'] . "\n";
echo "Tech Stack: " . $data['tech_stack']['data']['count'] . " technologies\n";
?>
// Run all 48 checks
const response = await fetch("https://tools-ninja.com/api/v1/web-check", {
    method: "POST",
    headers: {
        "X-API-Key": "tn_your_api_key_here",
        "Content-Type": "application/json"
    },
    body: JSON.stringify({ url: "https://example.com" })
});

const data = await response.json();
console.log(`SSL Valid: ${data.ssl_chain.data.valid}`);
console.log(`HSTS: ${data.hsts.data.enabled}`);
console.log(`Technologies: ${data.tech_stack.data.count}`);

// Security check summary
const securityChecks = ['ssl_chain', 'hsts', 'http_security', 'dnssec'];
securityChecks.forEach(check => {
    console.log(`${check}: ${data[check].status}`);
});

Example Response

{
    "ip_info": {
        "status": "success",
        "data": {
            "ip": "93.184.216.34",
            "hostname": "example.com",
            "asn": "AS15133",
            "org": "Edgecast Inc."
        }
    },
    "ssl_chain": {
        "status": "success",
        "data": {
            "valid": true,
            "issuer": "DigiCert Inc",
            "subject": "example.com",
            "expires": "2025-03-01",
            "days_remaining": 420,
            "protocol": "TLSv1.3"
        }
    },
    "dns_records": {
        "status": "success",
        "data": {
            "A": ["93.184.216.34"],
            "AAAA": ["2606:2800:220:1:248:1893:25c8:1946"],
            "MX": ["0 ."],
            "NS": ["a.iana-servers.net", "b.iana-servers.net"]
        }
    },
    "tech_stack": {
        "status": "success",
        "data": {
            "technologies": [
                {"name": "Nginx", "category": "Server"},
                {"name": "Cloudflare", "category": "CDN"}
            ],
            "categories": ["Server", "CDN"],
            "count": 2
        }
    },
    "lighthouse_scores": {
        "status": "success",
        "data": {
            "available": true,
            "performance": 95,
            "accessibility": 100,
            "best_practices": 100,
            "seo": 91,
            "metrics": {
                "fcp": "0.8 s",
                "lcp": "1.2 s",
                "cls": "0"
            }
        }
    },
    "hsts": {
        "status": "success",
        "data": {
            "enabled": true,
            "max_age": 31536000,
            "includeSubDomains": true,
            "preload": true
        }
    }
    // ... 42 more checks
}

HTTP Headers Checker

Fetch and analyze HTTP response headers from any URL including security headers.

GET /api/v1/http-headers 1 credit

Parameters

Name Type Description
url required string URL to fetch headers from

Code Examples

import requests

response = requests.get(
    "https://tools-ninja.com/api/v1/http-headers",
    params={"url": "https://google.com"},
    headers={"X-API-Key": "tn_your_api_key_here"}
)
print(response.json())
<?php
$url = "https://tools-ninja.com/api/v1/http-headers?" . http_build_query(["url" => "https://google.com"]);
$ch = curl_init($url);
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ["X-API-Key: tn_your_api_key_here"]]);
print_r(json_decode(curl_exec($ch), true));
?>
const response = await fetch(
    "https://tools-ninja.com/api/v1/http-headers?url=https://google.com",
    { headers: { "X-API-Key": "tn_your_api_key_here" } }
);
console.log(await response.json());

Ping

Check if a host is reachable and measure response time.

GET /api/v1/ping 1 credit

Parameters

Name Type Description
host required string Hostname or IP address to ping
count optional integer Number of pings (1-10, default: 4)

Code Examples

import requests

response = requests.get(
    "https://tools-ninja.com/api/v1/ping",
    params={"host": "google.com", "count": 4},
    headers={"X-API-Key": "tn_your_api_key_here"}
)
data = response.json()
print(f"Average: {data['avg_ms']}ms")
<?php
$url = "https://tools-ninja.com/api/v1/ping?" . http_build_query(["host" => "google.com", "count" => 4]);
$ch = curl_init($url);
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ["X-API-Key: tn_your_api_key_here"]]);
$data = json_decode(curl_exec($ch), true);
echo "Average: {$data['avg_ms']}ms";
?>
const response = await fetch(
    "https://tools-ninja.com/api/v1/ping?host=google.com&count=4",
    { headers: { "X-API-Key": "tn_your_api_key_here" } }
);
const data = await response.json();
console.log(`Average: ${data.avg_ms}ms`);

Port Checker

Check if specific ports are open on a host.

GET /api/v1/port 1 credit

Parameters

Name Type Description
host required string Hostname or IP address
port required integer Port number to check (1-65535)

Code Examples

import requests

response = requests.get(
    "https://tools-ninja.com/api/v1/port",
    params={"host": "google.com", "port": 443},
    headers={"X-API-Key": "tn_your_api_key_here"}
)
data = response.json()
print(f"Port 443 is {'open' if data['open'] else 'closed'}")
<?php
$url = "https://tools-ninja.com/api/v1/port?" . http_build_query(["host" => "google.com", "port" => 443]);
$ch = curl_init($url);
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ["X-API-Key: tn_your_api_key_here"]]);
$data = json_decode(curl_exec($ch), true);
echo "Port 443 is " . ($data["open"] ? "open" : "closed");
?>
const response = await fetch(
    "https://tools-ninja.com/api/v1/port?host=google.com&port=443",
    { headers: { "X-API-Key": "tn_your_api_key_here" } }
);
const data = await response.json();
console.log(`Port 443 is ${data.open ? 'open' : 'closed'}`);

Traceroute

Trace the network path to a destination host.

GET /api/v1/traceroute 3 credits

Parameters

Name Type Description
host required string Destination hostname or IP
max_hops optional integer Maximum hops (5-30, default: 20)

Code Examples

import requests

response = requests.get(
    "https://tools-ninja.com/api/v1/traceroute",
    params={"host": "google.com"},
    headers={"X-API-Key": "tn_your_api_key_here"}
)
data = response.json()
for hop in data["hops"]:
    print(f"{hop['hop']}: {hop['ip']} ({hop['ms']}ms)")
<?php
$ch = curl_init("https://tools-ninja.com/api/v1/traceroute?host=google.com");
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ["X-API-Key: tn_your_api_key_here"]]);
$data = json_decode(curl_exec($ch), true);
foreach ($data["hops"] as $hop) {
    echo "{$hop['hop']}: {$hop['ip']} ({$hop['ms']}ms)\n";
}
?>
const response = await fetch(
    "https://tools-ninja.com/api/v1/traceroute?host=google.com",
    { headers: { "X-API-Key": "tn_your_api_key_here" } }
);
const data = await response.json();
data.hops.forEach(hop => console.log(`${hop.hop}: ${hop.ip} (${hop.ms}ms)`));

MAC Vendor Lookup

Identify the manufacturer of a network device by its MAC address.

GET /api/v1/mac-vendor 1 credit

Parameters

Name Type Description
mac required string MAC address (e.g., 00:1A:2B:3C:4D:5E)

Code Examples

import requests

response = requests.get(
    "https://tools-ninja.com/api/v1/mac-vendor",
    params={"mac": "00:1A:2B:3C:4D:5E"},
    headers={"X-API-Key": "tn_your_api_key_here"}
)
data = response.json()
print(f"Vendor: {data['vendor']}")
<?php
$ch = curl_init("https://tools-ninja.com/api/v1/mac-vendor?mac=00:1A:2B:3C:4D:5E");
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ["X-API-Key: tn_your_api_key_here"]]);
$data = json_decode(curl_exec($ch), true);
echo "Vendor: " . $data["vendor"];
?>
const response = await fetch(
    "https://tools-ninja.com/api/v1/mac-vendor?mac=00:1A:2B:3C:4D:5E",
    { headers: { "X-API-Key": "tn_your_api_key_here" } }
);
const data = await response.json();
console.log(`Vendor: ${data.vendor}`);

Subnet Calculator

Calculate subnet information from IP address and CIDR notation.

GET /api/v1/subnet 1 credit

Parameters

Name Type Description
ip required string IP address (e.g., 192.168.1.0)
cidr required integer CIDR notation (1-32)

Code Examples

import requests

response = requests.get(
    "https://tools-ninja.com/api/v1/subnet",
    params={"ip": "192.168.1.0", "cidr": 24},
    headers={"X-API-Key": "tn_your_api_key_here"}
)
data = response.json()
print(f"Network: {data['network']}")
print(f"Hosts: {data['usable_hosts']}")
<?php
$ch = curl_init("https://tools-ninja.com/api/v1/subnet?ip=192.168.1.0&cidr=24");
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ["X-API-Key: tn_your_api_key_here"]]);
$data = json_decode(curl_exec($ch), true);
echo "Network: {$data['network']}\nHosts: {$data['usable_hosts']}";
?>
const response = await fetch(
    "https://tools-ninja.com/api/v1/subnet?ip=192.168.1.0&cidr=24",
    { headers: { "X-API-Key": "tn_your_api_key_here" } }
);
const data = await response.json();
console.log(`Network: ${data.network}\nHosts: ${data.usable_hosts}`);

Web Check - Comprehensive Website Analysis

Perform 38+ comprehensive security and infrastructure checks on any website. Analyzes SSL, DNS, headers, security configurations, tech stack, and more.

POST /api/v1/web-check 5 credits

Streams results via Server-Sent Events (SSE). Each check is returned as it completes for real-time progress updates.

Parameters (JSON Body)

Name Type Description
url required string Full URL to analyze (e.g., https://example.com)
checks optional array Specific checks to run. If omitted, all 38 checks are performed.

Available Checks (38 total)

ip_info ssl_chain dns_records cookies crawl_rules headers quality_metrics server_location redirect_chain txt_records server_status open_ports traceroute carbon_footprint server_info whois domain_info dnssec site_features hsts dns_server tech_stack listed_pages security_txt linked_pages social_tags email_config firewall http_security archive_history global_ranking block_detection malware_detection tls_cipher_suites tls_security_config tls_handshake screenshot associated_hosts

Code Examples

# Full analysis (all 38 checks)
curl -X POST "https://tools-ninja.com/api/v1/web-check" \
     -H "X-API-Key: tn_your_api_key_here" \
     -H "Content-Type: application/json" \
     -d '{"url": "https://example.com"}'

# Specific checks only
curl -X POST "https://tools-ninja.com/api/v1/web-check" \
     -H "X-API-Key: tn_your_api_key_here" \
     -H "Content-Type: application/json" \
     -d '{"url": "https://example.com", "checks": ["ssl_chain", "dns_records", "http_security"]}'
import requests
import json

# Using Server-Sent Events
response = requests.post(
    "https://tools-ninja.com/api/v1/web-check",
    json={"url": "https://example.com"},
    headers={"X-API-Key": "tn_your_api_key_here"},
    stream=True
)

results = {}
for line in response.iter_lines():
    if line:
        data = line.decode('utf-8')
        if data.startswith('data: '):
            check_result = json.loads(data[6:])
            check_name = check_result.get('check')
            results[check_name] = check_result
            print(f"Completed: {check_name}")

# Access specific results
print(f"SSL Valid: {results.get('ssl_chain', {}).get('data', {}).get('valid')}")
print(f"Tech Stack: {results.get('tech_stack', {}).get('data', {}).get('technologies')}")
<?php
$ch = curl_init("https://tools-ninja.com/api/v1/web-check");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-API-Key: tn_your_api_key_here",
        "Content-Type: application/json"
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "url" => "https://example.com",
        "checks" => ["ssl_chain", "dns_records", "tech_stack"]
    ])
]);

$response = curl_exec($ch);
curl_close($ch);

// Parse SSE response
$lines = explode("\n", $response);
$results = [];
foreach ($lines as $line) {
    if (strpos($line, 'data: ') === 0) {
        $data = json_decode(substr($line, 6), true);
        $results[$data['check']] = $data;
    }
}

print_r($results);
?>
// Using EventSource for real-time updates
const eventSource = new EventSource(
    'https://tools-ninja.com/api/v1/web-check?' + new URLSearchParams({
        url: 'https://example.com',
        api_key: 'tn_your_api_key_here'
    })
);

const results = {};

eventSource.onmessage = (event) => {
    const data = JSON.parse(event.data);
    results[data.check] = data;
    console.log(`Check completed: ${data.check}`, data);
};

eventSource.onerror = () => {
    eventSource.close();
    console.log('All checks completed:', results);
};

// Or using fetch with POST
async function runWebCheck(url) {
    const response = await fetch('https://tools-ninja.com/api/v1/web-check', {
        method: 'POST',
        headers: {
            'X-API-Key': 'tn_your_api_key_here',
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({ url })
    });

    const reader = response.body.getReader();
    const decoder = new TextDecoder();

    while (true) {
        const { done, value } = await reader.read();
        if (done) break;

        const text = decoder.decode(value);
        const lines = text.split('\n');
        for (const line of lines) {
            if (line.startsWith('data: ')) {
                const data = JSON.parse(line.slice(6));
                console.log(data.check, data);
            }
        }
    }
}

Response Format (SSE Stream)

// Each check returns a separate event
data: {"check": "ip_info", "status": "success", "data": {"ip": "93.184.216.34", "asn": "AS15133", "org": "Edgecast Inc."}}
data: {"check": "ssl_chain", "status": "success", "data": {"valid": true, "issuer": "DigiCert", "expires": "2024-12-15", "grade": "A+"}}
data: {"check": "dns_records", "status": "success", "data": {"A": ["93.184.216.34"], "MX": ["mail.example.com"], "NS": ["ns1.example.com"]}}
data: {"check": "tech_stack", "status": "success", "data": {"technologies": ["nginx", "PHP", "WordPress", "jQuery"]}}
data: {"check": "http_security", "status": "success", "data": {"hsts": true, "csp": true, "x_frame_options": "DENY", "score": 85}}

Check Categories

Category Checks Description
Security ssl_chain, http_security, hsts, tls_*, firewall SSL certificates, security headers, TLS configuration
DNS & Network dns_records, dnssec, dns_server, ip_info DNS configuration, DNSSEC, nameservers
Infrastructure server_info, server_location, open_ports, traceroute Server details, geolocation, network path
Content & SEO social_tags, crawl_rules, listed_pages, linked_pages Meta tags, robots.txt, sitemap analysis
Technology tech_stack, site_features, cookies Frameworks, libraries, CMS detection
Reputation whois, global_ranking, malware_detection, block_detection Domain info, rankings, security blocklists

Developer Tools

JSON Formatter

Format, validate, and minify JSON data.

POST /api/v1/json-format 1 credit

Parameters (JSON Body)

Name Type Description
json required string JSON string to format
action optional string format, minify, validate (default: format)

Code Examples

curl -X POST "https://tools-ninja.com/api/v1/json-format" \
     -H "X-API-Key: tn_your_api_key_here" \
     -H "Content-Type: application/json" \
     -d '{"json": "{\"name\":\"John\",\"age\":30}", "action": "format"}'
import requests

response = requests.post(
    "https://tools-ninja.com/api/v1/json-format",
    json={
        "json": '{"name":"John","age":30}',
        "action": "format"
    },
    headers={"X-API-Key": "tn_your_api_key_here"}
)
print(response.json()["formatted"])
<?php
$ch = curl_init("https://tools-ninja.com/api/v1/json-format");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-API-Key: tn_your_api_key_here",
        "Content-Type: application/json"
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "json" => '{"name":"John","age":30}',
        "action" => "format"
    ])
]);
$data = json_decode(curl_exec($ch), true);
echo $data["formatted"];
?>
const response = await fetch("https://tools-ninja.com/api/v1/json-format", {
    method: "POST",
    headers: {
        "X-API-Key": "tn_your_api_key_here",
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        json: '{"name":"John","age":30}',
        action: "format"
    })
});
const data = await response.json();
console.log(data.formatted);
$.ajax({
    url: "https://tools-ninja.com/api/v1/json-format",
    method: "POST",
    headers: { "X-API-Key": "tn_your_api_key_here" },
    contentType: "application/json",
    data: JSON.stringify({
        json: '{"name":"John","age":30}',
        action: "format"
    }),
    success: function(data) {
        console.log(data.formatted);
    }
});

Base64 Encode/Decode

Encode or decode Base64 strings.

POST /api/v1/base64 1 credit

Parameters (JSON Body)

Name Type Description
data required string String to encode/decode
action optional string encode or decode (default: encode)

Code Examples

import requests

# Encode
response = requests.post(
    "https://tools-ninja.com/api/v1/base64",
    json={"data": "Hello World", "action": "encode"},
    headers={"X-API-Key": "tn_your_api_key_here"}
)
print(response.json()["result"])  # SGVsbG8gV29ybGQ=

# Decode
response = requests.post(
    "https://tools-ninja.com/api/v1/base64",
    json={"data": "SGVsbG8gV29ybGQ=", "action": "decode"},
    headers={"X-API-Key": "tn_your_api_key_here"}
)
print(response.json()["result"])  # Hello World
<?php
$ch = curl_init("https://tools-ninja.com/api/v1/base64");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["X-API-Key: tn_your_api_key_here", "Content-Type: application/json"],
    CURLOPT_POSTFIELDS => json_encode(["data" => "Hello World", "action" => "encode"])
]);
$data = json_decode(curl_exec($ch), true);
echo $data["result"];  // SGVsbG8gV29ybGQ=
?>
// Encode
const response = await fetch("https://tools-ninja.com/api/v1/base64", {
    method: "POST",
    headers: { "X-API-Key": "tn_your_api_key_here", "Content-Type": "application/json" },
    body: JSON.stringify({ data: "Hello World", action: "encode" })
});
const data = await response.json();
console.log(data.result);  // SGVsbG8gV29ybGQ=

Hash Generator

Generate cryptographic hashes (MD5, SHA1, SHA256, SHA512).

POST /api/v1/hash 1 credit

Parameters (JSON Body)

Name Type Description
data required string String to hash
algorithm optional string md5, sha1, sha256, sha512, all (default: all)

Code Examples

import requests

response = requests.post(
    "https://tools-ninja.com/api/v1/hash",
    json={"data": "Hello World", "algorithm": "sha256"},
    headers={"X-API-Key": "tn_your_api_key_here"}
)
print(response.json()["sha256"])
<?php
$ch = curl_init("https://tools-ninja.com/api/v1/hash");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["X-API-Key: tn_your_api_key_here", "Content-Type: application/json"],
    CURLOPT_POSTFIELDS => json_encode(["data" => "Hello World", "algorithm" => "sha256"])
]);
$data = json_decode(curl_exec($ch), true);
echo $data["sha256"];
?>
const response = await fetch("https://tools-ninja.com/api/v1/hash", {
    method: "POST",
    headers: { "X-API-Key": "tn_your_api_key_here", "Content-Type": "application/json" },
    body: JSON.stringify({ data: "Hello World", algorithm: "sha256" })
});
const data = await response.json();
console.log(data.sha256);

QR Code Generator

Generate QR codes from text or URLs.

GET /api/v1/qr-code 2 credits

Parameters

Name Type Description
data required string Text or URL to encode
size optional integer Size in pixels (100-1000, default: 300)
format optional string png, svg, base64 (default: png)

Code Examples

import requests

# Get QR as base64
response = requests.get(
    "https://tools-ninja.com/api/v1/qr-code",
    params={"data": "https://example.com", "format": "base64", "size": 300},
    headers={"X-API-Key": "tn_your_api_key_here"}
)
data = response.json()
# Use data["qr_base64"] in your HTML: <img src="data:image/png;base64,...">
<?php
$params = http_build_query(["data" => "https://example.com", "format" => "base64", "size" => 300]);
$ch = curl_init("https://tools-ninja.com/api/v1/qr-code?$params");
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ["X-API-Key: tn_your_api_key_here"]]);
$data = json_decode(curl_exec($ch), true);
// Use $data["qr_base64"] in your HTML
?>
const params = new URLSearchParams({ data: "https://example.com", format: "base64", size: 300 });
const response = await fetch(`https://tools-ninja.com/api/v1/qr-code?${params}`, {
    headers: { "X-API-Key": "tn_your_api_key_here" }
});
const data = await response.json();
// Display: <img src={`data:image/png;base64,${data.qr_base64}`} />

Markdown Parser

Convert Markdown to HTML.

POST /api/v1/markdown 1 credit

Parameters (JSON Body)

Name Type Description
markdown required string Markdown content to convert

Code Examples

import requests

response = requests.post(
    "https://tools-ninja.com/api/v1/markdown",
    json={"markdown": "# Hello\n\nThis is **bold** text."},
    headers={"X-API-Key": "tn_your_api_key_here"}
)
print(response.json()["html"])
<?php
$ch = curl_init("https://tools-ninja.com/api/v1/markdown");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["X-API-Key: tn_your_api_key_here", "Content-Type: application/json"],
    CURLOPT_POSTFIELDS => json_encode(["markdown" => "# Hello\n\nThis is **bold** text."])
]);
$data = json_decode(curl_exec($ch), true);
echo $data["html"];
?>
const response = await fetch("https://tools-ninja.com/api/v1/markdown", {
    method: "POST",
    headers: { "X-API-Key": "tn_your_api_key_here", "Content-Type": "application/json" },
    body: JSON.stringify({ markdown: "# Hello\n\nThis is **bold** text." })
});
const data = await response.json();
console.log(data.html);

Text Tools

Analyze text, convert case, compare differences, generate Lorem Ipsum, and encode/decode HTML.

POST /api/v1/text-tools 1 credit

Parameters (JSON Body)

Name Type Description
action required string Action: analyze, convert_case, compare_diff, generate_lorem, encode_html, decode_html
text required* string Text to process (required for most actions)
type optional string For convert_case: upper, lower, title, sentence, camel, snake, kebab
text1, text2 optional string For compare_diff: two texts to compare
count optional integer For generate_lorem: number of paragraphs/sentences/words

Code Examples

import requests

# Analyze text
response = requests.post(
    "https://tools-ninja.com/api/v1/text-tools",
    json={"action": "analyze", "text": "Hello World! This is a sample text."},
    headers={"X-API-Key": "tn_your_api_key_here"}
)
stats = response.json()["statistics"]
print(f"Words: {stats['words']}, Characters: {stats['characters']}")

# Convert case
response = requests.post(
    "https://tools-ninja.com/api/v1/text-tools",
    json={"action": "convert_case", "text": "hello world", "type": "title"},
    headers={"X-API-Key": "tn_your_api_key_here"}
)
print(response.json()["result"])  # "Hello World"
<?php
$ch = curl_init("https://tools-ninja.com/api/v1/text-tools");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-API-Key: tn_your_api_key_here",
        "Content-Type: application/json"
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "action" => "analyze",
        "text" => "Hello World! This is a sample text."
    ])
]);
$data = json_decode(curl_exec($ch), true);
echo "Words: " . $data["statistics"]["words"] . "\n";
echo "Reading time: " . $data["statistics"]["reading_time_minutes"] . " min\n";
?>
// Analyze text
const response = await fetch("https://tools-ninja.com/api/v1/text-tools", {
    method: "POST",
    headers: {
        "X-API-Key": "tn_your_api_key_here",
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        action: "analyze",
        text: "Hello World! This is a sample text."
    })
});
const data = await response.json();
console.log(`Words: ${data.statistics.words}`);
console.log(`Top words:`, data.top_words);

Example Response (analyze action)

{
    "success": true,
    "statistics": {
        "characters": 36,
        "characters_no_spaces": 30,
        "words": 7,
        "sentences": 2,
        "paragraphs": 1,
        "lines": 1,
        "average_word_length": 4.29,
        "reading_time_minutes": 1
    },
    "top_words": {
        "hello": 1,
        "world": 1,
        "this": 1,
        "is": 1,
        "a": 1
    }
}

Cron Expression Parser

Parse and explain cron expressions.

GET /api/v1/cron 1 credit

Parameters

Name Type Description
expression required string Cron expression (e.g., "0 9 * * 1-5")

Code Examples

import requests

response = requests.get(
    "https://tools-ninja.com/api/v1/cron",
    params={"expression": "0 9 * * 1-5"},
    headers={"X-API-Key": "tn_your_api_key_here"}
)
data = response.json()
print(data["description"])  # "At 9:00 AM, Monday through Friday"
<?php
$ch = curl_init("https://tools-ninja.com/api/v1/cron?" . http_build_query(["expression" => "0 9 * * 1-5"]));
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ["X-API-Key: tn_your_api_key_here"]]);
$data = json_decode(curl_exec($ch), true);
echo $data["description"];
?>
const response = await fetch(
    "https://tools-ninja.com/api/v1/cron?expression=" + encodeURIComponent("0 9 * * 1-5"),
    { headers: { "X-API-Key": "tn_your_api_key_here" } }
);
const data = await response.json();
console.log(data.description);

CSV to JSON Converter

Convert CSV data to JSON format.

POST /api/v1/csv-to-json 1 credit

Parameters (JSON Body)

Name Type Description
csv required string CSV data to convert
delimiter optional string Field delimiter (default: ,)

Code Examples

import requests

csv_data = "name,age,city\nJohn,30,NYC\nJane,25,LA"

response = requests.post(
    "https://tools-ninja.com/api/v1/csv-to-json",
    json={"csv": csv_data},
    headers={"X-API-Key": "tn_your_api_key_here"}
)
print(response.json()["json"])
<?php
$csv = "name,age,city\nJohn,30,NYC\nJane,25,LA";
$ch = curl_init("https://tools-ninja.com/api/v1/csv-to-json");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["X-API-Key: tn_your_api_key_here", "Content-Type: application/json"],
    CURLOPT_POSTFIELDS => json_encode(["csv" => $csv])
]);
$data = json_decode(curl_exec($ch), true);
print_r($data["json"]);
?>
const csvData = "name,age,city\nJohn,30,NYC\nJane,25,LA";

const response = await fetch("https://tools-ninja.com/api/v1/csv-to-json", {
    method: "POST",
    headers: { "X-API-Key": "tn_your_api_key_here", "Content-Type": "application/json" },
    body: JSON.stringify({ csv: csvData })
});
const data = await response.json();
console.log(data.json);

XML Converter

Convert between XML and JSON formats.

POST /api/v1/xml-to-json 1 credit

Parameters (JSON Body)

Name Type Description
data required string XML or JSON data to convert
action optional string xml-to-json or json-to-xml (default: xml-to-json)

Code Examples

import requests

xml_data = "<user><name>John</name><age>30</age></user>"

response = requests.post(
    "https://tools-ninja.com/api/v1/xml-to-json",
    json={"data": xml_data, "action": "xml-to-json"},
    headers={"X-API-Key": "tn_your_api_key_here"}
)
print(response.json()["result"])
<?php
$xml = "<user><name>John</name><age>30</age></user>";
$ch = curl_init("https://tools-ninja.com/api/v1/xml-to-json");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["X-API-Key: tn_your_api_key_here", "Content-Type: application/json"],
    CURLOPT_POSTFIELDS => json_encode(["data" => $xml, "action" => "xml-to-json"])
]);
$data = json_decode(curl_exec($ch), true);
print_r($data["result"]);
?>
const xmlData = "<user><name>John</name><age>30</age></user>";

const response = await fetch("https://tools-ninja.com/api/v1/xml-to-json", {
    method: "POST",
    headers: { "X-API-Key": "tn_your_api_key_here", "Content-Type": "application/json" },
    body: JSON.stringify({ data: xmlData, action: "xml-to-json" })
});
const data = await response.json();
console.log(data.result);

Code Formatter

Format source code in various languages.

POST /api/v1/code-format 1 credit

Parameters (JSON Body)

Name Type Description
code required string Source code to format
language required string javascript, python, php, html, css, sql

Code Examples

import requests

response = requests.post(
    "https://tools-ninja.com/api/v1/code-format",
    json={
        "code": "function test(){return 1+2;}",
        "language": "javascript"
    },
    headers={"X-API-Key": "tn_your_api_key_here"}
)
print(response.json()["formatted"])
<?php
$ch = curl_init("https://tools-ninja.com/api/v1/code-format");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["X-API-Key: tn_your_api_key_here", "Content-Type: application/json"],
    CURLOPT_POSTFIELDS => json_encode([
        "code" => "function test(){return 1+2;}",
        "language" => "javascript"
    ])
]);
$data = json_decode(curl_exec($ch), true);
echo $data["formatted"];
?>
const response = await fetch("https://tools-ninja.com/api/v1/code-format", {
    method: "POST",
    headers: { "X-API-Key": "tn_your_api_key_here", "Content-Type": "application/json" },
    body: JSON.stringify({
        code: "function test(){return 1+2;}",
        language: "javascript"
    })
});
const data = await response.json();
console.log(data.formatted);