# Port Scanner API

Secure your infrastructure by scanning for open ports on any IP address or domain. Verify firewall rules and audit network accessibility with flexible scanning options.

99.9% Uptime Nmap Powered Stealth Scan Mode

[Get API Key](https://auth.geekflare.com/register?service=geekflare_api)

## Response

```json
{
  "timestamp": 1768929500000,
  "apiStatus": "success",
  "apiCode": 200,
  "meta": {
    "url": "geekflare.com",
    "test": {
      "id": "a1b2c3d4-5e6f-7890-abcd-ef1234567890"
    }
  },
  "data": {
    "openPorts": [
      {
        "port": 80,
        "service": "http",
        "state": "open"
      },
      {
        "port": 443,
        "service": "https",
        "state": "open"
      },
      {
        "port": 22,
        "service": "ssh",
        "state": "open"
      }
    ],
    "totalScanned": 100,
    "openCount": 3,
    "closedCount": 97
  }
}
```

## Ready-to-use code snippets

Python

NodeJS

Go

PHP

Java

Ruby

cURL

```
import requests

url = "https://api.geekflare.com/openport"
payload = {"url": "example.com", "topPorts": 100}
headers = {
    "x-api-key": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)
print(response.text)
```

## Why Geekflare Port Scanner API

### Custom Port Ranges

Define exactly what to check. The API supports flexible inputs, allowing you to scan single ports (`22`), lists (`80, 443`), or full ranges (`8000-9000`).

### Top Ports Presets

Use the `topPorts` parameter to automatically scan the most common 50, 100, 500, 1000, or 5000 ports frequently used by services and malware.

### Real-Time Status

We perform active TCP connections to verify the actual status of the port.

## Simple, transparent pricing

- **Starter**: $9/mo 5K Credits/mo Scan ~2500 hosts 5 Requests per second
- **Growth (Most Popular)**: $49/mo 100K Credits/mo Scan ~50K hosts 25 Requests per second
- **Business**: $249/mo 1M Credits/mo Scan ~500K hosts 50 Requests per second

[View Full Pricing](/content/api/pricing/index.html) [Get Free API Key](https://auth.geekflare.com/register?service=geekflare_api)

## Other Geekflare API services

### Run TLS Scan

Test SSL/TLS certificate configuration like supported protocols, expiry, CN, SAN, etc.

[Try it out in the Playground →](/content/api/tlsscan/index.html)

### Lookup DNS Records

Query all major DNS record types including A, AAAA, CNAME, MX, TXT, NS, SOA, and CAA in a single request.

[Try it out in the Playground →](/content/api/dnsrecord/index.html)

### Scrape Website

Extract HTML, Markdown, or JSON from dynamic web pages with automatic CAPTCHA solving.

[Try it out in the Playground →](/content/api/webscraping/index.html)

### Check Site Loadtime

Check how much time your site takes to load including DNS, Connect, TLS, and TTFB metrics.

### Check Broken Links

Find dead internal and external links on a webpage.

[Try it out in the Playground →](/content/api/brokenlink/index.html)

## Frequently Asked Questions

**Is it legal to use a Port Scanner API?**

The legality varies by jurisdiction. You should **only** scan networks, domains, or IPs that you own or have explicit permission to audit. Unauthorized scanning can be considered a cyberattack.

**How does the API work?**

The API attempts to establish a TCP connection to the specified ports on the target IP or hostname. It analyzes the response to determine if the port is open or closed.

**What happens if I don't specify which ports to scan?**

If no parameters are provided, the API defaults to scanning the **Top 100** most common ports.

**How can I avoid getting blocked?**

To avoid being flagged by IDPS, ensure you are only scanning assets you have authorization for.

## Ready to Scan Ports?

Get your API key in less than 30 seconds. 500 free credits.

[Get Started Free](https://auth.geekflare.com/register?service=geekflare_api)
