Translator API
This API provides automatically detects the source language of your provided text and translates it into English. Supporting upto 240+ languages.
Endpoint
Section titled “Endpoint” POST
/api/v1/translate Request Parameters
Section titled “Request Parameters”The following parameters are accepted in the request body:
| Field | Type | Required | Description |
|---|---|---|---|
text | string | Yes | The text you want to translate. |
Request Examples
Section titled “Request Examples”curl -X POST https://heavstal.com.ng/api/v1/translate \-H "Content-Type: application/json" \-H "x-api-key: <YOUR_API_KEY>" \-d '{"text": "Bonjour tout le monde"}'const response = await fetch('https://heavstal.com.ng/api/v1/translate', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-api-key': '<YOUR_API_KEY>' }, body: JSON.stringify({ text: "Bonjour tout le monde" })});
const res = await response.json();console.log(res.data.translated);import { tools } from '@heavstal/api';
const translation = await tools.translate("Bonjour tout le monde");console.log(translation.data.translated); // "Hello everyone"import requests
url = "https://heavstal.com.ng/api/v1/translate"headers = { "Content-Type": "application/json", "x-api-key": "<YOUR_API_KEY>"}payload = { "text": "Bonjour tout le monde"}
response = requests.post(url, headers=headers, json=payload)print(response.json()["data"])Response Examples
Section titled “Response Examples”{ "status": "success", "creator": "HEAVSTAL TECH", "data": { "original": "Bonjour tout le monde", "translated": "Hello everyone", "source_language": "fr", "pronunciation": "bon-zhoor..." }}{ "status": "error", "error": "Could not detect source language."}