Overview
This API converts Nepali text between three formats: Roman (English keyboard typing), Unicode Devanagari, and Preeti font encoding. It uses a word-dictionary plus phoneme engine for accurate results — e.g. hamro ghar correctly becomes हाम्रो घर.
Endpoint
POST https://pradipsubedi1.com.np/api/convert.php
GET https://pradipsubedi1.com.np/api/convert.php?action=roman_to_unicode&text=namaste
Parameters
| Parameter | Type | Description |
|---|---|---|
action | string (required) | roman_to_unicode · unicode_to_roman · preeti_to_unicode · unicode_to_preeti |
text | string | Input text to convert (max 50,000 chars) |
JavaScript Example
async function nepaliConvert(action, text) {
const res = await fetch("https://pradipsubedi1.com.np/api/convert.php", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action, text })
});
const data = await res.json();
return data.success ? data.result : Promise.reject(data.error);
}
nepaliConvert("roman_to_unicode", "hamro ghar")
.then(result => console.log(result)); // हाम्रो घर
PHP Example
$payload = json_encode(["action" => "roman_to_unicode", "text" => "namaste"]);
$ch = curl_init("https://pradipsubedi1.com.np/api/convert.php");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
]);
$data = json_decode(curl_exec($ch), true);
echo $data["result"]; // नमस्ते
Response
{ "success": true, "result": "नमस्ते" }
Note: Rate limit is 120 requests/minute per IP. CORS is open for all origins so this works from any website.
Embeddable Widget
Add a ready-made converter widget to any page with one script tag:
<div id="np-converter"
data-action="roman_to_unicode"
data-tabs="true"
data-theme="auto"
data-width="100%"
data-radius="12px"
data-branding="true">
</div>
<script src="http://localhost/dev-assets/nepali-converter.js"></script>
Try the full interactive version on the Nepali Unicode Converter page.