{"openapi":"3.1.0","info":{"title":"you2you API","description":"Let your own software chat with your digital twin. Guide: https://you2you.net/developers/","version":"1"},"paths":{"/api/v1/chatrooms":{"get":{"tags":["chat rooms"],"summary":"List Chatrooms","description":"Your chat rooms, most recently active first. Pages can shift while you walk them.","operationId":"list_chatrooms_api_v1_chatrooms_get","security":[{"ApiKey":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRoomList"}}}},"401":{"description":"Bad or revoked API key"},"429":{"description":"Rate limited"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/chatrooms/{chatroom_id}/messages":{"post":{"tags":["chat rooms"],"summary":"Post Messages","description":"Add messages to a chat room, creating it if needed. The twin's reply comes by callback or GET.","operationId":"post_messages_api_v1_chatrooms__chatroom_id__messages_post","security":[{"ApiKey":[]}],"parameters":[{"name":"chatroom_id","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,200}$","description":"Your own id for the chat room. Keep it opaque: it appears in request logs.","title":"Chatroom Id"},"description":"Your own id for the chat room. Keep it opaque: it appears in request logs."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessagesRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessagesResponse"}}}},"401":{"description":"Bad or revoked API key"},"429":{"description":"Rate limited"},"409":{"description":"The twin is not ready or is deactivated"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["chat rooms"],"summary":"Get Messages","description":"The status of the latest turn and the newest messages, oldest first.","operationId":"get_messages_api_v1_chatrooms__chatroom_id__messages_get","security":[{"ApiKey":[]}],"parameters":[{"name":"chatroom_id","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,200}$","description":"Your own id for the chat room. Keep it opaque: it appears in request logs.","title":"Chatroom Id"},"description":"Your own id for the chat room. Keep it opaque: it appears in request logs."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"default":1,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessagesResponse"}}}},"401":{"description":"Bad or revoked API key"},"429":{"description":"Rate limited"},"404":{"description":"Unknown chat room"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/chatrooms/{chatroom_id}":{"delete":{"tags":["chat rooms"],"summary":"Delete Chatroom","description":"Delete a chat room. A later POST with the same id starts an empty one.","operationId":"delete_chatroom_api_v1_chatrooms__chatroom_id__delete","security":[{"ApiKey":[]}],"parameters":[{"name":"chatroom_id","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,200}$","description":"Your own id for the chat room. Keep it opaque: it appears in request logs.","title":"Chatroom Id"},"description":"Your own id for the chat room. Keep it opaque: it appears in request logs."}],"responses":{"204":{"description":"Successful Response"},"401":{"description":"Bad or revoked API key"},"429":{"description":"Rate limited"},"404":{"description":"Unknown chat room"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"ChatRoomList":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ChatRoomSummary"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"ChatRoomList"},"ChatRoomSummary":{"properties":{"chatroom_id":{"type":"string","title":"Chatroom Id"},"status":{"type":"string","enum":["pending","replied","no_reply","over_budget","paused","failed"],"title":"Status"},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail","description":"Why the turn ended without a reply, when there is a reason to give."},"message_count":{"type":"integer","title":"Message Count"},"last_message":{"anyOf":[{"$ref":"#/components/schemas/LastMessage"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["chatroom_id","status","message_count","last_message","created_at","updated_at"],"title":"ChatRoomSummary"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"InboundMessage":{"properties":{"type":{"type":"string","const":"user","title":"Type"},"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name","description":"Who said it. Each name is a different person to the twin."},"message":{"type":"string","minLength":1,"title":"Message"}},"type":"object","required":["type","name","message"],"title":"InboundMessage"},"LastMessage":{"properties":{"type":{"type":"string","enum":["user","assistant"],"title":"Type"},"name":{"type":"string","title":"Name"},"message":{"type":"string","title":"Message"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["type","name","message","created_at"],"title":"LastMessage"},"MessagesResponse":{"properties":{"status":{"type":"string","enum":["pending","replied","no_reply","over_budget","paused","failed"],"title":"Status"},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail","description":"Why the turn ended without a reply, when there is a reason to give."},"messages":{"items":{"$ref":"#/components/schemas/OutboundMessage"},"type":"array","title":"Messages","description":"The latest messages, oldest first."}},"type":"object","required":["status","messages"],"title":"MessagesResponse"},"OutboundMessage":{"properties":{"type":{"type":"string","enum":["user","assistant"],"title":"Type"},"name":{"type":"string","title":"Name"},"message":{"type":"string","title":"Message"}},"type":"object","required":["type","name","message"],"title":"OutboundMessage"},"SendMessagesRequest":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/InboundMessage"},"type":"array","maxItems":20,"minItems":1,"title":"Messages"},"callback_url":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Callback Url","description":"An https URL that receives the outcome of this turn. The latest one sent wins. A user and password in it are sent as Basic auth."}},"type":"object","required":["messages"],"title":"SendMessagesRequest"},"SendMessagesResponse":{"properties":{"status":{"type":"string","const":"pending","title":"Status"}},"type":"object","required":["status"],"title":"SendMessagesResponse"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"ApiKey":{"type":"http","description":"An API key from Settings, Your digital twin, API keys in the you2you app: `Bearer y2y_...`","scheme":"bearer"}}}}