GyaanKit REST API

Read and write your institute's data (courses, batches, students, fees, tests and doubts) from your own backend. Use it to sync your CRM, bulk-import students, generate fee dues, or show live data on a marketing site.

Version v1 · JSON over HTTPS · Bearer token auth

Server-side only
The API is versioned under /api/v1. Send the Bearer token from your backend and never expose API keys in browser JavaScript.

Base URL

Every institute is served on its own domain, and the API lives on that same domain:

https://{your-slug}.gyaankit.com/api/v1

If your institute uses a custom domain, the API is reachable there too (https://{your-domain}/api/v1).

In local development the tenant is resolved from the host, so pass?__tenant={slug}:

http://localhost:4321/api/v1?__tenant={slug}

Authentication

Send your API key as a Bearer token on every request:

Authorization: Bearer gk_xxxxxxxx...

Keys are created in the institute dashboard at Settings → API(owner only).

  • A key only works on its own institute's domain. A key from one institute will not authenticate against another.
  • The full key is shown once, when you create it. Copy it then: GyaanKit stores only a hash and cannot show it again.
  • A key is either full-access or limited to a set ofscopes (see below).

Missing, malformed or wrong-domain keys return 401. A valid key that lacks the capability an endpoint requires returns403.

Scopes

Each endpoint requires a capability. When you create a limited key, grant the capabilities for the endpoints it needs:

ResourceAccessRequired capability
CoursesRead and writecourses.own.manage
BatchesRead and writebatches.manage
Students and feesRead and writestudents.manage
TestsReadcourses.own.manage
DoubtsReadcontent.view

A full-access key satisfies all of the above.

Conventions

Money

All monetary amounts are integers in the minor unit of the currency (paise for INR, cents for USD). The fields are named price_minor andamount_minor. For example, ₹499.00 is 49900 withcurrency: "INR".

Timestamps and dates

Timestamps in responses are epoch milliseconds (integers), for examplecreated_at, due_at and paid_at. Dateinputs (such as starts_on, ends_on anddue_at) accept either epoch milliseconds or an ISO 8601 string (for example "2026-07-01").

Request bodies

POST requests take a JSON body. Always sendContent-Type: application/json.

Responses

A successful response wraps the payload in a data key, either a single object or an array:

{ "data": { "id": "...", "title": "..." } }

Errors return an error message with an appropriate HTTP status:

{ "error": "`title` is required." }
StatusMeaning
200OK
201Created
400Bad request (validation failed)
401Missing or invalid API key
403Key lacks the required scope
404Resource not found

Introspection

GET/api/v1

Verify a key and inspect what it can do. Returns the resolved tenant, the key's scopes ("full" or an array) and the list of available endpoints.

{
  "ok": true,
  "version": "v1",
  "tenant": { "id": "...", "slug": "...", "name": "..." },
  "scopes": "full",
  "endpoints": [
    "/api/v1/courses",
    "/api/v1/batches",
    "/api/v1/students",
    "/api/v1/fees",
    "/api/v1/tests",
    "/api/v1/doubts"
  ]
}

Courses

Requires courses.own.manage.

GET/api/v1/courses

List all courses.

{
  "data": [
    {
      "id": "...",
      "title": "...",
      "slug": "...",
      "summary": "...",
      "type": "ondemand",
      "status": "published",
      "price_minor": 49900,
      "currency": "INR",
      "created_at": 1750000000000
    }
  ]
}

POST/api/v1/courses

Create a course. Returns 201.

FieldTypeRequiredNotes
titlestringYes
slugstringNoDerived from title if omitted; a numeric suffix is added on collision
typestringNo"ondemand" or "live" (default "ondemand")
price_minorintegerNoMinor units; default 0
currencystringNoDefault "INR"

Response: 201 { "data": course }

GET/api/v1/courses/{id}

Fetch a single course by id or slug. Returns404 if not found.

Batches

Requires batches.manage.

GET/api/v1/batches

List all batches.

{
  "data": [
    {
      "id": "...",
      "name": "...",
      "course_id": "...",
      "starts_on": 1750000000000,
      "ends_on": 1760000000000,
      "capacity": 60,
      "price_minor": 49900,
      "currency": "INR"
    }
  ]
}

POST/api/v1/batches

Create a batch. Returns 201.

FieldTypeRequiredNotes
namestringYes
starts_onint or ISONoEpoch ms or ISO date
ends_onint or ISONoEpoch ms or ISO date
capacityintegerNo
price_minorintegerNoMinor units
currencystringNo

GET/api/v1/batches/{id}

Fetch a single batch. Returns 404 if not found.

Students

Requires students.manage.

GET/api/v1/students

List active students.

{
  "data": [
    {
      "user_id": "...",
      "name": "...",
      "email": "...",
      "phone": "...",
      "created_at": 1750000000000
    }
  ]
}

POST/api/v1/students

Add a student. Idempotent on email: if an account with that email already exists it is reused and no new login is created. Optionally enrol the student in a batch. Returns 201.

FieldTypeRequiredNotes
emailstringYes
namestringNo
batch_idstringNoEnrol the student in this batch

Response: 201

{
  "data": { "user_id": "...", "name": "...", "email": "..." },
  "summary": { "created": 1, "added": 1, "existing": 0, "enrolled": 1 }
}

The summary reports what happened: whether a new account wascreated, whether the student was added to the institute, whether the account already existed (existing), and whether the student was enrolled in a batch.

Fees

Requires students.manage.

GET/api/v1/fees

List fee dues.

{
  "data": [
    {
      "id": "...",
      "user_id": "...",
      "name": "...",
      "email": "...",
      "batch_id": "...",
      "title": "Term 1 fee",
      "amount_minor": 49900,
      "currency": "INR",
      "due_at": 1755000000000,
      "status": "due",
      "paid_at": null,
      "created_at": 1750000000000
    }
  ]
}

POST/api/v1/fees

Create a fee due. Returns 201.

FieldTypeRequiredNotes
user_idstringYes
amount_minorintegerYesPositive integer, minor units
titlestringNoDefault "Fee"
currencystringNo
due_atint or ISONoEpoch ms or ISO date
batch_idstringNo

Tests

Requires courses.own.manage. Read-only.

GET/api/v1/tests

List tests. Filter by status with ?status=published.

{
  "data": [
    {
      "id": "...",
      "title": "...",
      "kind": "...",
      "duration_min": 60,
      "status": "published",
      "course_id": "...",
      "created_at": 1750000000000
    }
  ]
}

Doubts

Requires content.view. Read-only.

GET/api/v1/doubts

List doubts. Filter by status with ?status=open.

{
  "data": [
    {
      "id": "...",
      "subject": "...",
      "body": "...",
      "status": "open",
      "asked_by": "...",
      "course_title": "...",
      "created_at": 1750000000000
    }
  ]
}

Examples

All examples assume your slug is acme and your key isgk_live_xxx.

List courses

curl https://acme.gyaankit.com/api/v1/courses \
  -H "Authorization: Bearer gk_live_xxx"

Create a course

curl -X POST https://acme.gyaankit.com/api/v1/courses \
  -H "Authorization: Bearer gk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Full-Stack Web Development",
    "type": "ondemand",
    "price_minor": 49900,
    "currency": "INR"
  }'

Add a student and enrol them in a batch

curl -X POST https://acme.gyaankit.com/api/v1/students \
  -H "Authorization: Bearer gk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "student@example.com",
    "name": "Asha Verma",
    "batch_id": "01J..."
  }'

Security notes

  • This API is for server-side use. Send the Bearer token from your backend. Do not embed keys in browser JavaScript, mobile apps or any client the public can inspect.
  • Treat keys like passwords. If a key leaks, revoke it inSettings → API and issue a new one. The old key stops working immediately.
  • Scope keys to the minimum capabilities they need.