API Documentation

REST API for Pro users to integrate bugX tools into their workflows

Pro Feature: API access requires a Pro subscription. Get your API key from the Dashboard.

Endpoints

Base URL

All API requests should be made to the following base URL:

https://bugx.in/api/v1

Authentication

All API requests require an API key passed in the X-API-Key header.

Example Request Header
X-API-Key: wot_your_api_key_here

Getting Your API Key

  1. Sign up for a Pro account
  2. Go to your Dashboard
  3. Click "Generate New Key" in the API Key section

Check URL Status

POST /api/v1/check-status

Check HTTP status codes for multiple URLs.

Request Body

Parameter Type Description
urls required array Array of URLs to check (max 100)
concurrency number Concurrent requests (default: 5)
Example Request
curl -X POST https://bugx.in/api/v1/check-status \
  -H "X-API-Key: wot_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": [
      "https://example.com",
      "https://google.com"
    ]
  }'
Example Response
{
  "success": true,
  "total": 2,
  "working": 2,
  "broken": 0,
  "results": [
    {
      "url": "https://example.com",
      "status": 200,
      "ok": true,
      "ms": 234
    }
  ]
}

Page Speed

POST /api/v1/page-speed

Measure page load times and get performance grades.

Request Body

Parameter Type Description
urls required array Array of URLs to test (max 50)
concurrency number Concurrent requests (default: 3)
Example Response
{
  "success": true,
  "total": 1,
  "avgTtfb": 245,
  "avgTotal": 892,
  "grades": { "A": 0, "B": 1, "C": 0, "D": 0, "F": 0 },
  "results": [
    {
      "url": "https://example.com",
      "ttfb": 245,
      "totalTime": 892,
      "grade": "B"
    }
  ]
}

SSL Checker

POST /api/v1/ssl-checker

Check SSL certificate validity and expiration.

Request Body

Parameter Type Description
domains required array Array of domains to check (max 50)
Example Request
{
  "domains": ["example.com", "google.com"]
}

SEO Checker

POST /api/v1/seo-checker

Analyze SEO meta tags and get optimization scores.

Request Body

Parameter Type Description
urls required array Array of URLs to analyze (max 20)

Redirect Checker

POST /api/v1/redirect-checker

Trace redirect chains and detect loops.

Request Body

Parameter Type Description
urls required array Array of URLs to check (max 50)

Security Headers

POST /api/v1/security-headers

Check security headers and get security grades.

Request Body

Parameter Type Description
urls required array Array of URLs to check (max 50)

DNS Lookup

POST /api/v1/dns-lookup

Look up DNS records for a domain including A, AAAA, MX, TXT, NS, CNAME, and SOA records.

Request Body

Parameter Type Description
domain required string Domain name to look up
types array Record types to query (default: ["A", "AAAA", "MX", "TXT", "NS", "CNAME"])
Example Request
curl -X POST https://bugx.in/api/v1/dns-lookup \
  -H "X-API-Key: wot_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "example.com",
    "types": ["A", "MX", "TXT"]
  }'
Example Response
{
  "success": true,
  "domain": "example.com",
  "records": {
    "A": ["93.184.216.34"],
    "MX": [{ "exchange": "mail.example.com", "priority": 10 }],
    "TXT": ["v=spf1 -all"]
  }
}

WHOIS Lookup

POST /api/v1/whois-lookup

Get WHOIS registration information for a domain.

Request Body

Parameter Type Description
domain required string Domain name to look up
Example Request
curl -X POST https://bugx.in/api/v1/whois-lookup \
  -H "X-API-Key: wot_your_key" \
  -H "Content-Type: application/json" \
  -d '{"domain": "example.com"}'
Example Response
{
  "success": true,
  "domain": "example.com",
  "data": {
    "domainName": "EXAMPLE.COM",
    "registrar": "RESERVED-Internet Assigned Numbers Authority",
    "creationDate": "1995-08-14T04:00:00Z",
    "expirationDate": "2024-08-13T04:00:00Z",
    "nameServers": ["A.IANA-SERVERS.NET", "B.IANA-SERVERS.NET"]
  }
}

Check Images

POST /api/v1/check-images

Check the status of image URLs to find broken images.

Request Body

Parameter Type Description
urls required string Newline or space-separated list of image URLs (max 100)
concurrency number Concurrent requests (default: 10)
Example Request
curl -X POST https://bugx.in/api/v1/check-images \
  -H "X-API-Key: wot_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": "https://example.com/img1.png\nhttps://example.com/img2.jpg"
  }'
Example Response
{
  "success": true,
  "total": 2,
  "working": 1,
  "broken": 1,
  "results": [
    { "url": "https://example.com/img1.png", "status": 200, "ok": true },
    { "url": "https://example.com/img2.jpg", "status": 404, "ok": false }
  ]
}

CORS Test

POST /api/v1/cors-test

Test CORS configuration by sending a preflight OPTIONS request.

Request Body

Parameter Type Description
url required string URL to test CORS configuration
origin string Origin header to send (default: "https://example.com")
method string Method to request (default: "GET")
Example Request
curl -X POST https://bugx.in/api/v1/cors-test \
  -H "X-API-Key: wot_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://api.example.com/data",
    "origin": "https://myapp.com",
    "method": "POST"
  }'
Example Response
{
  "success": true,
  "url": "https://api.example.com/data",
  "origin": "https://myapp.com",
  "method": "POST",
  "statusCode": 204,
  "corsEnabled": true,
  "corsHeaders": {
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Allow-Methods": "GET, POST, OPTIONS"
  }
}

Robots.txt Test

POST /api/v1/robots-test

Test if URLs are allowed or blocked by a site's robots.txt.

Request Body

Parameter Type Description
site required string Base URL of the site
urls required array Array of paths to test (max 50)
userAgent string User agent to test for (default: "*")
Example Request
curl -X POST https://bugx.in/api/v1/robots-test \
  -H "X-API-Key: wot_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "site": "https://example.com",
    "urls": ["/admin", "/public/page", "/private/data"],
    "userAgent": "Googlebot"
  }'
Example Response
{
  "success": true,
  "site": "https://example.com",
  "userAgent": "Googlebot",
  "robotsTxtFound": true,
  "results": [
    { "url": "/admin", "allowed": false, "matchedRule": "Disallow: /admin" },
    { "url": "/public/page", "allowed": true, "matchedRule": null },
    { "url": "/private/data", "allowed": false, "matchedRule": "Disallow: /private/" }
  ]
}

Sitemap Validate

POST /api/v1/sitemap-validate

Validate an XML sitemap and extract its URLs.

Request Body

Parameter Type Description
url required string URL of the sitemap to validate
Example Request
curl -X POST https://bugx.in/api/v1/sitemap-validate \
  -H "X-API-Key: wot_your_key" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/sitemap.xml"}'
Example Response
{
  "success": true,
  "url": "https://example.com/sitemap.xml",
  "valid": true,
  "type": "urlset",
  "totalUrls": 150,
  "urls": [
    { "loc": "https://example.com/", "lastmod": "2024-01-15", "priority": 1.0 },
    { "loc": "https://example.com/about", "lastmod": "2024-01-10", "priority": 0.8 }
  ]
}

Batch cURL

POST /api/v1/batch-curl

Execute multiple cURL commands in batch.

Request Body

Parameter Type Description
commands required string Newline-separated cURL commands (max 50)
concurrency number Concurrent requests (default: 5)
Example Request
curl -X POST https://bugx.in/api/v1/batch-curl \
  -H "X-API-Key: wot_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "commands": "curl https://api.example.com/users\ncurl -X POST https://api.example.com/data -d \"test=1\""
  }'
Example Response
{
  "success": true,
  "total": 2,
  "successful": 2,
  "failed": 0,
  "results": [
    { "command": "curl https://api.example.com/users", "status": 200, "success": true },
    { "command": "curl -X POST ...", "status": 201, "success": true }
  ]
}

API Tester

POST /api/v1/api-tester

Test multiple API endpoints with custom configurations.

Request Body

Parameter Type Description
endpoints required array Array of endpoint configs (max 20)
concurrency number Concurrent requests (default: 3)

Endpoint Object

Field Type Description
url string Endpoint URL
method string HTTP method (GET, POST, PUT, DELETE, etc.)
headers object Request headers
body any Request body
expectedStatus number Expected status code
Example Request
curl -X POST https://bugx.in/api/v1/api-tester \
  -H "X-API-Key: wot_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "endpoints": [
      { "url": "https://api.example.com/users", "method": "GET", "expectedStatus": 200 },
      { "url": "https://api.example.com/health", "method": "GET", "expectedStatus": 200 }
    ]
  }'
Example Response
{
  "success": true,
  "total": 2,
  "passed": 2,
  "failed": 0,
  "results": [
    { "url": "https://api.example.com/users", "status": 200, "passed": true, "ms": 145 },
    { "url": "https://api.example.com/health", "status": 200, "passed": true, "ms": 52 }
  ]
}

DB Procedure Compare

POST /api/v1/db-proc-compare

Compare stored procedures between two MySQL databases.

Request Body

Parameter Type Description
db1 required object First database connection config
db2 required object Second database connection config

Database Config Object

Field Type Description
host string Database host
port number Database port (default: 3306)
user string Database username
password string Database password
database string Database name
Example Request
curl -X POST https://bugx.in/api/v1/db-proc-compare \
  -H "X-API-Key: wot_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "db1": { "host": "dev.db.example.com", "user": "admin", "password": "***", "database": "myapp" },
    "db2": { "host": "prod.db.example.com", "user": "admin", "password": "***", "database": "myapp" }
  }'
Example Response
{
  "success": true,
  "summary": { "total": 25, "identical": 20, "different": 3, "onlyInDb1": 1, "onlyInDb2": 1 },
  "comparison": [
    { "name": "sp_get_users", "status": "identical" },
    { "name": "sp_update_order", "status": "different", "differences": ["Parameter count differs"] }
  ]
}

DB Table Compare

POST /api/v1/db-table-compare

Compare table structures between two MySQL databases.

Request Body

Parameter Type Description
db1 required object First database connection config (same as db-proc-compare)
db2 required object Second database connection config
Example Request
curl -X POST https://bugx.in/api/v1/db-table-compare \
  -H "X-API-Key: wot_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "db1": { "host": "dev.db.example.com", "user": "admin", "password": "***", "database": "myapp" },
    "db2": { "host": "prod.db.example.com", "user": "admin", "password": "***", "database": "myapp" }
  }'
Example Response
{
  "success": true,
  "summary": { "total": 42, "identical": 38, "different": 2, "onlyInDb1": 1, "onlyInDb2": 1 },
  "comparison": [
    { "name": "users", "status": "identical" },
    { "name": "orders", "status": "different", "differences": ["Column 'discount' type differs"] }
  ]
}

Text to SQL

POST /api/v1/text-to-sql

Generate SQL queries from natural language questions using AI.

Request Body

Parameter Type Description
question required string Natural language question about your data
db required object Database connection config (same as db-proc-compare)
execute boolean Execute the generated SQL (default: false)
Example Request
curl -X POST https://bugx.in/api/v1/text-to-sql \
  -H "X-API-Key: wot_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "question": "How many orders were placed last month?",
    "db": { "host": "db.example.com", "user": "admin", "password": "***", "database": "myapp" },
    "execute": true
  }'
Example Response
{
  "success": true,
  "question": "How many orders were placed last month?",
  "sql": "SELECT COUNT(*) as order_count FROM orders WHERE created_at >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH)",
  "executed": true,
  "data": [{ "order_count": 1547 }],
  "rowCount": 1
}

Usage Stats

GET /api/v1/usage

Get your API usage statistics including today's usage, historical data, and plan details.

Example Request
curl https://bugx.in/api/v1/usage \
  -H "X-API-Key: wot_your_key"
Example Response
{
  "today": {
    "used": 42,
    "limit": null,
    "remaining": null,
    "byTool": {
      "check-status": 15,
      "ssl-checker": 12,
      "page-speed": 10,
      "seo-checker": 5
    }
  },
  "history": [
    { "date": "2025-01-28", "count": 38 },
    { "date": "2025-01-27", "count": 56 }
  ],
  "plan": "pro",
  "isPro": true,
  "isStarter": false
}

Response Fields

Field Type Description
today.used number Number of API calls made today
today.limit number | null Daily limit (null for unlimited Pro users)
today.remaining number | null Remaining calls today (null for unlimited)
today.byTool object Breakdown of usage by tool name
history array Last 7 days of usage history
plan string Current plan: "free", "starter", or "pro"

Rate Limits

Pro users have unlimited API calls. However, each endpoint has limits on batch size:

Error Handling

Errors are returned with appropriate HTTP status codes:

Error Response Format
{
  "error": "Description of the error"
}