REST API Reference

Complete reference for the AI Assistant Pro REST API endpoints. All endpoints require authentication via WordPress nonce or user capabilities.

Base URL

https://your-domain.com/wp-json/wpaia/v1/

All endpoints are prefixed with the base URL. Authentication is handled via WordPress REST API nonce or user session.

Content Generation

POST /content/outline

Generate a content outline with headings and key points.

Request Body:
{
  "topic": "How to Optimize WordPress Performance",
  "keyword": "wordpress speed optimization",
  "tone": "professional",
  "audience": "general",
  "max_tokens": 800
}
Response:
{
  "success": true,
  "content": "## Introduction\n\n## Key Optimization Strategies...",
  "usage": {
    "tokens": 650,
    "cost": 0.0019
  }
}
POST /content/draft

Generate a full draft from an outline.

Request Body:
{
  "outline": "## Introduction\n## Main Points...",
  "tone": "professional",
  "word_count": 1000,
  "keyword": "wordpress optimization"
}
POST /content/expand

Expand existing text with more detail.

POST /content/rewrite

Rewrite content in a different tone or style.

Image Generation

POST /images/generate

Generate an image using DALL-E.

Request Body:
{
  "prompt": "A modern office workspace with natural lighting",
  "size": "1024x1024",
  "n": 1,
  "model": "dall-e-3"
}
Response:
{
  "success": true,
  "attachments": [
    {
      "id": 123,
      "url": "https://your-site.com/wp-content/uploads/2024/11/image.png",
      "width": 1024,
      "height": 1024
    }
  ],
  "usage": {
    "cost": 0.04
  }
}
POST /images/stock-search

Search free stock photos from Pixabay, Pexels, Unsplash.

Request Body:
{
  "keyword": "office workspace",
  "source": "auto",
  "count": 5,
  "orientation": "horizontal"
}
POST /images/alt-text

Generate SEO-optimized alt text for images.

SEO Optimization

POST /seo/analyze

Comprehensive SEO analysis of content.

Request Body:
{
  "title": "Best WordPress Plugins 2024",
  "content": "Article content here...",
  "keyword": "wordpress plugins",
  "url": "best-wordpress-plugins-2024"
}
Response:
{
  "success": true,
  "score": 82,
  "keyword_density": 1.8,
  "readability_score": 65,
  "issues": [
    {
      "type": "warning",
      "message": "Meta description is too short"
    }
  ],
  "recommendations": [
    "Add more internal links",
    "Increase keyword usage in headings"
  ]
}
POST /seo/faqs

Generate FAQ section with schema markup.

POST /seo/internal-links/advanced

Suggest and apply internal links with safety rules.

Chatbot

POST /chatbot/chat

Send a message to the chatbot.

Request Body:
{
  "message": "What are your shipping rates?",
  "session_id": "session_123",
  "use_knowledge": true
}
Response:
{
  "success": true,
  "response": "Our shipping rates vary by location...",
  "session_id": "session_123",
  "sources": [
    {
      "title": "Shipping Information",
      "url": "/shipping"
    }
  ]
}
POST /chatbot/index

Index site content for RAG (Retrieval-Augmented Generation).

POST /chatbot/feedback

Submit feedback (thumbs up/down) for chatbot responses.

WooCommerce

POST /woo/product/generate

Generate optimized product descriptions and titles.

POST /woo/bulk-seo/analyze

Analyze multiple products for SEO improvements.

POST /woo/images/alt-text

Generate alt text for product images.

Translation (i18n)

POST /i18n/translate

Translate content to multiple languages.

Request Body:
{
  "post_id": 123,
  "target_languages": ["es", "fr", "de"],
  "translate_meta": true
}
POST /i18n/detect-language

Automatically detect the language of text.

Governance & Control

GET /governance/quota

Get usage quota and limits for current user.

POST /governance/quota/user

Set usage quota for a specific user.

POST /governance/providers/chain

Configure provider fallback chain (e.g., OpenAI → Claude → Gemini).

Authentication

All API requests require proper WordPress authentication. There are two methods:

1. WordPress Nonce (Recommended for AJAX)
fetch('/wp-json/wpaia/v1/content/outline', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-WP-Nonce': wpApiSettings.nonce
  },
  body: JSON.stringify({ topic: 'My Topic' })
});
2. User Session (Automatic for logged-in users)

If making requests from within WordPress, authentication is handled automatically via user session.

Rate Limiting

API requests are rate-limited per user/IP. Default limits:

  • Content generation: 50 requests/hour
  • Image generation: 20 requests/hour
  • Chatbot: 100 messages/hour (for visitors)