Skip to main content

National Data Exchange (NDX)

This guide shows how to authenticate and fetch data from the DIS Open NDX (National Data Exchange).

Architecture​

Base URLs​

PurposeURL
Token endpointhttps://ndx-thunderid.stg.dis.govtech.lk/oauth2/token
Data APIhttps://ndx-consumer-app.stg.dis.govtech.lk

Authentication​

curl -X POST https://ndx-thunderid.stg.dis.govtech.lk/oauth2/token \
-u "YjrmqEYNsUWynAQvhNQCWg:YiL014vJ9cF_7yWWkDknjeVblq4O5dv1vIBogQR-zAo" \
-d "grant_type=client_credentials"
{
"access_token": "eyJhbGciOi...",
"token_type": "bearer",
"expires_in": 3600
}

Configure your application with this client_id and client_secret. Cache the returned token and reuse it until it's close to expires_in.

Get person data​

curl -X POST https://ndx-consumer-app.stg.dis.govtech.lk/api/query/person \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"idCardNumber": "736604450V"}'
{
"data": {
"nicInfo": {
"id": "nic-001",
"fullNameEnglish": "Athanayaka Mudiyanselage Lal Senathilake",
"fullNameSinhala": "අත්තනායක මුදියන්සේලාගේ ලාල් සේනතිලක",
"nicStatus": "ACTIVE",
"issueDate": "14/07/2016",
"placeOfBirthEnglish": "HAPUTHALE",
"contactPhoneNo": "0771234567"
}
}
}

Get farmer data​

curl -X POST https://ndx-consumer-app.stg.dis.govtech.lk/api/query/farmer \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"idCardNumber": "736604450V"}'
{
"data": {
"farmerInfo": {
"farmerId": "FARM000123",
"fullName": "Athanayaka Mudiyanselage Lal Senathilake",
"gender": "MALE",
"mobile": "0771234567",
"address": "Palahiththagoda, Boralanda, Badulla",
"district": "Badulla",
"dsDivision": "Haputale",
"agrarianServiceCenter": "ASC001",
"farmerStatus": "ACTIVE",
"registeredDate": "2026-08-03"
}
}
}

Some fields require the citizen to approve access first. When that happens, the response looks like this instead of returning data:

{
"data": null,
"errors": [{
"message": "Consent not approved",
"extensions": {
"code": "CE_NOT_APPROVED",
"consentPortalUrl": "https://ndx-consent-portal.stg.dis.govtech.lk?consentId=..."
}
}]
}

Send the citizen to consentPortalUrl to approve, then retry the same request.

Support​

Contact the DIS Open NDX platform team, or open an issue on the dis-open-ndx repository.