# Migrate from Azure Translator

Move an Azure Translator v3 integration to VibeQL by changing the endpoint and the subscription key.

VibeQL serves the Azure Translator v3 text format and the synchronous document translation endpoint. Change the endpoint and the key, and keep your request code.

| | Azure | VibeQL |
|---|---|---|
| Text endpoint | `https://api.cognitive.microsofttranslator.com` | `https://vibeql.com` |
| Document endpoint | `https://<resource>.cognitiveservices.azure.com` | `https://vibeql.com` |
| Key | `Ocp-Apim-Subscription-Key` Azure key | `Ocp-Apim-Subscription-Key` VibeQL key |

VibeQL does not use the `Ocp-Apim-Subscription-Region` header. You can leave it in or take it out.

> **Note:** Every text request needs `api-version=3.0` in the query string. Without it, `/translate` and `/languages` do not reach the API. With a different value, the API returns `400`.

## Translate

`POST https://vibeql.com/translate?api-version=3.0&to=de`

| Query parameter | Required | Description |
|---|---|---|
| `api-version` | Yes | `3.0` |
| `to` | Yes | Target language. Repeat it for up to 10 languages. |
| `from` | No | Source language. Leave it out and the API detects it. |

The body is a JSON array of up to 50 items with a `Text` field.

```bash
curl "https://vibeql.com/translate?api-version=3.0&to=de&to=ja" \
  -H "Ocp-Apim-Subscription-Key: $VIBEQL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[{"Text": "The meeting starts at nine."}]'
```

```json
[
  {
    "detectedLanguage": { "language": "en", "score": 1 },
    "translations": [
      { "text": "Das Meeting beginnt um neun.", "to": "de" },
      { "text": "会議は9時に始まります。", "to": "ja" }
    ]
  }
]
```

`detectedLanguage` is present only when you leave out `from`. Usage counts the source characters once for each `to` language. Other Azure options, such as `textType` or `profanityAction`, are ignored.

## Detect the language

`POST https://vibeql.com/detect?api-version=3.0`

```bash
curl "https://vibeql.com/detect?api-version=3.0" \
  -H "Ocp-Apim-Subscription-Key: $VIBEQL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[{"Text": "Hola, ¿cómo estás?"}]'
```

```json
[{ "language": "es", "score": 1, "isTranslationSupported": true, "isTransliterationSupported": false }]
```

## List languages

`GET https://vibeql.com/languages?api-version=3.0` returns the `translation` scope. Unlike Azure, this endpoint needs a key.

```bash
curl "https://vibeql.com/languages?api-version=3.0" \
  -H "Ocp-Apim-Subscription-Key: $VIBEQL_API_KEY"
```

```json
{ "translation": { "de": { "name": "German", "nativeName": "German", "dir": "ltr" } } }
```

## Translate a document

`POST https://vibeql.com/translator/document:translate` translates one file and returns it in the response. Send the file as the multipart field `document`.

| Query parameter | Required | Description |
|---|---|---|
| `api-version` | Yes | `2024-05-01` |
| `targetLanguage` | Yes | Target language. |
| `sourceLanguage` | No | Source language. |

```bash
curl "https://vibeql.com/translator/document:translate?targetLanguage=fr&api-version=2024-05-01" \
  -H "Ocp-Apim-Subscription-Key: $VIBEQL_API_KEY" \
  -F "document=@contract.docx" \
  -o contract.fr.docx
```

The request waits up to 90 seconds. If the translation takes longer, the API returns `504`. For large files, use the [DeepL document flow](/docs/translate-documents), which has no time limit per request. Formats: DOCX, PPTX, PDF and TXT.

The `glossary` field and the batch document translation API are not available.

## Language codes

VibeQL supports 34 target languages, fewer than Azure. A code that VibeQL does not support returns `400`. See [Languages](/docs/languages).

> **Important:** In Azure, `pt` means Brazilian Portuguese. In VibeQL, `pt` means European Portuguese. Send `pt-BR` for Brazilian Portuguese.

- `zh-Hans` and `zh-Hant` work as in Azure.
- `en` maps to American English. Send `en-GB` for British English.
- Codes are not case-sensitive.

## Errors

Errors use the Azure format, with a six-digit code that starts with the HTTP status:

```json
{ "error": { "code": 403000, "message": "Authorization failure, check auth_key" } }
```

See [Limits and errors](/docs/limits-and-errors) for all status codes. Transliteration, dictionary lookup and sentence break endpoints are not available.
