Developer Docs

Uni Lann Pya API

Uni Lann Pya provides verified university and career guidance for Myanmar students through thin API routes, deterministic rule-engine checks, and safe LLM-generated explanations.

API Overview

Response Envelope

{
  "success": "boolean",
  "message": "string",
  "timestamp": "ISO-8601 string",
  "requestId": "string",
  "data": "endpoint-specific payload or null",
  "meta": "safe response metadata or null",
  "error": "public error object or null"
}

Production Boundaries

  • API routes validate HTTP input and return typed envelopes.
  • Rule-engine services own eligibility and dataset filtering.
  • LLM responses explain verified results without overriding them.
  • Public responses never expose prompts or internal reasoning.

Endpoints

GET/api/health

Check service health.

GET/api/docs

Return machine-readable API documentation.

POST/api/chat

Generate verified university and career guidance. Valid requests consume one daily AI chat credit.

GET/api/chat/usage

Return the current server-trusted daily chat usage without consuming a credit.

POST /api/chat

Generates verified university and career guidance from one student message. The endpoint accepts JSON only.

Request

Content type: application/json

{
  "message": "I want to find universities based on my matriculation marks."
}

Response

{
  "success": true,
  "message": "Chat response generated.",
  "timestamp": "2026-07-04T00:00:00.000Z",
  "requestId": "uuid",
  "data": {
    "answer": "Based on verified data, you can consider universities that match your marks and target career.",
    "recommendations": [
      {
        "rank": 1,
        "universityName": "Yangon Technological University",
        "universityNameMm": "ရန်ကုန်နည်းပညာတက္ကသိုလ်",
        "category": "Technology",
        "minimumMarks": 420,
        "durationYears": 5,
        "degrees": [
          "B.E.",
          "B.Tech."
        ],
        "matchReason": "This is a verified Technology option; minimum mark is 420."
      }
    ],
    "followUpQuestions": [
      "Add my target major",
      "Add my career goal"
    ]
  },
  "meta": {
    "intent": "university_eligibility",
    "language": "English",
    "recommendationCount": 1,
    "dailyLimit": 10,
    "dailyUsed": 1,
    "dailyRemaining": 9,
    "dailyResetAt": "2026-07-04T17:30:00.000Z"
  },
  "error": null
}

Error Codes

StatusCodeDescription
400INVALID_JSONRequest body is not valid JSON.
400VALIDATION_ERRORThe message field is missing, empty, too long, or contains unsupported fields.
413PAYLOAD_TOO_LARGEThe request body is larger than the chat API accepts.
415UNSUPPORTED_MEDIA_TYPEThe chat endpoint only accepts application/json.
429DAILY_LIMIT_EXCEEDEDThe browser has used all daily AI chat credits.
503SERVICE_BUSYThe server is already processing the maximum number of chat requests.
500CHAT_PROCESSING_FAILEDThe server could not process the message.

Environment Variables

NameRequiredDefaultDescription
DAILY_LIMIT_SECRETYesNoneSecret used to sign HttpOnly daily usage cookies. Required in production.
GEMINI_API_KEYYesNoneAPI key used by server-side AI extraction and generation.
MODEL_NAMENogemini-2.5-flash-liteChat model used by the server-side AI client.
MAX_CONCURRENT_CHAT_REQUESTSNo3Maximum number of active chat requests allowed per server instance. Must be between 1 and 25.

Memory And Storage

Client storage keeps student context local. Prompts should include only safe recent context or summaries, never full conversation history.

localStorage

Stores sessionId and Working Memory on the client.

  • sessionId
  • workingMemory

HttpOnly cookie

Stores the server-signed daily AI chat usage counter for one browser.

  • daily chat date
  • daily chat count
  • server signature

IndexedDB

Stores Conversation Memory and cached client data.

  • conversations
  • messages
  • conversation summaries
  • cached recommendations

Working Memory

Tracks the active student profile for the current session.

  • marks
  • category
  • major
  • careerGoal
  • language
  • lastIntent

Conversation Memory

Tracks recent conversation context; prompts should use only recent or summarized context.

  • recent messages
  • summaries