openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: Connectly API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: Users description: User profile operations - name: FriendRequests description: Friend request operations - name: Follows description: Follow/unfollow operations - name: Posts description: Newsfeed post operations - name: Comments description: Post comment operations - name: Reactions description: Emoji reaction operations - name: Stories description: 24h story operations - name: Reels description: Short video reel operations - name: Conversations description: Messenger conversation operations - name: Messages description: Messenger message operations - name: Presence description: Online presence operations - name: Settings description: User settings and privacy operations - name: AI description: Gemini AI assistant operations - name: Storage description: Object storage upload and serving endpoints. paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /users/me: get: operationId: getMyProfile tags: [Users] summary: Get current user's profile (JIT-provisioned) responses: "200": description: Current user profile content: application/json: schema: $ref: "#/components/schemas/UserProfile" patch: operationId: updateMyProfile tags: [Users] summary: Update current user's profile requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UserProfileUpdate" responses: "200": description: Updated profile content: application/json: schema: $ref: "#/components/schemas/UserProfile" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /users/search: get: operationId: searchUsers tags: [Users] summary: Search users by username or display name parameters: - name: q in: query required: true schema: type: string responses: "200": description: Matching users content: application/json: schema: type: array items: $ref: "#/components/schemas/UserProfile" /users/{userId}: get: operationId: getUserProfile tags: [Users] summary: Get a user's public profile parameters: - name: userId in: path required: true schema: type: string responses: "200": description: User profile content: application/json: schema: $ref: "#/components/schemas/UserProfile" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /friend-requests: get: operationId: listFriendRequests tags: [FriendRequests] summary: List friend requests involving the current user parameters: - name: direction in: query required: false schema: type: string enum: [incoming, outgoing, all] responses: "200": description: Friend requests content: application/json: schema: type: array items: $ref: "#/components/schemas/FriendRequest" post: operationId: sendFriendRequest tags: [FriendRequests] summary: Send a friend request requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/FriendRequestInput" responses: "201": description: Created friend request content: application/json: schema: $ref: "#/components/schemas/FriendRequest" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /friend-requests/{id}: patch: operationId: respondToFriendRequest tags: [FriendRequests] summary: Accept or decline a friend request parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/FriendRequestUpdate" responses: "200": description: Updated friend request content: application/json: schema: $ref: "#/components/schemas/FriendRequest" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" delete: operationId: cancelFriendRequest tags: [FriendRequests] summary: Cancel/delete a friend request parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /follows: post: operationId: followUser tags: [Follows] summary: Follow a user requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/FollowInput" responses: "201": description: Created follow content: application/json: schema: $ref: "#/components/schemas/Follow" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /follows/{followingId}: delete: operationId: unfollowUser tags: [Follows] summary: Unfollow a user parameters: - name: followingId in: path required: true schema: type: string responses: "204": description: Deleted /follows/followers/{userId}: get: operationId: listFollowers tags: [Follows] summary: List a user's followers parameters: - name: userId in: path required: true schema: type: string responses: "200": description: Followers content: application/json: schema: type: array items: $ref: "#/components/schemas/UserProfile" /follows/following/{userId}: get: operationId: listFollowing tags: [Follows] summary: List users a user is following parameters: - name: userId in: path required: true schema: type: string responses: "200": description: Following content: application/json: schema: type: array items: $ref: "#/components/schemas/UserProfile" /posts: get: operationId: listPosts tags: [Posts] summary: List newsfeed posts (most recent first) parameters: - name: authorId in: query required: false schema: type: string responses: "200": description: Posts content: application/json: schema: type: array items: $ref: "#/components/schemas/Post" post: operationId: createPost tags: [Posts] summary: Create a new post requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PostInput" responses: "201": description: Created post content: application/json: schema: $ref: "#/components/schemas/Post" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /posts/{id}: get: operationId: getPost tags: [Posts] summary: Get a single post parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Post content: application/json: schema: $ref: "#/components/schemas/Post" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" delete: operationId: deletePost tags: [Posts] summary: Delete a post parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /posts/{postId}/comments: get: operationId: listComments tags: [Comments] summary: List comments for a post parameters: - name: postId in: path required: true schema: type: integer responses: "200": description: Comments content: application/json: schema: type: array items: $ref: "#/components/schemas/Comment" post: operationId: createComment tags: [Comments] summary: Add a comment to a post parameters: - name: postId in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CommentInput" responses: "201": description: Created comment content: application/json: schema: $ref: "#/components/schemas/Comment" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /comments/{id}: delete: operationId: deleteComment tags: [Comments] summary: Delete a comment parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /reactions: post: operationId: setReaction tags: [Reactions] summary: Add or change a reaction on a post or comment requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ReactionInput" responses: "200": description: Current reaction summary for the target content: application/json: schema: $ref: "#/components/schemas/ReactionSummary" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /reactions/{targetType}/{targetId}: delete: operationId: removeReaction tags: [Reactions] summary: Remove the current user's reaction from a target parameters: - name: targetType in: path required: true schema: type: string enum: [post, comment, reel] - name: targetId in: path required: true schema: type: integer responses: "200": description: Current reaction summary for the target content: application/json: schema: $ref: "#/components/schemas/ReactionSummary" /stories: get: operationId: listStories tags: [Stories] summary: List active (non-expired) stories responses: "200": description: Stories content: application/json: schema: type: array items: $ref: "#/components/schemas/Story" post: operationId: createStory tags: [Stories] summary: Create a new story requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/StoryInput" responses: "201": description: Created story content: application/json: schema: $ref: "#/components/schemas/Story" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /stories/{id}: delete: operationId: deleteStory tags: [Stories] summary: Delete a story parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /reels: get: operationId: listReels tags: [Reels] summary: List reels (most recent first) responses: "200": description: Reels content: application/json: schema: type: array items: $ref: "#/components/schemas/Reel" post: operationId: createReel tags: [Reels] summary: Create a new reel requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ReelInput" responses: "201": description: Created reel content: application/json: schema: $ref: "#/components/schemas/Reel" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /reels/{id}: delete: operationId: deleteReel tags: [Reels] summary: Delete a reel parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /conversations: get: operationId: listConversations tags: [Conversations] summary: List the current user's conversations responses: "200": description: Conversations content: application/json: schema: type: array items: $ref: "#/components/schemas/Conversation" post: operationId: createConversation tags: [Conversations] summary: Create (or reuse) a conversation requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ConversationInput" responses: "201": description: Created (or existing) conversation content: application/json: schema: $ref: "#/components/schemas/Conversation" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /conversations/{id}/messages: get: operationId: listMessages tags: [Messages] summary: List messages in a conversation (oldest first) parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Messages content: application/json: schema: type: array items: $ref: "#/components/schemas/Message" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" post: operationId: sendMessage tags: [Messages] summary: Send a message in a conversation parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/MessageInput" responses: "201": description: Created message content: application/json: schema: $ref: "#/components/schemas/Message" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /presence/{userId}: get: operationId: getPresence tags: [Presence] summary: Get a user's presence status parameters: - name: userId in: path required: true schema: type: string responses: "200": description: Presence content: application/json: schema: $ref: "#/components/schemas/Presence" /settings/me: get: operationId: getMySettings tags: [Settings] summary: Get current user's settings responses: "200": description: Settings content: application/json: schema: $ref: "#/components/schemas/UserSettings" patch: operationId: updateMySettings tags: [Settings] summary: Update current user's settings requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UserSettingsUpdate" responses: "200": description: Updated settings content: application/json: schema: $ref: "#/components/schemas/UserSettings" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /settings/verify-pin: post: operationId: verifyPin tags: [Settings] summary: Verify the app-lock PIN requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PinVerifyInput" responses: "200": description: Verification result content: application/json: schema: $ref: "#/components/schemas/PinVerifyResponse" /ai/generate-text: post: operationId: aiGenerateText tags: [AI] summary: Ask Gemini AI a free-form question requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AIGenerateTextInput" responses: "200": description: Generated text content: application/json: schema: $ref: "#/components/schemas/AITextResult" "502": description: AI provider error content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /ai/generate-post: post: operationId: aiGeneratePost tags: [AI] summary: Ask Gemini AI to draft a post requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AIGeneratePostInput" responses: "200": description: Generated post draft content: application/json: schema: $ref: "#/components/schemas/AITextResult" "502": description: AI provider error content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /ai/summarize-feed: post: operationId: aiSummarizeFeed tags: [AI] summary: Ask Gemini AI to summarize the current newsfeed responses: "200": description: Feed summary content: application/json: schema: $ref: "#/components/schemas/AITextResult" "502": description: AI provider error content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /storage/uploads/request-url: post: tags: [Storage] operationId: requestUploadUrl summary: Request a presigned URL for file upload description: | Returns a presigned GCS URL for direct upload. The client sends JSON metadata here, then uploads the file directly to the returned URL. requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UploadUrlRequest" responses: "200": description: Presigned upload URL generated. content: application/json: schema: $ref: "#/components/schemas/UploadUrlResponse" "400": description: Missing or invalid required fields. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" "500": description: Failed to generate upload URL. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /storage/public-objects/{filePath}: get: tags: [Storage] operationId: getPublicObject summary: Serve a public asset from PUBLIC_OBJECT_SEARCH_PATHS description: | Unconditionally public — no authentication or ACL checks. Searches PUBLIC_OBJECT_SEARCH_PATHS for the given file path. parameters: - name: filePath in: path required: true schema: type: string description: Relative file path within the public search paths. responses: "200": description: Object content streamed with correct Content-Type. content: "*/*": schema: type: string format: binary "404": description: File not found. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" "500": description: Failed to serve public object. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" /storage/objects/{objectPath}: get: tags: [Storage] operationId: getStorageObject summary: Serve an object entity from PRIVATE_OBJECT_DIR description: | Serves object entities uploaded via presigned URLs. These can optionally be protected with authentication or ACL checks based on the use case. parameters: - name: objectPath in: path required: true schema: type: string description: Object path within the private object dir (e.g. `uploads/some-uuid`). responses: "200": description: Object content streamed with correct Content-Type. content: "*/*": schema: type: string format: binary "404": description: Object not found. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" "500": description: Failed to serve object. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" components: schemas: HealthStatus: type: object properties: status: type: string required: - status ErrorEnvelope: type: object required: [error] properties: error: type: string UserProfile: type: object required: [id, username, displayName, createdAt] properties: id: type: string username: type: string displayName: type: string bio: type: ["string", "null"] avatarUrl: type: ["string", "null"] coverPhotoUrl: type: ["string", "null"] createdAt: type: string format: date-time UserProfileUpdate: type: object properties: username: type: string minLength: 1 displayName: type: string minLength: 1 bio: type: ["string", "null"] avatarUrl: type: ["string", "null"] coverPhotoUrl: type: ["string", "null"] FriendRequest: type: object required: [id, fromUserId, toUserId, status, createdAt] properties: id: type: integer fromUserId: type: string toUserId: type: string status: type: string enum: [pending, accepted, declined] createdAt: type: string format: date-time fromUser: oneOf: - $ref: "#/components/schemas/UserProfile" - type: "null" toUser: oneOf: - $ref: "#/components/schemas/UserProfile" - type: "null" FriendRequestInput: type: object required: [toUserId] properties: toUserId: type: string FriendRequestUpdate: type: object required: [status] properties: status: type: string enum: [accepted, declined] Follow: type: object required: [id, followerId, followingId, createdAt] properties: id: type: integer followerId: type: string followingId: type: string createdAt: type: string format: date-time FollowInput: type: object required: [followingId] properties: followingId: type: string ReactionCounts: type: object properties: like: type: integer love: type: integer haha: type: integer wow: type: integer sad: type: integer angry: type: integer Post: type: object required: [id, authorId, content, createdAt, updatedAt, reactionCounts, commentCount] properties: id: type: integer authorId: type: string content: type: string imageUrl: type: ["string", "null"] videoUrl: type: ["string", "null"] createdAt: type: string format: date-time updatedAt: type: string format: date-time author: oneOf: - $ref: "#/components/schemas/UserProfile" - type: "null" reactionCounts: $ref: "#/components/schemas/ReactionCounts" commentCount: type: integer viewerReaction: type: ["string", "null"] PostInput: type: object required: [content] properties: content: type: string imageUrl: type: ["string", "null"] videoUrl: type: ["string", "null"] Comment: type: object required: [id, postId, authorId, content, createdAt] properties: id: type: integer postId: type: integer authorId: type: string content: type: string createdAt: type: string format: date-time author: oneOf: - $ref: "#/components/schemas/UserProfile" - type: "null" CommentInput: type: object required: [content] properties: content: type: string minLength: 1 ReactionInput: type: object required: [targetType, targetId, type] properties: targetType: type: string enum: [post, comment, reel] targetId: type: integer type: type: string enum: [like, love, haha, wow, sad, angry] ReactionSummary: type: object required: [targetType, targetId, counts, viewerReaction] properties: targetType: type: string enum: [post, comment, reel] targetId: type: integer counts: $ref: "#/components/schemas/ReactionCounts" viewerReaction: type: ["string", "null"] Story: type: object required: [id, authorId, mediaUrl, mediaType, createdAt, expiresAt] properties: id: type: integer authorId: type: string mediaUrl: type: string mediaType: type: string enum: [image, video] caption: type: ["string", "null"] createdAt: type: string format: date-time expiresAt: type: string format: date-time author: oneOf: - $ref: "#/components/schemas/UserProfile" - type: "null" StoryInput: type: object required: [mediaUrl, mediaType] properties: mediaUrl: type: string mediaType: type: string enum: [image, video] caption: type: ["string", "null"] Reel: type: object required: [id, authorId, videoUrl, createdAt, reactionCounts] properties: id: type: integer authorId: type: string videoUrl: type: string caption: type: ["string", "null"] createdAt: type: string format: date-time author: oneOf: - $ref: "#/components/schemas/UserProfile" - type: "null" reactionCounts: $ref: "#/components/schemas/ReactionCounts" viewerReaction: type: ["string", "null"] ReelInput: type: object required: [videoUrl] properties: videoUrl: type: string caption: type: ["string", "null"] Conversation: type: object required: [id, isGroup, createdAt, participants, isGeminiAi] properties: id: type: integer isGroup: type: boolean name: type: ["string", "null"] createdAt: type: string format: date-time participants: type: array items: $ref: "#/components/schemas/UserProfile" lastMessage: oneOf: - $ref: "#/components/schemas/Message" - type: "null" isGeminiAi: type: boolean ConversationInput: type: object required: [participantIds] properties: participantIds: type: array items: type: string minItems: 1 isGroup: type: boolean name: type: ["string", "null"] Message: type: object required: [id, conversationId, senderId, mediaType, createdAt] properties: id: type: integer conversationId: type: integer senderId: type: string content: type: ["string", "null"] mediaUrl: type: ["string", "null"] mediaType: type: string enum: [text, image, voice] createdAt: type: string format: date-time readAt: type: ["string", "null"] format: date-time sender: oneOf: - $ref: "#/components/schemas/UserProfile" - type: "null" MessageInput: type: object required: [mediaType] properties: content: type: ["string", "null"] mediaUrl: type: ["string", "null"] mediaType: type: string enum: [text, image, voice] Presence: type: object required: [userId, isOnline] properties: userId: type: string isOnline: type: boolean lastSeenAt: type: ["string", "null"] format: date-time UserSettings: type: object required: - userId - goldGradientVariant - borderRadius - textSize - showLastSeen - showTyping - profileShieldEnabled - autoDeleteTimerSeconds - pinLockEnabled properties: userId: type: string goldGradientVariant: type: string enum: [classic, rose, champagne, emerald] borderRadius: type: string enum: [sharp, soft, round] textSize: type: string enum: [small, medium, large] showLastSeen: type: boolean showTyping: type: boolean profileShieldEnabled: type: boolean autoDeleteTimerSeconds: type: integer description: 0 means disabled pinLockEnabled: type: boolean UserSettingsUpdate: type: object properties: goldGradientVariant: type: string enum: [classic, rose, champagne, emerald] borderRadius: type: string enum: [sharp, soft, round] textSize: type: string enum: [small, medium, large] showLastSeen: type: boolean showTyping: type: boolean profileShieldEnabled: type: boolean autoDeleteTimerSeconds: type: integer pinLockEnabled: type: boolean pinCode: type: ["string", "null"] description: Write-only 4-6 digit PIN. Never returned in responses. PinVerifyInput: type: object required: [pinCode] properties: pinCode: type: string PinVerifyResponse: type: object required: [valid] properties: valid: type: boolean AIGenerateTextInput: type: object required: [prompt] properties: prompt: type: string minLength: 1 AIGeneratePostInput: type: object required: [topic] properties: topic: type: string minLength: 1 AITextResult: type: object required: [text] properties: text: type: string UploadUrlRequest: type: object required: [name, size, contentType] properties: name: type: string minLength: 1 description: Original file name. size: type: integer minimum: 1 description: File size in bytes. contentType: type: string minLength: 1 description: MIME type of the file (e.g. `image/jpeg`). UploadUrlResponse: type: object required: [uploadURL, objectPath] properties: uploadURL: type: string description: Presigned GCS URL for PUT upload. objectPath: type: string description: Normalized object path (e.g. `/objects/uploads/uuid`). Store this in your database. metadata: $ref: "#/components/schemas/UploadUrlRequest"