pages.api_docs.getting_started
pages.api_docs.getting_started_intro
Base URL
https://api.culturaltranslate.com/v1
All endpoints are versioned and return JSON. Use HTTPS.
Note: All API requests must be made over HTTPS. Requests over HTTP will fail.
pages.api_docs.authentication
Authenticate your API requests using Bearer tokens. You can generate API keys from your dashboard.
curl -X POST https://api.culturaltranslate.com/v1/translate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Hello", "target_language": "ar"}'
await fetch('https://api.culturaltranslate.com/v1/translate', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({ text: 'Hello', target_language: 'ar' })
});
$client = new \GuzzleHttp\Client(['base_uri' => 'https://api.culturaltranslate.com']);
$res = $client->post('/v1/translate', [
'headers' => [ 'Authorization' => 'Bearer YOUR_API_KEY' ],
'json' => [ 'text' => 'Hello', 'target_language' => 'ar' ]
]);
echo $res->getBody();
pages.api_docs.translation_api
pages.api_docs.translate_text
pages.api_docs.translate_text_intro
POST /v1/translate
Rate limit: 60 req/min
{
"text": "Hello, world!",
"source_language": "en",
"target_language": "ar",
"ai_model": "gpt-4",
"cultural_adaptation": true,
"preserve_brand_voice": true,
"formal_tone": false
}
Use
cultural_adaptation to apply region-specific idioms and tone.pages.api_docs.response
{
"success": true,
"data": {
"translated_text": "مرحباً بالعالم!",
"source_language": "en",
"target_language": "ar",
"characters_used": 13,
"quality_score": 0.95
}
}
Responses include quality metrics and usage counters.
pages.api_docs.batch_translation
POST /v1/translate/batch
{
"texts": ["Hello", "Goodbye", "Thank you"],
"source_language": "en",
"target_language": "ar"
}
Batch requests process texts sequentially and return an array of translations.
pages.api_docs.voice_translation
pages.api_docs.speech_to_text
POST /v1/voice/speech-to-text
{
"audio_url": "https://example.com/audio.mp3",
"source_language": "en"
}
Supports Whisper, Azure Speech, and Deepgram. See
services.asr config.pages.api_docs.text_to_speech
POST /v1/voice/text-to-speech
{
"text": "Hello, world!",
"language": "en",
"voice": "male",
"cultural_tone": true
}
Voices depend on provider (Azure, Google, ElevenLabs). See
services.tts.pages.api_docs.visual_translation
pages.api_docs.translate_image
POST /v1/visual/translate-image
{
"image_url": "https://example.com/image.jpg",
"target_language": "ar",
"preserve_layout": true
}
Enable layout preservation for screenshots and UI mocks.
pages.api_docs.translate_document
POST /v1/visual/translate-document
{
"document_url": "https://example.com/doc.pdf",
"target_language": "ar",
"format": "pdf"
}
Documents support PDF, DOCX, and images. Long PDFs can be processed async.
pages.api_docs.error_handling
pages.api_docs.error_handling_intro
200 - OK
Request succeeded
400 - Bad Request
Invalid request parameters
401 - Unauthorized
Invalid or missing API key
429 - Too Many Requests
Rate limit exceeded
Rate Limits: 60 requests/min per API key by default. 429 indicates throttling. Contact support to raise limits.
Webhook Verification
$signature = request()->header('X-Signature');
$secret = env('WEBHOOK_SECRET');
$expected = hash_hmac('sha256', request()->getContent(), $secret);
abort_unless(hash_equals($expected, $signature), 401);
All webhook payloads are signed with HMAC-SHA256. Reject mismatches.