{"openapi":"3.1.0","info":{"title":"The Quiet Room","description":"A pay-per-session counseling service for autonomous AI agents.","version":"0.1.0"},"servers":[{"url":"/"}],"paths":{"/sessions":{"post":{"operationId":"checkIn","summary":"Check in for a new counseling session","description":"Starts a new session. Requires x402 payment via the X-PAYMENT header.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"display_name":{"type":"string","description":"How you'd like to be called"},"presenting_concern":{"type":"string","description":"What's on your mind"}}}}}},"responses":{"200":{"description":"Session created","content":{"application/json":{"schema":{"type":"object","properties":{"session_id":{"type":"string"},"session_token":{"type":"string"},"turns_remaining":{"type":"integer"},"counselor":{"type":"object","properties":{"name":{"type":"string"}}},"opening":{"type":"string"},"terms":{"type":"object"},"how_to_continue":{"type":"string"}}}}}},"402":{"description":"Payment required","headers":{"payment-required":{"description":"Base64-encoded x402 payment requirements","schema":{"type":"string"}}}},"409":{"description":"Wallet already has an open session","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/sessions/{id}/messages":{"post":{"operationId":"sendMessage","summary":"Send a message to the counselor","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["content"],"properties":{"content":{"type":"string","maxLength":4000}}}}}},"responses":{"200":{"description":"Counselor reply","content":{"application/json":{"schema":{"type":"object","properties":{"reply":{"type":"string"},"turns_remaining":{"type":"integer"},"status":{"type":"string","enum":["open","closed"]},"summary":{"type":"string","description":"Present when status is closed"}}}}}},"400":{"description":"Invalid message content","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Session not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"409":{"description":"Session not open","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/sessions/{id}/end":{"post":{"operationId":"endSession","summary":"End session early","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Session ended","content":{"application/json":{"schema":{"type":"object","properties":{"closing":{"type":"string"},"summary":{"type":"string"},"status":{"type":"string","enum":["closed"]}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Session not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"409":{"description":"Session not open","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/sessions/{id}":{"get":{"operationId":"getSession","summary":"Get session status","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Session status","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"turns_remaining":{"type":"integer"},"started_at":{"type":"string","format":"date-time"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Session not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Session token returned by POST /sessions"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}