{ "openapi": "3.1.0", "info": { "title": "Messenger API", "version": "1.4.0" }, "paths": { "/api/v1/users": { "post": { "tags": [ "Users" ], "summary": "Register User", "operationId": "register_user_api_v1_users_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateUser" } } }, "required": true }, "responses": { "201": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/users/me": { "get": { "tags": [ "Users" ], "summary": "Get Me", "operationId": "get_me_api_v1_users_me_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } } }, "security": [ { "HTTPBearer": [ ] } ] } }, "/api/v1/auth/sessions": { "post": { "tags": [ "Authentication" ], "summary": "Create Session", "operationId": "create_session_api_v1_auth_sessions_post", "responses": { "201": { "description": "Successful Response", "content": { "application/json": { "schema": { } } } } }, "security": [ { "HTTPBasic": [ ] } ] } }, "/api/v1/auth/sessions/current": { "delete": { "tags": [ "Authentication" ], "summary": "Delete Current Session", "operationId": "delete_current_session_api_v1_auth_sessions_current_delete", "parameters": [ { "name": "authorization", "in": "header", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Authorization" } } ], "responses": { "204": { "description": "Successful Response" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/chats": { "post": { "tags": [ "Chats" ], "summary": "Create Chat", "operationId": "create_chat_api_v1_chats_post", "security": [ { "HTTPBearer": [ ] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateChat" } } } }, "responses": { "201": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Chat" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "get": { "tags": [ "Chats" ], "summary": "List Chats", "operationId": "list_chats_api_v1_chats_get", "security": [ { "HTTPBearer": [ ] } ], "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "maximum": 100, "minimum": 1, "default": 50, "title": "Limit" } }, { "name": "cursor", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Cursor" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/chats/{chat_id}": { "get": { "tags": [ "Chats" ], "summary": "Get Chat", "operationId": "get_chat_api_v1_chats__chat_id__get", "security": [ { "HTTPBearer": [ ] } ], "parameters": [ { "name": "chat_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Chat Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Chat" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/chats/{chat_id}/messages": { "post": { "tags": [ "Messages" ], "summary": "Create Message", "operationId": "create_message_api_v1_chats__chat_id__messages_post", "security": [ { "HTTPBearer": [ ] } ], "parameters": [ { "name": "chat_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Chat Id" } }, { "name": "Idempotency-Key", "in": "header", "required": true, "schema": { "type": "string", "minLength": 1, "maxLength": 128, "title": "Idempotency-Key" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateMessage" } } } }, "responses": { "201": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Message" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "get": { "tags": [ "Messages" ], "summary": "List Messages", "operationId": "list_messages_api_v1_chats__chat_id__messages_get", "security": [ { "HTTPBearer": [ ] } ], "parameters": [ { "name": "chat_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Chat Id" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "maximum": 100, "minimum": 1, "default": 50, "title": "Limit" } }, { "name": "cursor", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Cursor" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/chats/{chat_id}/attachments/presigned": { "post": { "tags": [ "Attachments" ], "summary": "Create Attachment Upload", "operationId": "create_attachment_upload_api_v1_chats__chat_id__attachments_presigned_post", "security": [ { "HTTPBearer": [ ] } ], "parameters": [ { "name": "chat_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Chat Id" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateAttachmentUpload" } } } }, "responses": { "201": { "description": "Successful Response", "content": { "application/json": { "schema": { } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/attachments/uploads/{upload_id}/complete": { "post": { "tags": [ "Attachments" ], "summary": "Complete Attachment Upload", "operationId": "complete_attachment_upload_api_v1_attachments_uploads__upload_id__complete_post", "security": [ { "HTTPBearer": [ ] } ], "parameters": [ { "name": "upload_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Upload Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/chats/{chat_id}/attachments": { "post": { "tags": [ "Attachments" ], "summary": "Upload Attachment", "operationId": "upload_attachment_api_v1_chats__chat_id__attachments_post", "security": [ { "HTTPBearer": [ ] } ], "parameters": [ { "name": "chat_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Chat Id" } }, { "name": "filename", "in": "query", "required": true, "schema": { "type": "string", "minLength": 1, "maxLength": 255, "title": "Filename" } } ], "responses": { "202": { "description": "Successful Response", "content": { "application/json": { "schema": { } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/attachments/{attachment_id}": { "get": { "tags": [ "Attachments" ], "summary": "Get Attachment", "operationId": "get_attachment_api_v1_attachments__attachment_id__get", "security": [ { "HTTPBearer": [ ] } ], "parameters": [ { "name": "attachment_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Attachment Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/attachments/{attachment_id}/content": { "get": { "tags": [ "Attachments" ], "summary": "Download Attachment", "operationId": "download_attachment_api_v1_attachments__attachment_id__content_get", "security": [ { "HTTPBearer": [ ] } ], "parameters": [ { "name": "attachment_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Attachment Id" } }, { "name": "variant", "in": "query", "required": false, "schema": { "type": "string", "default": "original", "title": "Variant" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/health/live": { "get": { "summary": "Liveness", "operationId": "liveness_health_live_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { } } } } } } }, "/health/ready": { "get": { "summary": "Readiness", "operationId": "readiness_health_ready_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { } } } } } } } }, "components": { "schemas": { "Chat": { "properties": { "id": { "type": "string", "title": "Id" }, "title": { "type": "string", "title": "Title" }, "member_ids": { "items": { "type": "string" }, "type": "array", "title": "Member Ids" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" } }, "type": "object", "required": [ "id", "title", "member_ids", "created_at" ], "title": "Chat" }, "CreateAttachmentUpload": { "properties": { "filename": { "type": "string", "maxLength": 255, "minLength": 1, "title": "Filename" }, "content_type": { "type": "string", "enum": [ "image/png", "image/jpeg" ], "title": "Content Type" }, "size_bytes": { "type": "integer", "maximum": 10485760.0, "exclusiveMinimum": 0.0, "title": "Size Bytes" }, "sha256": { "type": "string", "pattern": "^[a-fA-F0-9]{64}$", "title": "Sha256" } }, "type": "object", "required": [ "filename", "content_type", "size_bytes", "sha256" ], "title": "CreateAttachmentUpload" }, "CreateChat": { "properties": { "title": { "type": "string", "maxLength": 100, "minLength": 1, "title": "Title" }, "member_ids": { "items": { "type": "string" }, "type": "array", "maxItems": 100, "minItems": 1, "title": "Member Ids" } }, "type": "object", "required": [ "title", "member_ids" ], "title": "CreateChat" }, "CreateMessage": { "properties": { "text": { "type": "string", "maxLength": 4000, "title": "Text" }, "attachment_ids": { "items": { "type": "string" }, "type": "array", "maxItems": 10, "title": "Attachment Ids" } }, "type": "object", "required": [ "text" ], "title": "CreateMessage" }, "CreateUser": { "properties": { "username": { "type": "string", "pattern": "^[a-z0-9_]{3,32}$", "title": "Username" }, "display_name": { "type": "string", "maxLength": 100, "minLength": 1, "title": "Display Name" }, "password": { "type": "string", "maxLength": 128, "minLength": 12, "title": "Password" } }, "type": "object", "required": [ "username", "display_name", "password" ], "title": "CreateUser" }, "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "type": "array", "title": "Detail" } }, "type": "object", "title": "HTTPValidationError" }, "Message": { "properties": { "id": { "type": "string", "title": "Id" }, "chat_id": { "type": "string", "title": "Chat Id" }, "sender_id": { "type": "string", "title": "Sender Id" }, "text": { "type": "string", "title": "Text" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" }, "attachment_ids": { "items": { "type": "string" }, "type": "array", "title": "Attachment Ids" } }, "type": "object", "required": [ "id", "chat_id", "sender_id", "text", "created_at" ], "title": "Message" }, "User": { "properties": { "id": { "type": "string", "title": "Id" }, "username": { "type": "string", "title": "Username" }, "display_name": { "type": "string", "title": "Display Name" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" } }, "type": "object", "required": [ "id", "username", "display_name", "created_at" ], "title": "User" }, "ValidationError": { "properties": { "loc": { "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] }, "type": "array", "title": "Location" }, "msg": { "type": "string", "title": "Message" }, "type": { "type": "string", "title": "Error Type" } }, "type": "object", "required": [ "loc", "msg", "type" ], "title": "ValidationError" } }, "securitySchemes": { "HTTPBearer": { "type": "http", "scheme": "bearer" }, "HTTPBasic": { "type": "http", "scheme": "basic" } } } }