6. REST API Overview | SEO Forge - Rank Higher with AI-Powered SEO
Download Log in

6. REST API Overview

Developer Guide

All endpoints live under the seoforge/v1 namespace. Authentication requires the edit_posts capability. You can authenticate via cookie auth with the X-WP-Nonce header (for front-end JavaScript), or via WordPress application passwords (for external tools, CI/CD, and server-to-server calls).

Authentication

There are two primary authentication methods:

bash
# Method 1: Application passwords (recommended for external tools)
curl -u "admin:ABCD 1234 EFGH 5678 IJKL 9012" 
  https://example.com/wp-json/seoforge/v1/dashboard
php
// Method 2: Cookie + Nonce (for JavaScript running within WordPress admin)
add_action( 'admin_enqueue_scripts', function () {
    wp_enqueue_script( 'my-seo-dashboard', plugin_dir_url( __FILE__ ) . 'js/dashboard.js', [], '1.0', true );
    wp_localize_script( 'my-seo-dashboard', 'mySeoConfig', [
        'restUrl'  => rest_url( 'seoforge/v1/' ),
        'nonce'    => wp_create_nonce( 'wp_rest' ),
    ] );
} );
javascript
// JavaScript: Using nonce auth in fetch calls
async function fetchDashboard() {
    const response = await fetch( mySeoConfig.restUrl + 'dashboard', {
        headers: { 'X-WP-Nonce': mySeoConfig.nonce }
    });
    return await response.json();
}

Endpoint Summary

MethodEndpointAuthTierDescription
GET/analyze/{post_id}edit_postsFreeFull SEO analysis
GET/score/{post_id}edit_postsFreeCached score lookup
POST/meta/generateedit_postsPROAI meta generation
GET/links/suggest/{post_id}edit_postsPROInternal link suggestions
GET/schema/{post_id}edit_postsFreeJSON-LD schema
POST/schema/detect/{post_id}edit_postsPROAI schema detection
GET/dashboardedit_postsFreeSite-wide stats
POST/fix/{post_id}edit_postsPROAuto-fix SEO issue
POST/links/auto-insert/{post_id}edit_postsPROAuto-insert links
GET/ai-readiness/{post_id}edit_postsPROAEO analysis
POST/brief/generateedit_postsPROAI content brief
POST/optimize/{post_id}edit_postsPROContent optimization
POST/optimize/apply/{post_id}edit_postsPROApply optimization
GET/links/broken/{post_id}edit_postsPROBroken link check

Forge AI Assistant Online

Hi! I'm the SEO Forge AI assistant. Ask me anything about the plugin — setup, features, troubleshooting, or development.

Just now
Powered by Forge AI · Browse docs