Rest API

Supercharger exposes a REST API under the namespace supercharger/v1. All endpoints require authentication using a WordPress nonce or application password with appropriate permissions.

The base URL for all endpoints is: https://yoursite.com/wp-json/supercharger/v1/

Authentication

All endpoints require the user to be logged in as an administrator. Include a WordPress REST API nonce in your request header:

X-WP-Nonce: {nonce}

Or use [WordPress Application Passwords](https://make.wordpress.org/core/2020/11/05/application-passwords-integration-guide/) for programmatic access.

Settings Endpoints

GET /settings

Returns all plugin settings fields with their current values.

Response:

json
{
  "api_provider": "openai",
  "api_openai_key": "sk-...",
  "post_types": ["post"],
 ...
}

POST /settings

Updates plugin settings. Supports partial saves — only the fields you include are updated.

Request body:

json
{
  "api_provider": "anthropic",
  "api_anthropic_key": "sk-ant-..."
}

GET /settings/export

Returns the full plugin configuration as a downloadable JSON object. Useful for backup and migration.

Module Endpoints

GET /modules

Returns a list of all registered modules with their current status and license requirements.

Response:

json
[
  {
    "slug": "ai-paragraph-highlights",
    "name": "AI Paragraph Highlights",
    "enabled": true,
    "requires_pro": false
  },
  ...
]

POST /modules/{slug}/enable

Enables or disables a module by slug.

Request body:

json
{
  "enabled": true
}

Indexing Endpoints

GET /index/stats

Returns statistics about the vector index.

Response:

json
{
  "total_indexed": 342,
  "pending": 12,
  "failed": 2
}

POST /index/post/{id}

Manually queues a specific post for (re-)indexing.

URL parameter: id — the WordPress post ID.

POST /index/run-cron

Triggers an immediate indexing cron run. Equivalent to visiting wp-cron.php but targeted at the indexing task.

Content Generation Endpoints

POST /content-generation/post/{id}

Triggers AI content generation for all active modules on the specified post.

URL parameter: id — the WordPress post ID.

This is the endpoint called by the Gutenberg sidebar’s Regenerate button.

Error Responses

All endpoints return standard WordPress REST API error responses for failures:

json
{
  "code": "rest_forbidden",
  "message": "Sorry, you are not allowed to do that.",
  "data": { "status": 403 }
}

Common error codes:

  • rest_forbidden — Not authenticated or insufficient permissions
  • supercharger_invalid_setting — A setting value failed validation
  • supercharger_provider_error — AI provider returned an error