APIVoid logo

Port Scan API Reference

Scan common TCP ports of an IP and get the open/closed status for each port.

Service details and pricing: Port Scan API

POSThttps://api.apivoid.com/v2/port-scan
5 credits per successful requestPOST · JSON

Request example

Query the endpoint via an HTTPS POST request (replace YOUR_API_KEY_HERE with your API key):

curl
curl -X POST "https://api.apivoid.com/v2/port-scan" \
     -H "Content-Type: application/json" \
     -H "X-API-Key: YOUR_API_KEY_HERE" \
     -d '{"ip": "1.2.3.4"}'

The same request in PHP:

php
$ip = '1.2.3.4';

$apiKey = 'YOUR_API_KEY_HERE';

$curl = curl_init('https://api.apivoid.com/v2/port-scan');
curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'X-API-Key: ' . $apiKey]);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode(['ip' => $ip]));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);

if ($httpCode === 200) {
    $responseData = json_decode($response, true);
    print_r($responseData);
} else {
    print_r('An error occurred: '.$response);
}

Request parameters

Required

ipstringRequired

IPv4 or IPv6 address to scan.

Optional

top_portsintegerDefault: 20

Can be 20 or 100: scan the top 20 or the top 100 most common ports.

custom_portsstring

Set custom ports to scan, e.g. 21,22,23,53,80,443 (no spaces).

Response example

A successful request returns HTTP 200 with a JSON body:

json · 200
{
    "ip": "1.2.3.4",
    "open_ports": 4,
    "scanned_ports": 20,
    "ports": [
        {
            "port": 21,
            "proto": "tcp",
            "status": "open",
            "service": "ftp"
        },
        {
            "port": 22,
            "proto": "tcp",
            "status": "open",
            "service": "ssh"
        },
        {
            "port": 23,
            "proto": "tcp",
            "status": "closed",
            "service": "telnet"
        },
        {
            "port": 25,
            "proto": "tcp",
            "status": "closed",
            "service": "smtp"
        },
        {
            "port": 53,
            "proto": "tcp",
            "status": "closed",
            "service": "domain"
        },
        {
            "port": 80,
            "proto": "tcp",
            "status": "open",
            "service": "http"
        },
        {
            "port": 110,
            "proto": "tcp",
            "status": "closed",
            "service": "pop3"
        },
        {
            "port": 111,
            "proto": "tcp",
            "status": "closed",
            "service": "rpcbind"
        },
        {
            "port": 135,
            "proto": "tcp",
            "status": "closed",
            "service": "msrpc"
        },
        {
            "port": 139,
            "proto": "tcp",
            "status": "closed",
            "service": "netbios-ssn"
        },
        {
            "port": 143,
            "proto": "tcp",
            "status": "closed",
            "service": "imap"
        },
        {
            "port": 443,
            "proto": "tcp",
            "status": "open",
            "service": "https"
        },
        {
            "port": 445,
            "proto": "tcp",
            "status": "closed",
            "service": "microsoft-ds"
        },
        {
            "port": 993,
            "proto": "tcp",
            "status": "closed",
            "service": "imaps"
        },
        {
            "port": 995,
            "proto": "tcp",
            "status": "closed",
            "service": "pop3s"
        },
        {
            "port": 1723,
            "proto": "tcp",
            "status": "closed",
            "service": "pptp"
        },
        {
            "port": 3306,
            "proto": "tcp",
            "status": "closed",
            "service": "mysql"
        },
        {
            "port": 3389,
            "proto": "tcp",
            "status": "closed",
            "service": "ms-wbt-server"
        },
        {
            "port": 5900,
            "proto": "tcp",
            "status": "closed",
            "service": "vnc"
        },
        {
            "port": 8080,
            "proto": "tcp",
            "status": "closed",
            "service": "http-proxy"
        }
    ],
    "elapsed_ms": 185
}

Response fields

The fields returned in the JSON response:

ipstring

IP address submitted for the port scan.

open_portsinteger

Number of open ports found.

scanned_portsinteger

Number of ports scanned.

portsarray

List of scanned ports with their status.

ports[n] → portinteger

Port number scanned.

ports[n] → protostring

Protocol of the scanned port, e.g. tcp.

ports[n] → statusstring

Status of the port, can be open/closed.

ports[n] → servicestring

Common service associated with the port, e.g. ftp, ssh, https.

elapsed_msinteger

Time taken to process the request, in milliseconds.