Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.pyqdeck.in/llms.txt

Use this file to discover all available pages before exploring further.

Base URL

https://backend.pyqdeck.in/api/v1
For local development:
http://localhost:3000/api/v1

Authentication

Most endpoints require authentication via Clerk JWT tokens:
GET /api/v1/users/me
Authorization: Bearer <clerk_jwt_token>
The token is automatically injected by the useApi() hook in the frontend.

API Contract

All endpoints are defined in our OpenAPI 3.0 specification. The spec lives at backend/openapi.json and is automatically synced to the frontend SDK.

Endpoint Groups

Health

MethodPathDescription
GET/healthSimple health check
GET/health/detailedDetailed health with DB status

Universities & Academics

MethodPathDescription
GET/universitiesList all universities
GET/universities/:id/branchesGet branches for a university
GET/branches/:id/semestersGet semesters for a branch
GET/subjectsList subjects
GET/subject-offeringsList subject offerings

Content

MethodPathDescription
GET/papersList exam papers
GET/papers/:id/questionsGet questions for a paper
GET/questionsList questions
GET/solutionsList solutions
GET/searchFull-text search

User Features

MethodPathDescriptionAuth Required
GET/bookmarksGet user bookmarksYes
POST/bookmarksCreate bookmarkYes
DELETE/bookmarks/:idDelete bookmarkYes
GET/users/meGet current userYes

Syllabus

MethodPathDescription
GET/syllabus/modulesList modules
GET/syllabus/topicsList topics

Uploads

MethodPathDescription
POST/uploadthingUpload files (via UploadThing)

SEO

MethodPathDescription
GET/seo/sitemap-dataGet sitemap data

Webhooks

MethodPathDescription
POST/webhooks/clerkClerk webhook endpoint

Interactive Playground

The full interactive API playground is available via our OpenAPI integration. Each endpoint includes:
  • Request/response schemas
  • Example requests
  • Try-it-out functionality

Error Handling

All errors follow a consistent format:
{
  "success": false,
  "error": {
    "message": "Resource not found",
    "code": "NOT_FOUND"
  }
}

Common Error Codes

CodeHTTP StatusDescription
VALIDATION_ERROR400Request validation failed
UNAUTHORIZED401Missing or invalid auth token
FORBIDDEN403Insufficient permissions
NOT_FOUND404Resource not found
INTERNAL_ERROR500Internal server error

Rate Limiting

API endpoints are rate-limited:
  • Window: 15 minutes (900000ms)
  • Max requests: 100 per window
Rate limit headers are included in responses:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1620000000

Pagination

List endpoints support pagination:
GET /api/v1/papers?page=1&limit=20
Response includes pagination metadata:
{
  "success": true,
  "data": [...],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 150,
    "totalPages": 8
  }
}

SDK Usage

In the frontend, use the generated SDK via useApi():
import { useApi } from '@/hooks/use-api';

const api = useApi();

// Get papers
const { data: papers } = await api.papers.getPapers();

// Get questions for a paper
const { data: questions } = await api.papers.getPaperQuestions(paperId);

// Create bookmark
const { data: bookmark } = await api.bookmarks.createBookmark({ questionId });
The SDK provides full TypeScript types for all requests and responses.

Next Steps