{
  "name": "netkits.dev API",
  "version": "2.0.0",
  "description": "Developer and webmaster tools API collection",
  "baseUrl": "https://netkits.dev",
  "endpoints": [
    {
      "path": "/api/ip",
      "method": "GET",
      "description": "Get IP address and geolocation information",
      "authentication": "None",
      "rateLimit": "None",
      "response": {
        "type": "application/json",
        "schema": {
          "ip": "string (IPv4 or IPv6 address)",
          "country": "string (2-letter country code)",
          "city": "string (city name)",
          "region": "string (region/state)",
          "timezone": "string (IANA timezone)",
          "latitude": "string (decimal latitude)",
          "longitude": "string (decimal longitude)",
          "asn": "number (autonomous system number)",
          "colo": "string (Cloudflare data center code)"
        },
        "example": {
          "ip": "203.0.113.1",
          "country": "US",
          "city": "San Francisco",
          "region": "California",
          "timezone": "America/Los_Angeles",
          "latitude": "37.7749",
          "longitude": "-122.4194",
          "asn": 13335,
          "colo": "SFO"
        }
      }
    },
    {
      "path": "/api/headers",
      "method": "GET",
      "description": "View all HTTP request headers",
      "authentication": "None",
      "rateLimit": "None",
      "response": {
        "type": "application/json",
        "schema": {
          "headers": "object (key-value pairs of all request headers)"
        },
        "example": {
          "headers": {
            "user-agent": "Mozilla/5.0...",
            "accept": "text/html,application/json",
            "accept-language": "en-US,en;q=0.9",
            "cf-connecting-ip": "203.0.113.1",
            "cf-ray": "8a1b2c3d4e5f6789-SFO"
          }
        }
      }
    },
    {
      "path": "/api/json/validate",
      "method": "POST",
      "description": "Validate JSON syntax",
      "authentication": "None",
      "rateLimit": "None",
      "request": {
        "type": "application/json",
        "schema": {
          "json": "string (JSON string to validate)"
        },
        "example": {
          "json": "{\"name\": \"John\", \"age\": 30}"
        }
      },
      "response": {
        "type": "application/json",
        "schema": {
          "valid": "boolean (validation result)",
          "error": "string|null (error message if invalid)",
          "formatted": "string|null (prettified JSON if valid)"
        },
        "example": {
          "valid": true,
          "error": null,
          "formatted": "{\n  \"name\": \"John\",\n  \"age\": 30\n}"
        }
      }
    },
    {
      "path": "/api/dns/:domain",
      "method": "GET",
      "description": "Perform DNS lookup for a domain",
      "authentication": "None",
      "rateLimit": "None",
      "parameters": {
        "domain": "string (domain name to lookup)"
      },
      "response": {
        "type": "application/json",
        "schema": {
          "domain": "string (queried domain)",
          "records": "object (DNS record types)",
          "records.A": "array (IPv4 addresses)",
          "records.AAAA": "array (IPv6 addresses)",
          "records.MX": "array (mail exchange records)",
          "records.TXT": "array (text records)",
          "records.CNAME": "array (canonical name records)",
          "records.NS": "array (name server records)"
        },
        "example": {
          "domain": "example.com",
          "records": {
            "A": [
              "93.184.216.34"
            ],
            "AAAA": [
              "2606:2800:220:1:248:1893:25c8:1946"
            ],
            "MX": [
              "mail.example.com"
            ],
            "TXT": [
              "v=spf1 include:_spf.example.com ~all"
            ],
            "NS": [
              "ns1.example.com",
              "ns2.example.com"
            ]
          }
        }
      }
    },
    {
      "path": "/api/ping",
      "method": "POST",
      "description": "Ping a host and measure response time",
      "authentication": "None",
      "rateLimit": "5 requests per minute per IP",
      "request": {
        "type": "application/json",
        "schema": {
          "host": "string (hostname or IP address)",
          "count": "number (optional, ping count, default: 4)"
        },
        "example": {
          "host": "example.com",
          "count": 4
        }
      },
      "response": {
        "type": "application/json",
        "schema": {
          "host": "string (target host)",
          "results": "array (ping results)",
          "results[].status": "string ('success'|'timeout'|'error')",
          "results[].time": "number|null (response time in ms)",
          "results[].sequence": "number (ping sequence number)",
          "statistics": "object (summary statistics)",
          "statistics.sent": "number (packets sent)",
          "statistics.received": "number (packets received)",
          "statistics.loss": "number (packet loss percentage)",
          "statistics.min": "number|null (minimum time in ms)",
          "statistics.max": "number|null (maximum time in ms)",
          "statistics.avg": "number|null (average time in ms)"
        },
        "example": {
          "host": "example.com",
          "results": [
            {
              "status": "success",
              "time": 23.4,
              "sequence": 1
            },
            {
              "status": "success",
              "time": 24.1,
              "sequence": 2
            },
            {
              "status": "success",
              "time": 22.8,
              "sequence": 3
            },
            {
              "status": "success",
              "time": 23.7,
              "sequence": 4
            }
          ],
          "statistics": {
            "sent": 4,
            "received": 4,
            "loss": 0,
            "min": 22.8,
            "max": 24.1,
            "avg": 23.5
          }
        }
      }
    },
    {
      "path": "/api/port-check",
      "method": "POST",
      "description": "Check if a port is open on a host",
      "authentication": "None",
      "rateLimit": "10 requests per minute per IP",
      "request": {
        "type": "application/json",
        "schema": {
          "host": "string (hostname or IP address)",
          "port": "number (port number 1-65535)",
          "timeout": "number (optional, timeout in ms, default: 5000)"
        },
        "example": {
          "host": "example.com",
          "port": 443,
          "timeout": 5000
        }
      },
      "response": {
        "type": "application/json",
        "schema": {
          "host": "string (target host)",
          "port": "number (target port)",
          "open": "boolean (port status)",
          "responseTime": "number|null (connection time in ms)",
          "service": "string|null (common service name)",
          "error": "string|null (error message if failed)"
        },
        "example": {
          "host": "example.com",
          "port": 443,
          "open": true,
          "responseTime": 45.2,
          "service": "HTTPS",
          "error": null
        }
      }
    },
    {
      "path": "/api/ssl-check/:domain",
      "method": "GET",
      "description": "Check SSL/TLS certificate information",
      "authentication": "None",
      "rateLimit": "5 requests per minute per IP",
      "parameters": {
        "domain": "string (domain name to check)"
      },
      "response": {
        "type": "application/json",
        "schema": {
          "domain": "string (checked domain)",
          "valid": "boolean (certificate validity)",
          "issuer": "string (certificate issuer)",
          "validFrom": "string (ISO 8601 date)",
          "validTo": "string (ISO 8601 date)",
          "daysRemaining": "number (days until expiration)",
          "protocol": "string (TLS version)",
          "cipher": "string (cipher suite)",
          "subjectAltNames": "array (alternative domain names)",
          "error": "string|null (error message if failed)"
        },
        "example": {
          "domain": "example.com",
          "valid": true,
          "issuer": "Let's Encrypt Authority X3",
          "validFrom": "2024-01-15T00:00:00Z",
          "validTo": "2024-04-15T23:59:59Z",
          "daysRemaining": 45,
          "protocol": "TLSv1.3",
          "cipher": "TLS_AES_256_GCM_SHA384",
          "subjectAltNames": [
            "example.com",
            "www.example.com"
          ],
          "error": null
        }
      }
    },
    {
      "path": "/api/seo-analyze",
      "method": "POST",
      "description": "Analyze SEO metrics for a URL",
      "authentication": "None",
      "rateLimit": "5 requests per minute per IP",
      "request": {
        "type": "application/json",
        "schema": {
          "url": "string (URL to analyze)"
        },
        "example": {
          "url": "https://example.com"
        }
      },
      "response": {
        "type": "application/json",
        "schema": {
          "url": "string (analyzed URL)",
          "title": "string|null (page title)",
          "titleLength": "number (title character count)",
          "description": "string|null (meta description)",
          "descriptionLength": "number (description character count)",
          "headings": "object (heading counts by level)",
          "images": "number (total image count)",
          "imagesWithAlt": "number (images with alt text)",
          "links": "object (link counts)",
          "links.internal": "number (internal links)",
          "links.external": "number (external links)",
          "performance": "object (performance metrics)",
          "performance.loadTime": "number (page load time in ms)",
          "performance.size": "number (page size in bytes)",
          "score": "number (overall SEO score 0-100)",
          "recommendations": "array (improvement suggestions)"
        }
      }
    },
    {
      "path": "/api/whois/:domain",
      "method": "GET",
      "description": "Get WHOIS information for a domain",
      "authentication": "None",
      "rateLimit": "3 requests per minute per IP",
      "parameters": {
        "domain": "string (domain name to lookup)"
      },
      "response": {
        "type": "application/json",
        "schema": {
          "domain": "string (queried domain)",
          "registrar": "string|null (domain registrar)",
          "createdDate": "string|null (ISO 8601 date)",
          "expiryDate": "string|null (ISO 8601 date)",
          "updatedDate": "string|null (ISO 8601 date)",
          "nameServers": "array (name servers)",
          "status": "array (domain status codes)",
          "registrant": "object|null (registrant information)",
          "error": "string|null (error message if failed)"
        }
      }
    },
    {
      "path": "/version",
      "method": "GET",
      "description": "Get API version and build information",
      "authentication": "None",
      "rateLimit": "None",
      "response": {
        "type": "application/json",
        "schema": {
          "version": "string (semantic version)",
          "buildTime": "string (ISO 8601 build timestamp)",
          "environment": "string ('production'|'preview'|'development')"
        },
        "example": {
          "version": "2.0.0",
          "buildTime": "2025-10-19T16:00:00Z",
          "environment": "production"
        }
      }
    }
  ],
  "commonHeaders": {
    "request": {
      "Content-Type": "application/json (for POST requests)",
      "Accept": "application/json"
    },
    "response": {
      "Content-Type": "application/json",
      "Access-Control-Allow-Origin": "*",
      "Cache-Control": "public, max-age=60",
      "X-Build-Version": "2.0.0"
    }
  },
  "errorCodes": {
    "400": "Bad Request - Invalid parameters or malformed JSON",
    "404": "Not Found - Endpoint or resource not found",
    "429": "Too Many Requests - Rate limit exceeded",
    "500": "Internal Server Error - Server-side error occurred",
    "503": "Service Unavailable - Service temporarily unavailable"
  },
  "notes": [
    "All endpoints return JSON responses",
    "CORS is enabled for all origins (*)",
    "Rate limits are per IP address",
    "All timestamps are in ISO 8601 format",
    "No authentication required for any endpoint",
    "API is hosted on Cloudflare Pages with global edge network"
  ]
}