openapi: 3.1.0 info: title: HEVN 2FA Chat API description: Backend API for HEVN mobile neobank version: 0.1.2 servers: - url: https://api.hevn.finance description: Production tags: - name: Chat paths: /api/v1/chat/{chat_type}: post: tags: - Chat summary: Create or get a chat description: 'Get or create the internal chat of the given type for the current user. Optionally sends the first message.' operationId: create_chat_api_v1_chat__chat_type__post security: - HTTPBearer: [] parameters: - name: chat_type in: path required: true schema: $ref: '#/components/schemas/UserChatType' - name: x-api-key in: header required: false schema: anyOf: - type: string - type: 'null' title: X-Api-Key requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ChatCreateRequest' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/app__schemas__routers__user__user__ChatResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /api/v1/chat/{chat_type}/messages: get: tags: - Chat summary: Get chat messages description: Return all messages in the chat. operationId: get_chat_messages_api_v1_chat__chat_type__messages_get security: - HTTPBearer: [] parameters: - name: chat_type in: path required: true schema: $ref: '#/components/schemas/UserChatType' - name: limit in: query required: false schema: type: integer maximum: 1000 minimum: 1 default: 500 title: Limit - name: x-api-key in: header required: false schema: anyOf: - type: string - type: 'null' title: X-Api-Key responses: '200': description: Successful Response content: application/json: schema: type: array items: $ref: '#/components/schemas/ChatMessageResponse' title: Response Get Chat Messages Api V1 Chat Chat Type Messages Get '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' post: tags: - Chat summary: Send a chat message description: Send a message in the chat. operationId: send_chat_message_api_v1_chat__chat_type__messages_post security: - HTTPBearer: [] parameters: - name: chat_type in: path required: true schema: $ref: '#/components/schemas/UserChatType' - name: x-api-key in: header required: false schema: anyOf: - type: string - type: 'null' title: X-Api-Key requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ChatMessageRequest' responses: '201': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/ChatMessageResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /api/v1/chat/{chat_type}/read: post: tags: - Chat summary: Mark chat as read by the user operationId: mark_chat_read_api_v1_chat__chat_type__read_post security: - HTTPBearer: [] parameters: - name: chat_type in: path required: true schema: $ref: '#/components/schemas/UserChatType' - name: x-api-key in: header required: false schema: anyOf: - type: string - type: 'null' title: X-Api-Key responses: '204': description: Successful Response '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /api/v1/chat/{chat_type}/stream: get: tags: - Chat summary: SSE stream for chat messages description: Server-Sent Events stream for real-time chat messages. operationId: stream_chat_api_v1_chat__chat_type__stream_get security: - HTTPBearer: [] parameters: - name: chat_type in: path required: true schema: $ref: '#/components/schemas/UserChatType' - name: x-api-key in: header required: false schema: anyOf: - type: string - type: 'null' title: X-Api-Key responses: '200': description: Successful Response content: application/json: schema: {} '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /api/v1/user/chat/{chat_type}: post: tags: - Chat summary: Create or get a chat description: 'Get or create the internal chat of the given type for the current user. Optionally sends the first message.' operationId: create_chat_package_alias_api_v1_user_chat__chat_type__post security: - HTTPBearer: [] parameters: - name: chat_type in: path required: true schema: $ref: '#/components/schemas/UserChatType' - name: x-api-key in: header required: false schema: anyOf: - type: string - type: 'null' title: X-Api-Key requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ChatCreateRequest' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/app__schemas__routers__user__user__ChatResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /api/v1/user/chat/{chat_type}/messages: get: tags: - Chat summary: Get chat messages description: Return all messages in the chat. operationId: get_chat_messages_package_alias_api_v1_user_chat__chat_type__messages_get security: - HTTPBearer: [] parameters: - name: chat_type in: path required: true schema: $ref: '#/components/schemas/UserChatType' - name: limit in: query required: false schema: type: integer maximum: 1000 minimum: 1 default: 500 title: Limit - name: x-api-key in: header required: false schema: anyOf: - type: string - type: 'null' title: X-Api-Key responses: '200': description: Successful Response content: application/json: schema: type: array items: $ref: '#/components/schemas/ChatMessageResponse' title: Response Get Chat Messages Package Alias Api V1 User Chat Chat Type Messages Get '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' post: tags: - Chat summary: Send a chat message description: Send a message in the chat. operationId: send_chat_message_package_alias_api_v1_user_chat__chat_type__messages_post security: - HTTPBearer: [] parameters: - name: chat_type in: path required: true schema: $ref: '#/components/schemas/UserChatType' - name: x-api-key in: header required: false schema: anyOf: - type: string - type: 'null' title: X-Api-Key requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ChatMessageRequest' responses: '201': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/ChatMessageResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /api/v1/user/chat/{chat_type}/read: post: tags: - Chat summary: Mark chat as read by the user operationId: mark_chat_read_package_alias_api_v1_user_chat__chat_type__read_post security: - HTTPBearer: [] parameters: - name: chat_type in: path required: true schema: $ref: '#/components/schemas/UserChatType' - name: x-api-key in: header required: false schema: anyOf: - type: string - type: 'null' title: X-Api-Key responses: '204': description: Successful Response '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /api/v1/user/chat/{chat_type}/stream: get: tags: - Chat summary: SSE stream for chat messages description: Server-Sent Events stream for real-time chat messages. operationId: stream_chat_package_alias_api_v1_user_chat__chat_type__stream_get security: - HTTPBearer: [] parameters: - name: chat_type in: path required: true schema: $ref: '#/components/schemas/UserChatType' - name: x-api-key in: header required: false schema: anyOf: - type: string - type: 'null' title: X-Api-Key responses: '200': description: Successful Response content: application/json: schema: {} '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' components: schemas: UserChatType: type: string enum: - support - compliance title: UserChatType description: Chat types exposed to end users (subset of db.ChatType). 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 ChatMessageResponse: properties: id: type: string format: uuid title: Id role: type: string title: Role senderName: anyOf: - type: string - type: 'null' title: Sendername avatarUrl: anyOf: - type: string - type: 'null' title: Avatarurl text: type: string title: Text documentIds: items: type: string type: array title: Documentids createdAt: type: string format: date-time title: Createdat type: object required: - id - role - text - createdAt title: ChatMessageResponse description: Single message in a chat. app__schemas__routers__user__user__ChatResponse: properties: id: type: string format: uuid title: Id lastMessageAt: anyOf: - type: string format: date-time - type: 'null' title: Lastmessageat updatedAt: anyOf: - type: string format: date-time - type: 'null' title: Updatedat lastReadByUserAt: anyOf: - type: string format: date-time - type: 'null' title: Lastreadbyuserat lastReadByAdminAt: anyOf: - type: string format: date-time - type: 'null' title: Lastreadbyadminat unreadCount: type: integer title: Unreadcount default: 0 createdAt: type: string format: date-time title: Createdat type: object required: - id - createdAt title: ChatResponse description: User-facing chat. HTTPValidationError: properties: detail: items: $ref: '#/components/schemas/ValidationError' type: array title: Detail type: object title: HTTPValidationError ChatMessageRequest: properties: text: type: string title: Text documentIds: items: type: string format: uuid type: array title: Documentids type: object required: - text title: ChatMessageRequest description: Send a message in the chat. ChatCreateRequest: properties: text: anyOf: - type: string - type: 'null' title: Text type: object title: ChatCreateRequest description: Create (or get) the user's internal chat. securitySchemes: HTTPBearer: type: http scheme: bearer x-default: Bearer ApiKeyAuth: type: apiKey in: header name: x-api-key description: Alternative HEVN API key header. The CLI defaults to Authorization Bearer unless configured with HEVN_API_KEY_HEADER=X-Api-Key.