Overview
The Audit endpoint analyzes a WordPress post for GEO (Generative Engine Optimization) best practices and returns a detailed report with recommendations for improvement.Endpoint Details
POST
/wp-json/geoai/v1/auditAuthentication
Requires authentication with a user account that hasedit_post capability for the specified post.
See REST API Overview for authentication methods.
Request Parameters
The ID of the WordPress post to audit. Must be a valid post ID that exists in your WordPress database.
Response
Success Response (200)
When the audit completes successfully:Always
true for successful requests.The audit results containing analysis and recommendations.
Overall GEO optimization score (0-100).
Array of identified issues and recommendations.
Unique identifier for the issue type.
Issue severity:
critical, warning, or info.Human-readable description of the issue.
Whether an automated quick fix is available.
ISO 8601 timestamp of when the audit was performed.
Error Response (500)
When the audit fails:Always
false for failed requests.Error message describing what went wrong.
Examples
cURL Example
JavaScript (Fetch API)
PHP (WordPress)
Python (Requests)
Response Example
Error Responses
Missing Required Parameter
Insufficient Permissions
Invalid Post ID
Analysis Error
Implementation Details
The audit endpoint is implemented in/home/daytona/workspace/source/includes/class-geoai-rest.php:83.
Permission Check
The endpoint verifies that the current user hasedit_post capability for the specified post before running the audit.
Audit Process
- Validates the
post_idparameter - Checks user permissions
- Calls the GEO AI analyzer to examine post content
- Returns analysis results with actionable recommendations
Post Meta
After a successful audit, the timestamp is stored in the_geoai_audit_timestamp post meta field. You can retrieve this via the WordPress REST API posts endpoint.
Best Practices
Cache Audit Results
Cache Audit Results
Audits can take a few seconds to complete. Cache the results and only re-run audits when the post content changes.
Handle Errors Gracefully
Handle Errors Gracefully
Always check the
success field in the response and handle errors appropriately. Network issues or AI service outages can occur.Rate Limiting
Rate Limiting
Avoid running audits in tight loops. If auditing multiple posts, add delays between requests.
User Permissions
User Permissions
Ensure your authenticated user has edit permissions for the post being audited to avoid 403 errors.
Related Endpoints
Quick Fix
Apply automated fixes to issues found in the audit
API Overview
Learn about authentication and common patterns