{"data":{"name":"MyPhoneGenie API","version":"v1","base_url":"https://myphonegenie.com/api/v1","authentication":{"type":"API Key","header":"X-API-Key","query_param":"api_key","format":"mpg_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","note":"Create API keys in your dashboard under Settings > API Keys"},"rate_limit":{"requests_per_minute":100,"headers":["X-RateLimit-Remaining","X-RateLimit-Reset"],"exceeded_status":429},"scopes":{"read":"Read messages, calls, usage, KB, settings, and status","write":"Add/update/delete KB entries, update settings, create callbacks","webhooks":"Register and manage webhook subscriptions","calendar":"Reserved for future calendar integrations"},"endpoints":[{"method":"GET","path":"/api/v1/messages","scope":"read","description":"Get recent messages and intakes","query":{"limit":"number (default 50, max 200)","since":"ISO date string"},"response":{"data":"[{ id, question, answer, channel, created_at, ... }]"}},{"method":"GET","path":"/api/v1/calls","scope":"read","description":"Get call log","query":{"limit":"number (default 50, max 200)","since":"ISO date string"},"response":{"data":"[{ id, question, answer, channel, response_time_ms, created_at, ... }]"}},{"method":"GET","path":"/api/v1/usage","scope":"read","description":"Get current billing period usage stats","response":{"data":"{ voice_minutes_used, chats_used, calls_count, voice_minutes_included, ... }"}},{"method":"GET","path":"/api/v1/kb","scope":"read","description":"Get knowledge base entries","response":{"data":"{ client_id, entries: [{ question, answer, category }] }"}},{"method":"GET","path":"/api/v1/settings","scope":"read","description":"Get client settings (no sensitive fields)","response":{"data":"{ voice, greeting, personality, widget_color, ... }"}},{"method":"GET","path":"/api/v1/status","scope":"read","description":"Get agent status, phone number, and plan","response":{"data":"{ active, phone_number, plan, business_name, status }"}},{"method":"POST","path":"/api/v1/kb/entries","scope":"write","description":"Add a knowledge base entry","body":{"question":"string (required)","answer":"string (required)","category":"string (optional)"},"response":{"data":"{ id, question, answer, category, created_at }"}},{"method":"PUT","path":"/api/v1/kb/entries/:id","scope":"write","description":"Update a knowledge base entry","body":{"question":"string","answer":"string","category":"string"},"response":{"data":"{ id, question, answer, category, updated_at }"}},{"method":"DELETE","path":"/api/v1/kb/entries/:id","scope":"write","description":"Delete a knowledge base entry","response":{"data":"{ deleted: true, id }"}},{"method":"PUT","path":"/api/v1/settings","scope":"write","description":"Update settings (limited fields)","body":{"greeting":"string","personality":"string","voice":"string","widget_color":"string"},"response":{"data":"{ voice, greeting, personality, widget_color, ... }"}},{"method":"POST","path":"/api/v1/callbacks","scope":"write","description":"Create a callback request","body":{"name":"string (required)","phone":"string (required)","reason":"string","priority":"\"normal\" or \"urgent\""},"response":{"data":"{ id, caller_name, caller_phone, position, status, ... }"}},{"method":"POST","path":"/api/v1/webhooks","scope":"webhooks","description":"Register a webhook","body":{"url":"string (required)","events":"string[] (required)"},"note":"Valid events: call.completed, message.received, kb.gap, usage.threshold","response":{"data":"{ id, url, events, status, created_at }"}},{"method":"GET","path":"/api/v1/webhooks","scope":"webhooks","description":"List registered webhooks","response":{"data":"[{ id, url, events, status, created_at }]"}},{"method":"DELETE","path":"/api/v1/webhooks/:id","scope":"webhooks","description":"Delete a webhook","response":{"data":"{ deleted: true, id }"}}],"webhook_signatures":{"header":"X-MPG-Signature","algorithm":"HMAC-SHA256","note":"Signature is computed over the raw JSON body using the API key hash as the HMAC secret."},"errors":{"format":"{ error: \"message\" }","codes":{"400":"Bad request — missing or invalid parameters","401":"Unauthorized — invalid or missing API key","403":"Forbidden — insufficient scopes","404":"Not found","429":"Rate limit exceeded (includes Retry-After header)","500":"Internal server error"}}}}