DEV Community

roberto degani
roberto degani

Posted on

Build a Complete SEO Audit Tool in 10 Minutes with One API Call

Build a Complete SEO Audit Tool in 10 Minutes with One API Call

Introduction

If you've ever spent hours running manual SEO audits—checking meta tags, analyzing header structures, testing mobile responsiveness—you know how time-consuming it can be. What if you could automate this entire process with a single API call?

In this tutorial, I'll show you how to build a production-ready SEO audit tool in under 10 minutes using the Instant SEO Audit API. Whether you're a freelancer, agency owner, or developer building tools for clients, this will save you hundreds of hours.

Why Manual SEO Audits Are Killing Your Productivity

Traditional SEO audits require:

  • Manual checking: Opening each page, inspecting code, reviewing metadata
  • Multiple tools: Semrush, Ahrefs, Moz ($100-1000+/month)
  • Time investment: 30-60 minutes per website audit
  • Inconsistency: Human error, missed issues
  • Scaling challenges: Nearly impossible to audit multiple sites regularly

The Instant SEO Audit API changes this entirely.

What We're Building

A command-line SEO audit tool that:

  1. Takes a website URL as input
  2. Calls the Instant SEO Audit API
  3. Processes the response and extracts key metrics
  4. Generates a readable report with recommendations
  5. Exports results in JSON format

The entire application is fewer than 100 lines of code.

Step 1: Get Your API Credentials

Navigate to the Instant SEO Audit API on RapidAPI. Click "Subscribe" and select the free tier. You'll get:

  • Your API Key (found in the dashboard)
  • Your API Host (instant-seo-audit.p.rapidapi.com)

Step 2: Node.js Version

Create seo-audit.js:

const https = require('https');

const API_KEY = 'YOUR_API_KEY_HERE';
const API_HOST = 'instant-seo-audit.p.rapidapi.com';
const WEBSITE_URL = process.argv[2] || 'https://example.com';

function auditWebsite(url) {
  return new Promise((resolve, reject) => {
    const options = {
      hostname: API_HOST,
      path: `/api/audit?url=${encodeURIComponent(url)}`,
      method: 'GET',
      headers: {
        'x-rapidapi-key': API_KEY,
        'x-rapidapi-host': API_HOST
      }
    };

    const req = https.request(options, (res) => {
      let data = '';
      res.on('data', (chunk) => { data += chunk; });
      res.on('end', () => {
        try {
          resolve(JSON.parse(data));
        } catch (error) {
          reject(new Error('Failed to parse API response'));
        }
      });
    });
    req.on('error', reject);
    req.end();
  });
}

function displayResults(auditData) {
  console.log('\n========== SEO AUDIT REPORT ==========\n');

  if (auditData.overall_score)
    console.log(`Overall SEO Score: ${auditData.overall_score}/100`);

  if (auditData.page_title) {
    console.log(`\nPage Title: "${auditData.page_title.title}"`);
    console.log(`   Length: ${auditData.page_title.length} chars (Recommended: 50-60)`);
  }

  if (auditData.meta_description) {
    console.log(`\nMeta Description: "${auditData.meta_description.description}"`);
    console.log(`   Length: ${auditData.meta_description.length} chars (Recommended: 150-160)`);
  }

  if (auditData.headings) {
    console.log(`\nHeading Structure:`);
    console.log(`   H1: ${auditData.headings.h1_count} | H2: ${auditData.headings.h2_count} | H3: ${auditData.headings.h3_count}`);
  }

  if (auditData.recommendations && auditData.recommendations.length > 0) {
    console.log(`\nRecommendations (${auditData.recommendations.length}):`);
    auditData.recommendations.slice(0, 5).forEach((rec, i) => {
      console.log(`   ${i + 1}. ${rec.title} [${rec.priority}]`);
    });
  }
  console.log('\n======================================\n');
}

async function main() {
  try {
    console.log(`Auditing: ${WEBSITE_URL}...`);
    const results = await auditWebsite(WEBSITE_URL);
    displayResults(results);

    const fs = require('fs');
    const filename = `audit-${Date.now()}.json`;
    fs.writeFileSync(filename, JSON.stringify(results, null, 2));
    console.log(`Full audit exported to: ${filename}`);
  } catch (error) {
    console.error('Audit failed:', error.message);
  }
}

main();
Enter fullscreen mode Exit fullscreen mode

Run it:

node seo-audit.js https://yourwebsite.com
Enter fullscreen mode Exit fullscreen mode

Step 3: Python Version

Create seo-audit.py:

import requests
import json
import sys

API_KEY = 'YOUR_API_KEY_HERE'
API_HOST = 'instant-seo-audit.p.rapidapi.com'
WEBSITE_URL = sys.argv[1] if len(sys.argv) > 1 else 'https://example.com'

def audit_website(url):
    headers = {
        'x-rapidapi-key': API_KEY,
        'x-rapidapi-host': API_HOST
    }
    response = requests.get(
        f'https://{API_HOST}/api/audit',
        headers=headers,
        params={'url': url},
        timeout=30
    )
    response.raise_for_status()
    return response.json()

def display_results(data):
    print('\n========== SEO AUDIT REPORT ==========\n')

    if 'overall_score' in data:
        print(f"Overall SEO Score: {data['overall_score']}/100")

    if 'page_title' in data:
        t = data['page_title']
        print(f"\nPage Title: \"{t.get('title', 'N/A')}\"")
        print(f"   Length: {t.get('length', 'N/A')} chars")

    if 'meta_description' in data:
        m = data['meta_description']
        print(f"\nMeta Description: \"{m.get('description', 'N/A')}\"")
        print(f"   Length: {m.get('length', 'N/A')} chars")

    if 'headings' in data:
        h = data['headings']
        print(f"\nH1: {h.get('h1_count', 0)} | H2: {h.get('h2_count', 0)} | H3: {h.get('h3_count', 0)}")

    if 'recommendations' in data:
        recs = data['recommendations']
        print(f"\nRecommendations ({len(recs)}):")
        for i, rec in enumerate(recs[:5], 1):
            print(f"   {i}. {rec.get('title', 'N/A')} [{rec.get('priority', 'N/A')}]")

    print('\n======================================\n')

if __name__ == '__main__':
    print(f'Auditing: {WEBSITE_URL}...')
    results = audit_website(WEBSITE_URL)
    display_results(results)

    filename = f"audit-{int(__import__('time').time())}.json"
    with open(filename, 'w') as f:
        json.dump(results, f, indent=2)
    print(f'Exported to: {filename}')
Enter fullscreen mode Exit fullscreen mode

Run it:

python seo-audit.py https://yourwebsite.com
Enter fullscreen mode Exit fullscreen mode

Understanding the API Response

Metric What It Means Optimal Range
Overall Score Combined SEO health 80-100
Page Title Main ranking signal 50-60 chars
Meta Description Affects CTR 150-160 chars
H1 Count Page topic indicator Exactly 1
Mobile Friendly Mobile-first indexing Must pass
Page Speed Core Web Vital Under 3s

Advanced: Batch Auditing Multiple Sites

const sites = ['https://site1.com', 'https://site2.com', 'https://site3.com'];

async function batchAudit(websites) {
  const results = {};
  for (const site of websites) {
    console.log(`Auditing ${site}...`);
    results[site] = await auditWebsite(site);
    await new Promise(resolve => setTimeout(resolve, 1000));
  }
  return results;
}
Enter fullscreen mode Exit fullscreen mode

Real-World Workflow

  1. Client requests audit → Run node seo-audit.js https://clientsite.com
  2. Review results → Identify 5-10 critical issues
  3. Prioritize fixes → Meta → Mobile → Speed
  4. Implement changes → 1-2 hours typically
  5. Re-audit → Verify improvements
  6. Report → Share JSON export with before/after metrics

The entire process takes 20-30 minutes instead of 4-6 hours.

Getting Started

  1. Visit Instant SEO Audit API on RapidAPI
  2. Subscribe to the free tier (no credit card needed)
  3. Copy your API key
  4. Run one of the code examples
  5. Integrate into your workflow

The free tier provides plenty of requests for small-scale auditing.


Also check out our other developer APIs: Web Scraper Extractor, AI Text Analyzer, and AI Content Generator.

Top comments (0)