API Documentation

Interactive reference for all internal and external Order Review APIs. Test endpoints directly from your browser.

External: Safe for third-party integrations
Internal: For internal use only

Quick Start

Generate Recommendations

POST to /api/generate-prompt with a PO item to get top-3 agent recommendations.

curl -X POST http://localhost:3000/api/generate-prompt   -H "Content-Type: application/json"   -d '{"poId": 123, "asin": "B0..."}'

Check Benchmarks

GET /api/benchmarks/summary for the current dashboard metrics.

curl http://localhost:3000/api/benchmarks/summary

Rank Agents

GET /api/agents/rank to see agent scores and breakdown.

curl "http://localhost:3000/api/agents/rank?asin=B0...&poId=123"

Record Overrides

POST to /api/agents/decisions/[id]/override when buyer acts on recommendation.

curl -X POST http://localhost:3000/api/agents/decisions/abc123/override   -H "Content-Type: application/json"   -d '{"humanAction": "accepted", "msToDecide": 5000, "createdBy": "user123"}'

API Endpoints Reference

EndpointMethodCategoryTypeDescription
/api/generate-promptPOSTAgentsExternalGenerate top-3 agent recommendations
/api/agents/rankGETAgentsExternalRank agents with score breakdown
/api/agents/decisions/[id]/overridePOSTDecisionsInternalCapture human override decisions
/api/agents/decisions/blind-capturePOSTDecisionsInternalRecord blind-mode buyer decisions
/api/benchmarks/summaryGETBenchmarksInternalRetrieve agent performance metrics
/api/db/agentsGETDatabaseInternalList all available agents
/api/db/rulesGETDatabaseInternalList all decision rules

Endpoint Details

🎯 External: Agent Recommendations

/api/generate-prompt and /api/agents/rank are designed for external integrations. They can be safely exposed to third-party systems, partners, and client applications without security concerns.

📊 Internal: Decision Tracking

/api/agents/decisions/* endpoints capture internal decision data. These should only be called by Tampermonkey and internal dashboards, not exposed to external parties.

📈 Internal: Benchmarks & Database

/api/benchmarks/summary and /api/db/* endpoints are for internal dashboards and Tampermonkey only. Do not expose these to external systems as they contain sensitive performance data.

Security & Integration Guidelines

External APIs

  • ✅ Safe for third-party integrations
  • ✅ Can be published in API marketplaces
  • ✅ Suitable for public documentation
  • ✅ No sensitive internal data exposed
  • Examples: /api/generate-prompt, /api/agents/rank

Internal APIs

  • 🔒 For internal use only
  • 🔒 Contains sensitive performance data
  • 🔒 Should be behind authentication
  • 🔒 Not for public exposure
  • Examples: /api/agents/decisions/*, /api/benchmarks/*, /api/db/*

Legend:

External: Safe for third-party systems and public integration

Internal: For internal dashboards and Tampermonkey only

Order Review API • Last updated 6/12/2026