/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/v1If 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:
| Resource | Access | Required capability |
|---|---|---|
| Courses | Read and write | courses.own.manage |
| Batches | Read and write | batches.manage |
| Students and fees | Read and write | students.manage |
| Tests | Read | courses.own.manage |
| Doubts | Read | content.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." }| Status | Meaning |
|---|---|
| 200 | OK |
| 201 | Created |
| 400 | Bad request (validation failed) |
| 401 | Missing or invalid API key |
| 403 | Key lacks the required scope |
| 404 | Resource 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.
| Field | Type | Required | Notes |
|---|---|---|---|
title | string | Yes | |
slug | string | No | Derived from title if omitted; a numeric suffix is added on collision |
type | string | No | "ondemand" or "live" (default "ondemand") |
price_minor | integer | No | Minor units; default 0 |
currency | string | No | Default "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.
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | Yes | |
starts_on | int or ISO | No | Epoch ms or ISO date |
ends_on | int or ISO | No | Epoch ms or ISO date |
capacity | integer | No | |
price_minor | integer | No | Minor units |
currency | string | No |
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.
| Field | Type | Required | Notes |
|---|---|---|---|
email | string | Yes | |
name | string | No | |
batch_id | string | No | Enrol 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.
| Field | Type | Required | Notes |
|---|---|---|---|
user_id | string | Yes | |
amount_minor | integer | Yes | Positive integer, minor units |
title | string | No | Default "Fee" |
currency | string | No | |
due_at | int or ISO | No | Epoch ms or ISO date |
batch_id | string | No |
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.