> For the complete documentation index, see [llms.txt](https://docs.ziomark.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ziomark.xyz/get-endpoints/translate.md).

# Translate

## /translate

This endpoint translates text from one language to another based on the provided parameters. It accepts a GET request with query parameters including the `text`, `fromLang`, and `toLang`. If any of these parameters are missing, it returns a custom HTML page indicating missing parameters. If the translation is successful, it returns the original text along with its translation. If the translation fails or an error occurs, it returns a corresponding error message with a status code of 500.

### Query Parameters

| Parameter | Type   | Description                                          |
| --------- | ------ | ---------------------------------------------------- |
| text      | string | The text to be translated.                           |
| fromLang  | string | The language code of the text to be translated from. |
| toLang    | string | The language code of the text to be translated to.   |

### Example Usage

Translate "Hello, how are you?" from English to Spanish:

`GET /translate?text=Hello how are you&fromLang=en&toLang=es`

### Example Response

```
{
  "originalText": "Hello, how are you?",
  "translatedText": "¡Hola, ¿cómo estás?"
}
```

### Languages Supported

Go find all the language codes and their corresponding ISO 639-1 or RFC3066 codes online or in language code standards documentation.
