Developers

A free API for Sri Lankan data.

Holidays and Poya days, NIC decoding, phone number checks, amounts in words and Singlish to Sinhala, as JSON. The same code that runs the tools on this site.

Start

  1. Sign in with Google and make a key on your account page. It is free; each key can make 1,000 requests a day, and you can have 3.
  2. Send it with each request, as Authorization: Bearer <key>, an X-API-Key header, or ?api_key=.
  3. Every answer is JSON. Browsers can call it directly (CORS is open to any site).
curl -H "Authorization: Bearer hk_your_key" \
  "https://hirantha.me/api/v1/holidays?year=2027&type=poya"

Endpoints

  • GET /api/v1/holidays

    Sri Lanka public, bank and mercantile holidays, with Poya days marked. Parameters: year (2026 or 2027), type (all, poya, mercantile).

  • GET /api/v1/holidays/next

    The next holiday or Poya day. Parameters: from (YYYY-MM-DD, default today in Sri Lanka), type (poya).

  • GET /api/v1/nic/{number}

    Decode a Sri Lankan NIC: birth date, gender, old and new layouts. Parameters: the NIC number in the path.

  • GET /api/v1/phone/{number}

    Check a Sri Lankan phone number: mobile or landline, area, operator prefix, standard formats. Parameters: the phone number in the path.

  • GET /api/v1/amount-in-words

    A rupee amount in words, the way it is written on a cheque. Parameters: amount, style (title, upper, sentence).

  • GET /api/v1/singlish

    Singlish (romanised Sinhala) to Sinhala Unicode. Parameters: text (up to 5,000 characters).

Examples

GET /api/v1/holidays?year=2027&type=poya

{
  "year": 2027,
  "type": "poya",
  "count": 12,
  "holidays": [
    {
      "date": "2027-01-22",
      "name": "Duruthu Full Moon Poya Day",
      "mercantile": false,
      "poya": true
    },
    {
      "date": "2027-02-20",
      "name": "Navam Full Moon Poya Day",
      "mercantile": false,
      "poya": true
    }
  ],
  "source": "Central Bank of Sri Lanka bank holiday lists (2027: Gazette 2493/05)",
  "note": "(first two of the list shown)"
}

GET /api/v1/holidays/next?from=2027-01-01

{
  "from": "2027-01-01",
  "holiday": {
    "date": "2027-01-15",
    "name": "Tamil Thai Pongal Day",
    "mercantile": true,
    "poya": false
  },
  "daysAway": 14
}

GET /api/v1/nic/911042754V

{
  "input": "911042754V",
  "valid": true,
  "format": "old",
  "issues": [],
  "birthDate": "1991-04-13",
  "weekday": "Saturday",
  "gender": "Male",
  "year": 1991,
  "serial": "275",
  "checkDigit": "4",
  "otherLayout": "199110402754",
  "note": "Checks the format and decodes it. It does not prove that a card was issued: the check digit is not published."
}

GET /api/v1/phone/0771234567

{
  "input": "0771234567",
  "valid": true,
  "reason": "",
  "note": "",
  "e164": "+94771234567",
  "international": "+94 77 123 4567",
  "local": "077 123 4567",
  "kind": "mobile"
}

GET /api/v1/amount-in-words?amount=1250.50

{
  "amount": "1250.50",
  "style": "title",
  "words": "Rupees One Thousand Two Hundred and Fifty and Cents Fifty Only",
  "figure": "Rs. 1,250.50"
}

GET /api/v1/singlish?text=ayubowan

{
  "input": "ayubowan",
  "sinhala": "අයුබොවන්"
}

Fair use

  • Free for personal and commercial projects. If your site or app shows the data, a credit link helps keep it free: Data from <a href="https://hirantha.me/developers">hirantha.me</a>. Not a developer? The free holiday widgets need no key.
  • 1,000 requests per key per day (UTC); the answer headers say how many are left. Over the limit you get HTTP 429.
  • Holidays come from the Central Bank of Sri Lanka lists for 2026 and 2027. The NIC check reads the number's layout; it does not prove a card was issued. Check anything important against the official source.
  • No warranty and no uptime promise. Keys that abuse the service are revoked.