DevTinder API Endpoints Complete Guide to All Routes and Responses
A complete reference guide to all DevTinder API endpoints auth, profile, feed, connections, and chat with request formats, response shapes, and status codes.
DevTinder API Endpoints Complete Guide
This is a complete reference for all DevTinder API endpoints. Use this as a quick lookup when working on the frontend or debugging API calls.
Authentication Endpoints
POST /api/signup
Create a new user account.
Request:
{ "firstName": "John", "lastName": "Doe", "email": "[email protected]", "password": "John@1234" }
Response (201):
{ "message": "User created", "data": { "_id": "64abc...", "firstName": "John", "lastName": "Doe", "email": "[email protected]" } }
Also sets a token cookie (HTTP-only, 7 days).
Errors: 400 (validation), 409 (duplicate email)
POST /api/login
Authenticate and receive JWT cookie.
Request:
{ "email": "[email protected]", "password": "John@1234" }
Response (200): Same as signup, with token cookie.
Errors: 401 (invalid credentials)
POST /api/logout
Clear the auth cookie.
Response (200):
{ "message": "Logged out successfully" }
Profile Endpoints
GET /api/profile/view
View the logged-in user's profile.
Response (200):
{ "data": { "_id": "64abc...", "firstName": "John", "lastName": "Doe", "email": "[email protected]", "photoUrl": "https://...", "age": 25, "gender": "male", "about": "Developer", "skills": ["React", "Node.js"] } }
PATCH /api/profile/edit
Update profile fields. Only whitelisted fields are accepted.
Request:
{ "firstName": "Johnny", "about": "Full-stack developer", "skills": ["React", "Node.js", "MongoDB"] }
Response (200): Updated user object.
POST /api/profile/photo
Upload a profile photo. Uses multipart/form-data.
Request: FormData with photo field.
Response (200):
{ "message": "Photo updated", "data": { "photoUrl": "https://..." } }
Feed Endpoints
GET /api/feed?page=1&limit=10
Get a paginated feed of user profiles (excluding connected and requested users).
Response (200):
{ "data": [ { "_id": "...", "firstName": "Jane", "lastName": "Smith", "photoUrl": "...", "age": 24, "skills": ["Python"] } ], "pagination": { "page": 1, "limit": 10, "total": 87, "totalPages": 9, "hasNextPage": true } }
Connection Request Endpoints
POST /api/request/send/:status/:toUserId
Send a connection request. Status is "interested" or "ignored".
Response (201):
{ "message": "Connection request sent", "data": { "_id": "...", "fromUserId": "...", "toUserId": "...", "status": "interested" } }
Errors: 400 (invalid status, self-request), 404 (user not found), 409 (duplicate)
POST /api/request/review/:status/:requestId
Accept or reject a received request. Status is "accepted" or "rejected".
Response (200):
{ "message": "Connection request accepted", "data": { "status": "accepted" } }
GET /api/requests/received
List pending incoming requests (status: interested).
Response (200):
{ "data": [ { "_id": "...", "fromUserId": { "_id": "...", "firstName": "Jane", "photoUrl": "..." }, "status": "interested" } ] }
GET /api/connections
List all accepted connections.
Response (200):
{ "data": [ { "_id": "...", "firstName": "Jane", "lastName": "Smith", "photoUrl": "..." } ] }
Chat Endpoints
GET /api/chat/:targetUserId?page=1&limit=50
Load message history with a specific user.
Response (200):
{ "data": [ { "_id": "...", "senderId": "...", "receiverId": "...", "text": "Hello!", "createdAt": "..." } ] }
Socket.io Events
join:chatJoin a chat room with a target usermessage:sendSend a message to a target usermessage:receivedReceive a message from another usertyping:startNotify the other user that typing startedtyping:stopNotify the other user that typing stopped
The Takeaway
The DevTinder API has endpoints for auth (signup, login, logout), profile (view, edit, photo), feed (paginated), connections (send, review, list), and chat (history). All protected endpoints require the JWT cookie. The response format is consistent: a message, data object, and appropriate HTTP status code.
POST /api/signup (create account, returns user and sets JWT cookie), POST /api/login (authenticate, returns user and sets JWT cookie), and POST /api/logout (clears the JWT cookie).
POST /api/request/send/:status/:toUserId where status is 'interested' or 'ignored'. The endpoint creates a ConnectionRequest document. Returns 201 on success, 400 for invalid status or self-request, 404 if user not found, 409 for duplicate.
GET /api/feed?page=1&limit=10 returns a paginated list of user profiles, excluding the current user, connected users, and users with pending requests. Response includes data array and pagination metadata (page, limit, total, totalPages, hasNextPage).
GET /api/chat/:targetUserId?page=1&limit=50 returns paginated message history between the logged-in user and the target user. Messages are sorted by createdAt in ascending order after being fetched in descending order and reversed.
join:chat (join a room), message:send (send a message), message:received (receive a message), typing:start (notify typing started), and typing:stop (notify typing stopped). All require JWT authentication via handshake auth.
Ready to master Node.js completely?
Want to upskill yourself, crack your next interview, and get your dream job? Join our comprehensive course to dive deeper with high-quality video tutorials, solve interview questions, and a premium community.
Master Node.js
Want to upskill yourself, crack your next interview, and get your dream job? Join our comprehensive course.

