{
  "name": "M2M Playbook",
  "description": "Maid2Match internal document intelligence system. Single source of truth for all business documents — SOPs, contracts, call scripts, compliance docs, and more.",
  "version": "2.0",
  "auth": {
    "type": "bearer",
    "format": "pbk_live_<token>",
    "header": "Authorization",
    "note": "All agent endpoints require a Playbook API key. Keys are scoped (search, ask, read) and issued per-agent by a Playbook admin via the Settings page. Contact Jason Schulz to request access."
  },
  "base_url": "https://jwtphanhsrfsyraygbvg.supabase.co/functions/v1",
  "endpoints": {
    "search": {
      "url": "https://jwtphanhsrfsyraygbvg.supabase.co/functions/v1/playbook-search",
      "method": "POST",
      "scope_required": "search",
      "description": "Semantic search across all Playbook documents using vector similarity.",
      "body": {
        "query": "string (required) — natural language search query",
        "section": "string (optional) — filter by section slug e.g. 'operations', 'call-scripts'"
      },
      "response": {
        "results": "array of matching documents with id, name, section, status, similarity score",
        "agent": "name of the authenticated agent key"
      },
      "example": {
        "request": { "query": "dispatch manual staff availability", "section": "operations" },
        "response": { "results": [{ "id": "...", "name": "Dispatch Manual v3", "section": "operations", "similarity": 0.82 }], "agent": "Sam Agent" }
      }
    },
    "ask": {
      "url": "https://jwtphanhsrfsyraygbvg.supabase.co/functions/v1/playbook-ask",
      "method": "POST",
      "scope_required": "ask",
      "description": "RAG-powered Q&A. Finds relevant documents and synthesises an answer with citations.",
      "body": {
        "question": "string (required) — natural language question"
      },
      "response": {
        "answer": "string — synthesised answer from document content",
        "sources": "array of source documents used (id, name, section)"
      },
      "example": {
        "request": { "question": "What is the process for handling a customer complaint call?" },
        "response": { "answer": "According to the Complaints Call Script...", "sources": [{ "name": "Complaints Call Script", "section": "call-scripts" }] }
      }
    }
  },
  "sections": [
    "contracts", "hr-employment", "operations", "call-scripts",
    "compliance-legal", "brand-marketing", "policies-frameworks", "knowledge-base"
  ],
  "quickstart": "POST https://jwtphanhsrfsyraygbvg.supabase.co/functions/v1/playbook-search with header 'Authorization: Bearer pbk_live_<your_key>' and body {\"query\": \"your search query\"}",
  "ui_url": "https://dashboards.maid2match.com.au/playbook"
}
