This document provides comprehensive instructions on how to interact with the LingoX real-time translation API.
Back to AppFetches the list of supported languages, along with default source and target languages for UI configuration.
{
"supported_languages": [
["en-US", "English"],
["vi", "Vietnamese"],
...
],
"default_source": "en-US",
"default_target": "vi"
}
{
"error": "Service temporarily unavailable."
}
| Language Code | Language Name |
|---|
Creates a session (a room) for a Multi-Device Mode conversation. Sessions expire after 15 minutes (900 seconds) of inactivity.
{
"language": "en-US",
"translate_language": "vi"
}
{
"conversation_id": "a-unique-uuid-string",
"join_url": "http://your-host/join/a-unique-uuid-string"
}
{
"error": "Redis service is unavailable."
}
Retrieves details for an existing multi-device session, primarily to check the initiator's language settings.
{
"user_a_lang": "en-US",
"user_a_translate": "vi"
}
{
"error": "Session not found."
}
{
"error": "Redis service is unavailable."
}
These modes use a single, stateful WebSocket connection. The client sends a configuration message to set the languages and can send a new one at any time to change them.
wss://your-domain.com/api/v1/ws/single
{
"type": "config",
"source_lang": "en-US",
"target_lang": "vi"
}
{
"is_final": false,
"original": "The transcribed text from the source language.",
"translation": "The translated text in the target language."
}
is_final: false: An interim, non-final result. The UI should display this for responsiveness but expect it to change.is_final: true: A final, complete utterance. This is the definitive transcript and translation for a sentence or phrase.This mode uses a REST endpoint to create a session and then a unique WebSocket endpoint for each participant in that session.
wss://your-domain.com/api/v1/ws/{conversation_id}?language={user_language_code}
Example: wss://localhost:5566/api/v1/ws/xyz-123?language=en-US
System Events:
// Notifies clients of connection status changes
{
"type": "user_joined" | "user_left",
"client_count": 2
}
// Informs a client of their partner's language upon connection
{
"type": "partner_language",
"lang": "vi"
}
Transcription/Translation:
{
"is_mine": true,
"is_interim": false,
"original": "The transcribed text.",
"translation": "The translated text (or original if no translation needed)."
}
is_mine: true if the message originated from this client; false otherwise. This allows the UI to position the message correctly (e.g., on the right or left side of a chat window).is_interim: true for real-time, partial transcripts sent only to the speaker (`is_mine: true`) for a responsive feel. false for the final, complete utterance sent to all clients in the room.