JavaScriptConverter API
Convert JavaScript to TypeScript programmatically. The API mirrors the online converter: POST JavaScript source, get back idiomatic TypeScript plus a per-transform diagnostics list. Same deterministic AST engine, no LLM.
Base URL
https://javascriptconverter.com
All endpoints are versionless and accept JSON request bodies. Responses are always JSON.
Authentication
The single-file conversion endpoint is available to anonymous callers within the free-tier limits. Authenticated callers on the Pro or Max plan get higher limits and priority routing.
For authenticated calls, include your session cookie (browser flow) or an API key in the
X-API-Key header (programmatic flow). Generate an API key
from the dashboard once you're on a paid plan.
POST /api/ConvertApi/code
Convert a single JavaScript source file to TypeScript.
Request body
{
"code": "string", // the JavaScript source (max 50,000 chars)
"filename": "string" // e.g. "app.js" or "Button.jsx"
}
Response — 200 OK
{
"convertedCode": "string",
"diagnostics": [
{
"file": "string",
"line": number | null,
"message": "string",
"severity": "'info' | 'warning' | 'error'"
}
]
}
Filename matters
The filename's extension is the only signal the engine has to pick the right transforms:
.js/.jsx are treated as
JavaScript and produce .ts/.tsx
output. Files containing JSX are auto-detected even if the input extension is
.js.
Rate limits and quotas
| Tier | Calls / day | Max code size | Priority |
|---|---|---|---|
| Anonymous | 60 | 50,000 chars | Standard |
| Free (signed in) | 200 | 50,000 chars | Standard |
| Basic ($19/mo) | 1,000 | 50,000 chars | Higher |
| Pro ($49/mo) | 10,000 | 50,000 chars | Higher |
| Max ($79/mo) | Unlimited | 50,000 chars | Highest |
For ZIP-based batch conversion of entire projects, use the dashboard upload UI or the free desktop app.
Error codes
Missing code or filename, or code over 50,000 characters.
Daily quota exceeded for your tier. Upgrade your plan or wait until the quota resets at 00:00 UTC.
Unhandled conversion error. The response body includes a sanitized error message.
The underlying engine isn't responding. Retry with exponential backoff.
Conversion took longer than the per-request timeout. Send a smaller file.
Client examples
curl
curl -X POST https://javascriptconverter.com/api/ConvertApi/code \
-H "Content-Type: application/json" \
-H "X-API-Key: $JSC_API_KEY" \
-d '{ "code": "module.exports = { add: (a,b) => a+b };", "filename": "math.js" }'
JavaScript (fetch)
const res = await fetch('https://javascriptconverter.com/api/ConvertApi/code', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': process.env.JSC_API_KEY
},
body: JSON.stringify({
code: "const fs = require('fs');",
filename: 'index.js'
})
});
const { convertedCode, diagnostics } = await res.json();
Python (requests)
import requests, os
r = requests.post(
"https://javascriptconverter.com/api/ConvertApi/code",
headers={"X-API-Key": os.environ["JSC_API_KEY"]},
json={"code": "exports.add = (a,b) => a+b;", "filename": "math.js"},
timeout=30,
)
r.raise_for_status()
print(r.json()["convertedCode"])
Ready to integrate?
Try the endpoint anonymously first, then sign up for a Pro or Max plan to unlock production-grade quotas.