Complete API documentation for Programming Helper AI project.
- Production:
https://programming-helper-ai.vercel.app - Local:
http://localhost:3000
Health check endpoint for application and database status. Used for monitoring and load balancer health checks.
Authentication: Not required
Parameters: None
Request Example:
GET /api/healthSuccess Response (200 OK):
{
"status": "healthy",
"timestamp": "2025-11-30T20:00:00.000Z",
"services": {
"database": "connected"
}
}Error Response (503 Service Unavailable):
{
"status": "unhealthy",
"timestamp": "2025-11-30T20:00:00.000Z",
"services": {
"database": "disconnected"
},
"error": "Connection timeout" // only in development
}Creates a user in the database if they don't exist. Synchronizes user from Clerk with local database.
Authentication: Required (Clerk session cookie)
Parameters: None
Request Example:
GET /api/create-user
Cookie: __session=eyJhbGciOiJSUzI1NiIs...Success Response (200 OK):
{
"success": true,
"message": "User created successfully!",
"user": {
"id": "user_123",
"role": "user",
"email": "user@example.com",
"isAdmin": false
}
}Response if user already exists:
{
"success": true,
"message": "User already exists in database",
"user": {
"id": "user_123",
"role": "admin",
"email": "admin@example.com",
"isAdmin": true
}
}Error Responses:
401 Unauthorized- User is not authenticated500 Internal Server Error- Error creating user
Checks if the current user is blocked.
Authentication: Required (Clerk session cookie)
Parameters: None
Request Example:
GET /api/check-blocked
Cookie: __session=eyJhbGciOiJSUzI1NiIs...Response Example:
{
"isBlocked": false
}If user is not authenticated:
{
"isBlocked": false
}All main application endpoints use tRPC. tRPC provides:
- Automatic type safety
- Data validation
- Type-safe clients
/api/trpc
GET requests:
GET /api/trpc/{procedure}?input={JSON}
POST requests:
POST /api/trpc/{procedure}
Content-Type: application/json
{JSON data}
chat.createSession- Create a new chat sessionchat.getSessions- Get all user sessionschat.sendMessage- Send a messagechat.getMessages- Get session messageschat.deleteSession- Delete a session
task.getTasks- Get list of tasks (with filters)task.getTask- Get a specific tasktask.completeTask- Mark task as completedtask.getTaskProgress- Get task progress
stats.getUserStats- User statisticsstats.getGlobalStats- Global statistics (public)
profile.getProfile- Get user profileprofile.updateProfile- Update profileprofile.getLanguageProgress- Language learning progress
assessment.getQuestions- Get assessment questionsassessment.submitAssessment- Submit assessment answersassessment.getAssessments- Get all user assessmentsassessment.checkPostAssessmentEligibility- Check post-assessment eligibility
admin.getDashboardStats- Admin dashboard statisticsadmin.getUsers- List of users (with pagination)admin.getAllTasks- All tasks (with pagination)
contact.sendMessage- Send contact form message (public)
The application uses Clerk for authentication. Authentication is done through cookies, not Bearer Token.
- In Browser: Log in to the application - cookies will be set automatically
- In Postman:
- Use Postman Interceptor to sync cookies
- Or copy the
__sessioncookie from browser and add it to Postman
- Name:
__session(single underscore) - Value: JWT token from Clerk
- Domain:
programming-helper-ai.vercel.app
- Open DevTools in browser → Application → Cookies
- Copy the value of
__sessioncookie - In Postman: Cookies → Manage Cookies → Add cookie for domain
- Or add header:
Cookie: __session=your_jwt_token
curl https://programming-helper-ai.vercel.app/api/healthcurl -X GET https://programming-helper-ai.vercel.app/api/create-user \
-H "Cookie: __session=your_token"curl "https://programming-helper-ai.vercel.app/api/trpc/task.getTasks?input=%7B%22language%22%3A%22javascript%22%2C%22difficulty%22%3A%22beginner%22%7D" \
-H "Cookie: __session=your_token"curl -X POST https://programming-helper-ai.vercel.app/api/trpc/chat.sendMessage \
-H "Content-Type: application/json" \
-H "Cookie: __session=your_token" \
-d '{
"message": "How do I implement binary search?",
"sessionId": "session-id-here"
}'200 OK- Successful request400 Bad Request- Invalid request parameters401 Unauthorized- Authentication required403 Forbidden- Insufficient permissions404 Not Found- Resource not found500 Internal Server Error- Internal server error503 Service Unavailable- Service unavailable
For convenient API testing, use the Postman collection:
- Collection File:
postman/Programming-Helper-AI.postman_collection.json - Environment File:
postman/Programming-Helper-AI-Production.postman_environment.json
- Open Postman
- File → Import
- Select collection and environment files
- Select environment "Programming Helper AI - Production"
- Configure cookies via Postman Interceptor or manually
- Swagger/OpenAPI - Standard for REST API documentation
- tRPC Documentation - tRPC documentation
- Clerk Documentation - Clerk documentation
If you have questions about the API, create an issue in the repository or contact the development team.
Last Updated: May 12, 2026