All plans have 30% OFF For this week

Claim Discount

Translations

Translations API Reference

The Translations API in AnswerPal provides endpoints for translating arbitrary text using AI. This page documents the endpoints, request and response data models, and practical examples for seamless integration.

Endpoints

Translate Arbitrary Text

POST /api/Translations/translate Translates the given text to the specified target language using AI.

Request Body

Example:
{ "sourceText": "Hello, how are you?", "targetLang": "fr" }

Request Data Model

Property: sourceText Type: string Description: The text to translate. Required.

Property: targetLang Type: string Description: The target language (ISO 639-1 or 639-3 code, e.g. “fr”, “de”). Required.

Response Body

Example: “Bonjour, comment allez-vous ?”

Response Data Model

Type: string Description: The translated text (as a string).

POST /api/Translations/translate Content-Type: application/json
{ "sourceText": "Thank you for your message.", "targetLang": "de" }

“Danke für Ihre Nachricht.”

 Error Codes:

  • 400 Bad Request: Missing or invalid sourceText/targetLang.
  • 404 Not Found: Customer not found.
  • 500 Internal Server Error: Error during translation.

Detect Language with AI

GET /api/Translations/detect-language-ai?country=…&state=…&city=…

Detects the most likely language based on location information using AI.

Request Parameters

Parameter: country Type: string Description: Country name (required)

Parameter: state Type: string Description: State or region (optional)

Parameter: city Type: string Description: City (optional)

Response Example

“nl” (ISO language code)

Error Codes:

  • 400 Bad Request: Missing required parameter.
  • 500 Internal Server Error: Error during detection.

Data Models

TranslateRequest Object

Property: sourceText Type: string

Description: The text to translate. Required.

Property: targetLang Type: string

Description: The target language (ISO 639-1 or 639-3 code, e.g. “fr”, “de”). Required.

Translate Response

The translated text is returned as a plain string.

See Also: For per-channel UI/message translations (such as chat window greetings, button labels, and more), see the Channel Translations documentation in the Channels API Reference.

Any language supported by the underlying AI translation provider (typically ISO 639 codes).

Only plain text is supported for /api/Translations/translate. Use /api/Translations/translate-to-html for HTML output.

Table of Contents

AnswerPal: AI-powered customer service solutions to elevate your support and communication effortlessly.

Contact

For all support, sales, and partnership inquiries, email us at info@answerpal.eu