UtilitiesPopular

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.

Endpoint:/api/v1/translate
Methods:GETPOST
Latency:~500ms (AI) / ~5ms (cached)

Try it out

POST/api/v1/translate

Parameters

Code

curl
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

FieldTypeRequiredDescription
textstringRequiredText to translate (max 5000 characters)
sourcestringOptionalSource language code or 'auto' for detection
targetstringOptionalTarget language code (22 supported)
formalitystringOptionalRegister: 'formal' or 'informal'

Supported Languages

Arabic (ar)English (en)French (fr)Spanish (es)German (de)Turkish (tr)Urdu (ur)Persian (fa)Hindi (hi)Chinese (zh)Japanese (ja)Korean (ko)Russian (ru)Portuguese (pt)Italian (it)Dutch (nl)Polish (pl)Indonesian (id)Malay (ms)Swahili (sw)Hebrew (he)Bengali (bn)

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

PlanRequests/MonthRate Limit
Free5005 req/min
Starter5,00030 req/min
Professional50,000120 req/min
Business250,000500 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.