Skip to main content
POST
/
v1
/
translate
Translate
curl --request POST \
  --url https://api.trynawa.com/v1/translate

Documentation Index

Fetch the complete documentation index at: https://developers.trynawa.com/llms.txt

Use this file to discover all available pages before exploring further.

Translate text between English and Arabic with dialect awareness. Generates culturally appropriate translations in Gulf, Egyptian, Levantine, or MSA Arabic.
Cost: $0.005 per request (5 credits). Semantic cache hits are free (X-NAWA-Cache: HIT).

Request

Headers

HeaderRequiredDescription
AuthorizationYesBearer nawa_live_sk_xxx or Bearer nawa_test_sk_xxx
Content-TypeYesapplication/json

Body parameters

ParameterTypeRequiredDescription
textstringYesThe text to translate. Max 5,000 characters.
sourcestringNoSource language: ar, en, auto. Default: auto (detects automatically).
targetstringYesTarget language: ar, en.
dialectstringNoTarget dialect for Arabic output: gulf, egyptian, levantine, msa. Default: msa.
tonestringNoTranslation tone: formal, casual, social_media. Default: formal.
platformstringNoSource platform for social media tone context: youtube, instagram, twitter, facebook.
metadataobjectNoArbitrary key-value metadata to attach to the translation.

Example request

  curl -X POST https://api.trynawa.com/v1/translate \
    -H "Authorization: Bearer nawa_test_sk_xxx" \
    -H "Content-Type: application/json" \
    -d '{
      "text": "Hello, how are you?",
      "source": "en",
      "target": "ar",
      "dialect": "gulf",
      "tone": "casual"
    }'

Response

Success response (200)

{
  "success": true,
  "result": {
    "id": "trn_nw_pon1yom9bkfe",
    "object": "translation",
    "text": "Hello, how are you?",
    "translated_text": "هلا، كيف حالك؟",
    "source_language": "en",
    "target_language": "ar",
    "source_dialect": null,
    "target_dialect": "gulf",
    "tone": "casual",
    "model": "nagl-v1",
    "provider": "allam",
    "fallback_used": false,
    "cached": false,
    "cost_usd": 0.005,
    "credits_used": 5
  },
  "errors": [],
  "request_id": "req_nw_4c11w71e44cb"
}

Result fields

FieldTypeDescription
textstringThe original input text
translated_textstringThe translated output
source_languagestringDetected or specified source language
target_languagestringTarget language
source_dialectstring or nullDetected dialect if source is Arabic
target_dialectstring or nullTarget dialect if target is Arabic
tonestringThe tone used for translation
modelstringModel version used
providerstringAI provider used (allam or claude)
fallback_usedbooleanWhether the fallback provider was used
cachedbooleanWhether served from semantic cache
cost_usdnumberCost in USD
credits_usednumberCredits deducted

Dialect examples

Input: “The food was amazing, thank you so much” Output: “الأكل كان وايد حلو، مشكور وايد”
    curl -X POST https://api.trynawa.com/v1/translate \
      -H "Authorization: Bearer nawa_test_sk_xxx" \
      -H "Content-Type: application/json" \
      -d '{"text": "The food was amazing, thank you so much", "source": "en", "target": "ar", "dialect": "gulf", "tone": "casual"}'
Input: “Subscribe to my channel for more content!” Output: “اشتركوا في القناة عشان يوصلكم كل جديد!”
    curl -X POST https://api.trynawa.com/v1/translate \
      -H "Authorization: Bearer nawa_test_sk_xxx" \
      -H "Content-Type: application/json" \
      -d '{"text": "Subscribe to my channel for more content!", "source": "en", "target": "ar", "dialect": "egyptian", "tone": "social_media", "platform": "youtube"}'
Input: “وش رايكم بالمحتوى الجديد؟” Output: “What do you think of the new content?”
    curl -X POST https://api.trynawa.com/v1/translate \
      -H "Authorization: Bearer nawa_test_sk_xxx" \
      -H "Content-Type: application/json" \
      -d '{"text": "وش رايكم بالمحتوى الجديد؟", "source": "ar", "target": "en", "tone": "formal"}'
Input: “كيف حالك اليوم؟” (MSA) Output: “شلونك اليوم؟” (Gulf)
    curl -X POST https://api.trynawa.com/v1/translate \
      -H "Authorization: Bearer nawa_test_sk_xxx" \
      -H "Content-Type: application/json" \
      -d '{"text": "كيف حالك اليوم؟", "source": "ar", "target": "ar", "dialect": "gulf", "tone": "casual"}'

Error responses

StatusTypeWhen
400invalid_request_errorMissing text, source, or target. Invalid values. Text too long.
401authentication_errorInvalid or missing API key
402insufficient_creditsNo credits remaining
429rate_limit_errorRate limit exceeded
500api_errorInternal or provider error