🚀 We're live on Product Hunt! Support us with a vote → 👍 Upvote AIWU
+ get
PRODUCTHUNTERS
for 45% OFF 🎉
REST API Quick Start: Your First AIWU API Call - AIWU – AI Plugin for WordPress
Table of Contents
< All Topics

REST API Quick Start: Your First AIWU API Call

After this setup, you’ll be making your first API call to AIWU — sending a message and receiving an AI response in JSON format. This is the starting point for all AIWU developer integrations.

In this article: Authentication · Your First API Call · Core Endpoints · Error Codes · Common Issues

💡 Reader level: This guide assumes you’re comfortable with REST APIs and HTTP requests. If you’re not a developer, you may want the Workflow Builder instead — it gives you automation without code.

Before You Start

You’ll need:

  • AIWU plugin v4.9+ installed on WordPress
  • An AI provider API key configured in AIWU (choose a provider)
  • Your WordPress site URL (e.g., https://yoursite.com)
  • A REST API tool (Postman, curl, or your preferred HTTP client)
  • Time needed: ~10 minutes

Step 1: Get Your API Key

Go to WordPress Admin → AI Copilot → Settings → API → Developer Access.

Click Generate API Key. Copy the key — it looks like aiwu_live_xxxxxxxxxxxxxxxxxxxx.

⚠️ Keep this key private. Anyone with this key can make API calls to your site. Don’t commit it to version control. Use environment variables.

All API requests must include this header:

X-AIWU-Key: aiwu_live_xxxxxxxxxxxxxxxxxxxx

Step 2: Make Your First API Call

Send a message to any AIWU chatbot

POST https://yoursite.com/wp-json/aiwu/v1/chat

Headers:
  Content-Type: application/json
  X-AIWU-Key: aiwu_live_xxxxxxxxxxxxxxxxxxxx

Body:
{
  "chatbot_id": 1,
  "message": "What services do you offer?",
  "session_id": "user-session-abc123"
}

Response:

{
  "success": true,
  "data": {
    "message": "We offer web design, SEO, and content marketing services...",
    "session_id": "user-session-abc123",
    "tokens_used": 87,
    "model": "gpt-4o-mini"
  }
}

Quick test with curl

curl -X POST https://yoursite.com/wp-json/aiwu/v1/chat 
  -H "Content-Type: application/json" 
  -H "X-AIWU-Key: aiwu_live_xxxxxxxxxxxxxxxxxxxx" 
  -d '{"chatbot_id": 1, "message": "Hello", "session_id": "test-123"}'

You should get a JSON response with the AI’s reply.

Core Endpoints Reference

Chat API

Endpoint Method Description
/wp-json/aiwu/v1/chat POST Send a message to a chatbot
/wp-json/aiwu/v1/chat/history GET Get conversation history by session ID
/wp-json/aiwu/v1/chatbots GET List all available chatbots

Content Generation API

Endpoint Method Description
/wp-json/aiwu/v1/generate POST Generate text with a custom prompt
/wp-json/aiwu/v1/generate/article POST Generate and create a full WordPress post

Training / Search API

Endpoint Method Description
/wp-json/aiwu/v1/search POST Search the trained knowledge base
/wp-json/aiwu/v1/training/status GET Check training/indexing status

Workflow API

Endpoint Method Description
/wp-json/aiwu/v1/workflows/{id}/trigger POST Trigger a workflow programmatically
/wp-json/aiwu/v1/workflows/{id}/status GET Get workflow execution status

Full API reference with all parameters: AIWU Developer API Reference.

Chat Request Parameters

Parameter Type Required Description
chatbot_id integer ✅ Yes ID of the chatbot to use (get from /chatbots endpoint)
message string ✅ Yes The user’s message
session_id string ✅ Yes Unique ID for this conversation thread. Generate per user/session.
context string No Additional context to inject (e.g., current page URL, user data)
stream boolean No Set true for streaming response (SSE)

Error Codes

HTTP Status Code Meaning Fix
401 unauthorized Invalid or missing API key Check X-AIWU-Key header
400 missing_param Required parameter missing Check request body
404 chatbot_not_found Invalid chatbot_id Use /chatbots to list valid IDs
429 rate_limited Too many requests Add delay between calls; default limit: 60 req/min
500 ai_provider_error Upstream AI provider failed Check your provider API key in AIWU settings

Common Issues

Problem: Getting 401 Unauthorized.
Fix: Make sure the header is exactly X-AIWU-Key (not Authorization). Copy-paste your key without extra spaces.

Problem: Getting “chatbot_not_found” even though the chatbot exists.
Fix: Use the GET /chatbots endpoint to get the correct numeric ID. The chatbot’s ID in the URL (e.g., /edit?id=5) matches what the API expects.

Problem: Getting HTML instead of JSON.
Fix: Make sure you’re sending to /wp-json/aiwu/v1/... (not /wp-admin/...). Also verify that WordPress REST API is not disabled — some security plugins block it.

Still stuck? Check the full developer API reference or troubleshooting guide.

What’s Next

Last verified: AIWU v.4.9.2 · Updated: 2026-02-25

Scroll to Top