Skip to content

API quickstart

Translate text, a list of strings, JSON, or HTML with one key. Every page below is the request the API accepts today.

Base URL

https://edge.harktranslate.com/api/v1/translator

Send x-hark-key on every request. Keys come from the RapidAPI listing. Volume past MEGA uses the contact form. Every status and machine code is on the error catalog.

Swagger UI

First call

  1. Put your key in the header, or export HARK_API_KEY for the JavaScript and Python samples.
  2. POST /text with from, to, and text.
  3. Read trans from the JSON body. Success is HTTP 200.

Plain text

curl
curl -X POST "https://edge.harktranslate.com/api/v1/translator/text" \
  -H "x-hark-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "from": "en",
  "to": "vi",
  "text": "Hello"
}
JSON
JavaScript
const response = await fetch("https://edge.harktranslate.com/api/v1/translator/text", {
  method: "POST",
  headers: {
    "x-hark-key": process.env.HARK_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "from": "en",
    "to": "vi",
    "text": "Hello"
  }),
});

if (!response.ok) {
  throw new Error(`Hark responded ${response.status}`);
}

console.log(await response.json());
Python
import os
import requests

response = requests.post(
    "https://edge.harktranslate.com/api/v1/translator/text",
    headers={"x-hark-key": os.environ["HARK_API_KEY"]},
    json={
        "from": "en",
        "to": "vi",
        "text": "Hello",
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Endpoints