9. REST API Specification

Our Roadmap / REST API Specification

The REST API provides programmatic access to agent capabilities for both frontend and backend integrations.

9.1 Endpoints

MethodEndpointDescription
POST/wp-json/agent/v1/chatSend a message to the frontend agent
POST/wp-json/agent/v1/taskSubmit a task for backend processing
GET/wp-json/agent/v1/capabilitiesList available agent capabilities
GET/wp-json/agent/v1/statusGet agent system status
GET/wp-json/agent/v1/audit-logRetrieve audit log entries
POST/wp-json/agent/v1/approve/{id}Approve a pending action
POST/wp-json/agent/v1/reject/{id}Reject a pending action
POST/wp-json/agent/v1/rollback/{id}Rollback a previous action
GET/wp-json/agent/v1/pendingGet pending approval queue
POST/wp-json/agent/v1/personalizeRequest content personalization
DELETE/wp-json/agent/v1/memory/{user_id}Delete agent memory (GDPR)

9.2 Chat Endpoint Schema

Request

{
    "message": "Find articles about gardening from last month",
    "session_id": "abc123",
    "context": {
        "current_page": "/blog/",
        "user_authenticated": true,
        "previous_interactions": 3
    },
    "capabilities": ["search", "navigate", "explain"]
}

Response

{
    "response": "I found 5 articles about gardening from December.",
    "actions": [
        {
            "type": "display_results",
            "data": {
                "posts": [
                    {"id": 123, "title": "Winter Garden Prep", "url": "/winter-garden-prep/"},
                    {"id": 124, "title": "Indoor Herb Growing", "url": "/indoor-herbs/"}
                ]
            }
        }
    ],
    "suggestions": [
        "Would you like me to filter by a specific topic?",
        "I can also show you related videos."
    ],
    "session_id": "abc123",
    "tokens_used": 450,
    "agent_id": "frontend_search"
}

9.3 Task Endpoint Schema

Request

{
    "task": "optimize_seo",
    "target": {
        "type": "post",
        "id": 456
    },
    "parameters": {
        "focus_keyword": "winter gardening tips",
        "optimize_images": true,
        "suggest_internal_links": true
    },
    "approval_required": false
}

Response

{
    "task_id": "task_789",
    "status": "completed",
    "changes": [
        {
            "field": "meta_description",
            "old_value": "",
            "new_value": "Discover essential winter gardening tips...",
            "reasoning": "Added keyword-rich meta description"
        }
    ],
    "audit_log_id": 1001,
    "rollback_available": true
}

Related Articles

Discussion

Have thoughts on this section? Leave a comment below to join the discussion.

Leave a Comment

Your email address will not be published. Required fields are marked *