/api/v1
GET /languages
Response: List of all available languages.
POST /languages
Body:
{
"isoCode": "en"
}Response: Created language object.
GET /languages/:isoCode
Response: Language object.
PUT /languages/:isoCode
Body:
{
"name": "Updated Name"
}Response: Updated language object.
DELETE /languages/:isoCode
Response: No content.
GET /translations
Response: List of all translations.
POST /translations
Body:
{
"originalText": "Hello",
"originalLanguageCode": "en",
"translatedLanguageCode": "fr",
"translatedText": "Bonjour"
}Response: Created translation object.
GET /translations/:hash
Response: List of translations for the given text hash.
GET /translations/:isoCode
Response: List of translations in the given language.
GET /translations/:hash/:isoCode
Response: Translation object.
PUT /translations/:hash/:isoCode
Body:
{
"originalText": "Hello",
"translatedText": "Salut"
}Response: Updated translation object.
DELETE /translations/:hash/:isoCode
Response: No content.
POST /translations/:hash/:isoCode/approve
Response: Approved translation object.
POST /translations/openAI
Body:
{
"originalText": "Hello",
"originalLanguageCode": "en",
"translatedLanguageCode": "es"
}Response: Translation object created using OpenAI.
POST /translations/openAI/batch
Body:
{
"texts": ["Hello", "Good morning", "How are you?"],
"originalLanguageCode": "en",
"translatedLanguageCode": "es"
}Response:
{
"translations": [
{
"originalText": "Hello",
"translation": {
"hash": "...",
"originalText": "Hello",
"translatedText": "Hola",
"originalLanguageCode": "en",
"translatedLanguageCode": "es",
"isApproved": false,
"createdAt": "...",
"updatedAt": "..."
},
"success": true
},
{
"originalText": "Good morning",
"translation": { ... },
"success": true
},
{
"originalText": "How are you?",
"translation": { ... },
"success": true
}
],
"total": 3,
"successful": 3,
"failed": 0
}This endpoint allows translating multiple texts in a single request. Each text is processed independently, and if a translation already exists in the database, it will be reused. The response includes individual success/failure status for each translation, along with summary statistics.
- The
hashparameter is generated using SHA-256 fromoriginalText. - The OpenAI translation request utilizes
gpt-4o-mini. - All responses follow JSON format.
- Errors return appropriate HTTP status codes with messages.
- The API is generated by ChatGPT - watch out for inconsistencies


