Translation API
AI-powered translation across 22 languages using Google Gemini 2.5 Flash. Features Arabic transliteration (romanization), auto-detection, formal/informal register, and 24-hour intelligent caching via Valkey.
/api/v1/translateTry it out
/api/v1/translateParameters
Code
curl -X POST "https://khaleejiapi.dev/api/v1/translate?text=Hello%2C%20how%20are%20you%3F&source=auto&target=ar&formality=formal" \ -H "Authorization: Bearer your_api_key"Methods
GET — Language Info
Returns the list of 22 supported languages with codes, names, and RTL flags. No parameters needed.
POST — Translate Text
Translate text between languages. Submit the text, source, target, and formality in the request body.
POST Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| text | string | Required | Text to translate (max 5000 characters) |
| source | string | Optional | Source language code or 'auto' for detection |
| target | string | Optional | Target language code (22 supported) |
| formality | string | Optional | Register: 'formal' or 'informal' |
Supported Languages
RTL languages: Arabic, Urdu, Persian, Hebrew
Response Fields
translatedText
The translated text result
transliteration
Arabic romanization (when source or target is Arabic)
confidence
Translation confidence score (0–1)
cached
Whether the result came from the 24-hour cache
Rate Limits
| Plan | Requests/Month | Rate Limit |
|---|---|---|
| Free | 500 | 5 req/min |
| Starter | 5,000 | 30 req/min |
| Professional | 50,000 | 120 req/min |
| Business | 250,000 | 500 req/min |
Debugging & Support
Include X-Request-ID when contacting support
Every response from KhaleejiAPI includes an X-Request-ID header — a unique identifier that lets our support team pull the exact log entry for your request within seconds. Always share it when reporting an unexpected error or unexpected result.
How to capture it
JavaScript / fetch
const res = await fetch("https://khaleejiapi.dev/api/v1/...", {
headers: { Authorization: "******" },
});
const requestId = res.headers.get("x-request-id");
console.log("Request ID:", requestId);
// → e.g. "req_01j9xkz4vp8..."cURL
curl -si "https://khaleejiapi.dev/api/v1/..." \ -H "Authorization: ******" | grep -i x-request-id # → x-request-id: req_01j9xkz4vp8...
Browser DevTools
Open DevTools (F12) → Network tab → click the failing request → scroll to the Response Headers section → copy the value next to x-request-id.
For a full list of error codes and guidance on common issues, see the Troubleshooting guide.