REST API
The Aimogen Pro REST endpoints for text, images, embeddings, models and assistants, plus the rules and webhook routes, with authentication and examples.
Aimogen Pro can expose its AI functionality over REST, so external systems can generate content through your WordPress site.
Settings › REST API
This tutorial was recorded before Aiomatic was renamed to Aimogen Pro. Some labels or interface elements may differ slightly from the current version.
Enabling#
| Setting | What it does |
|---|---|
Enable Aimogen REST API Feature | Registers the routes. Off by default |
API Key List | Private keys, one per line. Passed as ?apikey=YOURKEY |
Bearer Token List | Bearer tokens, one per line |
Endpoints#
All under https://example.com/wp-json/. All accept GET and POST.
aiomatic/v1/text#
curl "https://example.com/wp-json/aiomatic/v1/text?apikey=YOUR_API_KEY&prompt=Write+a+haiku+about+WordPress&model=gpt-5-mini"curl -X POST "https://example.com/wp-json/aiomatic/v1/text" \
-H "Content-Type: application/json" \
-d '{"apikey":"YOUR_API_KEY","prompt":"Write a haiku about WordPress","model":"gpt-5-mini"}'{
"success": true,
"data": "Generated text based on the provided prompt...",
"input_tokens": "Input token count (numeric)",
"output_tokens": "Output token count (numeric)"
}aiomatic/v1/image#
curl -X POST "https://example.com/wp-json/aiomatic/v1/image" \
-H "Content-Type: application/json" \
-d '{"apikey":"YOUR_API_KEY","prompt":"Generate an image of a sunset","model":"gpt-image-2"}'{ "success": true, "image_url": "http://example.com/generated_image.jpg" }aiomatic/v1/embeddings#
curl -X POST "https://example.com/wp-json/aiomatic/v1/embeddings" \
-H "Content-Type: application/json" \
-d '{"apikey":"YOUR_API_KEY","prompt":"Generate an embedding for this text","model":"text-embedding-3-small"}'{ "success": true, "embedding": [ ] }aiomatic/v1/models#
curl "https://example.com/wp-json/aiomatic/v1/models?apikey=YOUR_API_KEY"{ "success": true, "models": [ "gpt-5-mini", "gpt-4-turbo" ] }aiomatic/v1/assistants#
curl "https://example.com/wp-json/aiomatic/v1/assistants?apikey=YOUR_API_KEY"{
"success": true,
"assistants": { "Assistant ID 1": "Assistant Name 1", "Assistant ID 2": "Assistant Name 2" }
}Errors#
{ "success": false, "error": "You need to specify an API key for this request" }Errors are returned as HTTP 200 with success: false, not as HTTP error statuses. Check the success
field.
Other registered routes#
Two more routes exist, registered independently of the REST API setting:
| Route | Purpose | Permission |
|---|---|---|
aiomatic/v1/rules | Run a bulk rule or workflow. See Webhooks | Key check |
omniblock/v1/webhook | The OmniBlock webhook listener | Key check, and the feature must be enabled |
aiomatic/v1/chart-image | Renders a chart as an image | Public by design |
Security#
Use a long random key. Treat it as a password. Rotate it if it leaks.
Use HTTPS. The key travels in the query string on GET requests and appears in server logs. Prefer POST with a bearer token.
Set usage limits. REST requests consume the same API budget as everything else.
Turn the feature off when unused. The routes are not registered at all when the setting is off.
Restrict at the edge if you can — a firewall rule allowing only your integration server to reach
/wp-json/aiomatic/* is stronger than any application-level check.
Limits and filters apply#
REST requests go through the same pipeline: usage limits, aiomatic_ai_allowed, prompt and reply filters,
Reliability Mode and usage logging. Requests appear in System & Logs › Usage Logs with their
environment label.
When to use REST instead of the PHP API#
REST when the caller is outside WordPress — another server, a mobile app, an automation platform.
PHP API when the caller is PHP inside the same WordPress installation. It avoids an HTTP round trip and needs no key.
Common problems#
404 on every route. The feature is off, or permalinks need flushing.
"You need to specify an API key". Missing or wrong apikey.
403 from a firewall. A WAF is blocking /wp-json/. See
Plugin and server conflicts.
Works with GET, fails with POST. Check the Content-Type: application/json header.
Related#
Still stuck? Open a support ticket and include the diagnostics from Aimogen Pro › System & Logs › System Info.