GitHunt
AN

anburocky3/indian-colleges-data

This API has 39268 colleges data latest uptodate, like names, district, address, etc., including private, government, autonomous, and affiliated institutions across India. The data is sourced from the All India Council for Technical Education (AICTE) website.

Indian Colleges List โ€” (Data via API)

Stars
Forks
GitHub license
Anbuselvan Rocky Twitter
Support Server
Cyberdude youtube

This api contains 1278 colleges data, like names, district, address, etc., including private, government, autonomous, and affiliated institutions across India. The data is sourced from the All India Council for Technical Education (AICTE)
website.

You can download the entire data-set here. If you are looking for CBSE Schools Data check here

Note: This project is not affiliated with or endorsed by any government entity. Data comes from publicly available pages and may change or break at any time.

๐Ÿš€ Available Endpoints

Calling /api/institutions will load 11.9MB of data, which is time consuming. Instead you can load institutions by state api call.

  • The /api/institutions route is offline-first and serves the snapshot at data/institutions.json by default. Use ?online=1 to fetch fresh upstream data.
  • The downloader/merge writes a small metadata file at data/institutions.meta.json which contains { "last_grabbed": "ISO timestamp", "records": number }. When present the /api/institutions response will include this metadata and the route sets an X-Data-Source header to indicate offline or online.

โœ… Download Postman Collections

Screenshots

Indian Colleges lists - Datasets

Quick start

  1. Fork this repository and install the deps.
npm install
npm run dev
  1. Open the app in your browser:
http://localhost:3000
  1. API routes are under /api (app router):
  • GET /api/institutions โ€” returns offline data/institutions.json by default; ?online=1 fetches upstream

  • GET /api/institution/[id] โ€” proxy for per-institution course details (supports extra query params like course and year)

  • GET /api/institutions/search โ€” search institutions by state and query (requires state and q >= 3 chars)

    • Example: GET /api/institutions/search?state=Karnataka&q=engineering&page=1&limit=20
    • Response: { total, page, limit, results: [{ id, name, university, state, district, programmes_count }] }
  • GET/POST /api/hits โ€” simple page visit counter (GET to read, POST to increment). This is file-backed by default (development). For production on serverless platforms use an external store (Upstash, Vercel KV, Supabase) โ€” see notes below.

API โ€” Detailed documentation

All endpoints are implemented as Next.js app routes (server-side). They include CORS headers so they can be called from browsers.

Common CORS headers set on responses:

  • Access-Control-Allow-Origin: *
  • Access-Control-Allow-Methods: GET,OPTIONS
  • Access-Control-Allow-Headers: Content-Type,Authorization

OPTIONS preflight requests are handled and return 204 with the same CORS headers.

GET /api/institutions

Purpose: list institutions. By default this endpoint serves an offline snapshot in data/institutions.json. Use ?online=1 to fetch live upstream data.

Supported query parameters (forwarded to upstream):

  • method (default: fetchdata)
  • year
  • program
  • level
  • institutiontype
  • Women
  • Minority
  • state
  • course

Behavior and responses:

  • Default (no online query param): reads data/institutions.json and returns:
{ "source": "offline", "data": [ ... ] }

and sets header X-Data-Source: offline.

  • With ?online=1 (or ?online=true): fetches the upstream endpoint and returns:
{ "source": "online", "data": [ ... ] }

and sets header X-Data-Source: online.

You can also pass fields to transform rows into objects, as shown above for /api/prefetch.

Example:

GET /api/institutions
GET /api/institutions?online=1
GET /api/institutions?fields=aicte_id,institute_name,address,district,institution_type,women,minority,other_id

GET /api/institution/[id]

Purpose: fetch per-institution course/approval details.

Notes:

  • Next.js route receives an id path segment. For upstream compatibility some query params are expected to be wrapped with slashes (for example upstream expects &course=/1/). The route will wrap common params for you when constructing the upstream URL.
  • Supported query params that will be wrapped automatically: course, year, program, level, institutiontype, Women, Minority, state.

Example request that the route will convert into the required upstream format:

GET /api/institution/1-44641241273?course=1&year=2025-2026

# The handler will call the upstream with course=/1/&year=/2025-2026/

Scripts

  • npm run download โ€” downloads the upstream /api/institutions and saves the JSON snapshot to data/institutions.json. This is implemented by scripts/download.js.

Notes on running the script:

# Runs with node; ensure Node version supports global fetch or run with experimental fetch enabled if needed.
npm run download

If you need to run the script with an older Node version, you can run it using node --experimental-fetch scripts/download.js.

Postman collections

You can import the Postman collections stored in the postman/ folder:

  • postman/Institutions.postman_collection.json โ€” requests for /api/institutions (offline/online/fields examples).

Import the collection and environment into Postman, set base_url to http://localhost:3000, and run the examples.

Examples

JavaScript (browser):

// Fetch offline institutions
fetch("/api/institutions")
  .then((r) => r.json())
  .then((res) => {
    console.log(res.source); // 'offline' or 'online'
    console.log(res.data);
  });

// Fetch prefetch with field mapping
fetch("/api/prefetch?year=2024-2025&fields=id,institute_name,district")
  .then((r) => r.json())
  .then(console.log);

Curl (Windows cmd.exe):

curl "http://localhost:3000/api/institutions"
curl "http://localhost:3000/api/institutions?online=1"
curl "http://localhost:3000/api/prefetch?year=2024-2025"

Response shape and headers (summary)

  • Wrapper: { source: 'offline'|'online', data: <payload> } for endpoints that return JSON.
  • Header: X-Data-Source: offline|online
  • CORS headers: Access-Control-Allow-Origin: *, Access-Control-Allow-Methods: GET,OPTIONS, Access-Control-Allow-Headers: Content-Type,Authorization.

Troubleshooting

  • If you see unexpected absolute-drive imports from your editor, configure your editor to prefer relative imports (VS Code setting: typescript.preferences.importModuleSpecifier = "relative").
  • If the API fails with 502, the upstream returned an error โ€” check the upstream body included in the response for more details.
  • For local dev, ensure the data/institutions.json file exists; if missing, you can fetch a snapshot using npm run download:prefetch (or create one manually).

Security & production notes

  • The proxy sets Access-Control-Allow-Origin: * for convenience in development. For production, restrict the allowed origin(s) and enable Access-Control-Allow-Credentials if you need to forward cookies.
  • Consider caching strategies for /api/prefetch and /api/institutions (e.g., in-memory cache, Redis, or Next.js ISR) to reduce upstream load and improve performance.

Author

Acknowledgement

  • All datas are owned by aicte website. Refer it for more clarity!