sissejuhatus
tere tulemast i18n-agent tõlke api-sse! kultuuriline kohandamine ja tehisintellektil põhinev tõlketeenistus
see api dokumentatsioon annab põhjaliku ülevaate kõigist saadaval olevatest lõpp-punktidest, autentimismeetoditest, päring-/vastusevormingutest ja veakoodidest
baas-url-id
keskkond | url |
---|---|
arendus | http://localhost:8000 |
tootmine | https://api.i18nagent.ai |
põhiomadused
- 🌐 mitmekeelne tugi - tõlkige sisu üle 10 keele kultuurilise kohandamisega
- 🚀 reaalajas voogedastus - server-sent events edenemise uuenduste jaoks
- 📁 failitõlge - tugi json, yaml, xml, csv ja muude jaoks
- 🔐 turvaline autentimine - api võtmel põhinev autentimine
- 💳 krediidisüsteem - maksa kasutuse järgi
- 🤖 tehisintellektil põhinev - kasutab täpseks tõlkimiseks arenenud llm-e
autentimine
autentimiseks kasuta seda koodi:
# With shell, you can just pass the correct header with each request
curl "api_endpoint_here" \
-H "Authorization: Bearer i18n_your_api_key_here"
const headers = {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
};
fetch('api_endpoint_here', { headers })
.then(response => response.json())
.then(data => console.log(data));
import requests
headers = {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
response = requests.get('api_endpoint_here', headers=headers)
print(response.json())
package main
import (
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "api_endpoint_here", nil)
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
asenda
i18n_your_api_key_here
oma api võtmega.
i18n-agent api kasutab api võtmeid, et lubada juurdepääsu api-le. saad oma api võtme oma konto juhtpaneelilt.
api võti tuleb lisada kõikidesse api päringutesse serverile päisena, mis näeb välja järgmine:
Authorization: Bearer i18n_your_api_key_here
lõpp-punktid
teenuse teave
hangi teenuse teave
GET /
tagastab teenuse metaandmed ja saadaolevad lõpp-punktid
curl -X GET "https://api.i18nagent.ai/" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
ülaltoodud käsk tagastab json-i, mis on struktureeritud järgmiselt:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2025-09-19T08:57:08.356Z"
}
}
seire
tervise kontroll
GET /health
kontrolli teenuse tervise olekut
curl -X GET "https://api.i18nagent.ai/health" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/health', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/health',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/health", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
ülaltoodud käsk tagastab json-i, mis on struktureeritud järgmiselt:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2025-09-19T08:57:08.357Z"
}
}
krediidid
hangi meeskonna krediidid
GET /credits
hangi praegune krediidisaldo autenditud meeskonna jaoks
curl -X GET "https://api.i18nagent.ai/credits" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/credits', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/credits',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/credits", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
ülaltoodud käsk tagastab json-i, mis on struktureeritud järgmiselt:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2025-09-19T08:57:08.357Z"
}
}
keeled
loenda toetatud keeled
GET /languages
hangi loend kõigist toetatud keeltest koos kvaliteedihinnangutega
curl -X GET "https://api.i18nagent.ai/languages" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/languages', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/languages',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/languages", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
üle antud käsk tagastab json-struktuuri järgmiselt:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2025-09-19T08:57:08.357Z"
}
}
tõlge
Loo tõlge (ühendatud)
POST /translations
ühendatud lõpp-punkt nii teksti kui ka failisisu tõlkimiseks
curl -X POST "https://api.i18nagent.ai/translations" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}'
const response = await fetch('https://api.i18nagent.ai/translations', {
method: 'POST',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
})
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.post(
'https://api.i18nagent.ai/translations',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
json={
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
data := map[string]interface{}{
"texts": []string{"Hello, world!", "Welcome to our service"},
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", "https://api.i18nagent.ai/translations", bytes.NewBuffer(jsonData))
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
üle antud käsk tagastab json-struktuuri järgmiselt:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2025-09-19T08:57:08.357Z"
}
}
Päringuteksti parameetrid
Parameeter | Tüüp | Nõutav | Kirjeldus |
---|
Loo tõlge voogedastuse progressiga
POST /translations/stream
Loo tõlge Server-Sent Events (SSE) abil reaalajas progressiuuenduste saamiseks
curl -X POST "https://api.i18nagent.ai/translations/stream" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}'
const response = await fetch('https://api.i18nagent.ai/translations/stream', {
method: 'POST',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
})
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.post(
'https://api.i18nagent.ai/translations/stream',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
json={
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
data := map[string]interface{}{
"texts": []string{"Hello, world!", "Welcome to our service"},
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", "https://api.i18nagent.ai/translations/stream", bytes.NewBuffer(jsonData))
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
üle antud käsk tagastab json-struktuuri järgmiselt:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2025-09-19T08:57:08.357Z"
}
}
Päringuteksti parameetrid
Parameeter | Tüüp | Nõutav | Kirjeldus |
---|---|---|---|
texts | array | Yes | Array of texts to translate |
targetLanguage | string | Yes | Target language code (e.g., 'es', 'fr', 'ja') |
targetAudience | string | No | Target audience (e.g., 'general', 'technical', 'casual', 'formal') (default: general) |
industry | string | No | Industry context (e.g., 'technology', 'healthcare', 'finance') (default: technology) |
sourceLanguage | string | No | Source language code (auto-detected if not provided) |
region | string | No | Specific region for localization (e.g., 'Spain', 'Mexico', 'Brazil') |
context | string | No | Optional additional context or instructions for the translation (e.g., 'Keep technical terms in English', 'Use formal tone', 'Preserve brand names') |
Hangi tõlke maksumus-hinnang
POST /translations/estimate
Arvuta sõnade arv ja tõlkimiseks vajalikud krediidid
curl -X POST "https://api.i18nagent.ai/translations/estimate" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}'
const response = await fetch('https://api.i18nagent.ai/translations/estimate', {
method: 'POST',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
})
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.post(
'https://api.i18nagent.ai/translations/estimate',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
json={
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
data := map[string]interface{}{
"texts": []string{"Hello, world!", "Welcome to our service"},
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", "https://api.i18nagent.ai/translations/estimate", bytes.NewBuffer(jsonData))
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
üle antud käsk tagastab json-struktuuri järgmiselt:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2025-09-19T08:57:08.357Z"
}
}
Päringuteksti parameetrid
Parameeter | Tüüp | Nõutav | Kirjeldus |
---|---|---|---|
content | string | Yes | Content to analyze |
fileType | string | No | File type for content analysis (default: txt) |
Analüüs
Analüüsi sisu tõlkevalmiduse jaoks
POST /analyze
Analüüsi sisu, et tuvastada võimalikud probleemid ja saada parandusettepanekuid enne tõlkimist. See lõpp-punkt tarbib samu krediile kui tõlkimine (0,001 kreditti sõna kohta).
curl -X POST "https://api.i18nagent.ai/analyze" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}'
const response = await fetch('https://api.i18nagent.ai/analyze', {
method: 'POST',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
})
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.post(
'https://api.i18nagent.ai/analyze',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
json={
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
data := map[string]interface{}{
"texts": []string{"Hello, world!", "Welcome to our service"},
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", "https://api.i18nagent.ai/analyze", bytes.NewBuffer(jsonData))
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
üle antud käsk tagastab json-struktuuri järgmiselt:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2025-09-19T08:57:08.357Z"
}
}
Päringuteksti parameetrid
Parameeter | Tüüp | Nõutav | Kirjeldus |
---|---|---|---|
targetLanguage | string | Yes | Target language code for translation |
targetAudience | string | No | Target audience (default: general) |
industry | string | No | Industry context (default: general) |
sourceLanguage | string | No | Source language code (auto-detected if not provided) |
region | string | No | Specific region for localization |
content | object | Yes | Content to analyze (text, array of texts, or structured object) |
fileType | string | No | Optional file type if content is from a file |
tõlkimise_tööd
saada_tõlke_üksikasjad
GET /translations/{id}
saada_üksikasju_konkreetse_tõlke_kohta_id_järgi
curl -X GET "https://api.i18nagent.ai/translations/{id}" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/translations/{id}', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/translations/{id}',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/translations/{id}", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Ülaltoodud käsk tagastab JSON-i kujul nagu see:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2025-09-19T08:57:08.357Z"
}
}
päringu_parameetrid
parameeter | nõutav | kirjeldus |
---|---|---|
id | jah | tõlke_id |
--------- | -------- | ----------- |
id | Yes | Translation ID |
saada_tõlke_staatus
GET /translations/{id}/status
saada_tõlketöö_praegune_staatus
curl -X GET "https://api.i18nagent.ai/translations/{id}/status" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/translations/{id}/status', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/translations/{id}/status',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/translations/{id}/status", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Ülaltoodud käsk tagastab JSON-i kujul nagu see:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2025-09-19T08:57:08.357Z"
}
}
päringu_parameetrid
parameeter | nõutav | kirjeldus |
---|---|---|
id | jah | tõlke_id |
--------- | -------- | ----------- |
id | Yes | Translation ID |
laadi_alla_tõlke_tulemus
GET /translations/{id}/result
laadi_alla_tõlgitud_sisu
curl -X GET "https://api.i18nagent.ai/translations/{id}/result" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/translations/{id}/result', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/translations/{id}/result',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/translations/{id}/result", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Ülaltoodud käsk tagastab JSON-i kujul nagu see:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2025-09-19T08:57:08.357Z"
}
}
päringu_parameetrid
parameeter | nõutav | kirjeldus |
---|---|---|
id | jah | tõlke_id |
keel | ei | konkreetse_keele_tulemuse_kood |
--------- | -------- | ----------- |
id | Yes | Translation ID |
language | No | Language code for specific language result |
laadi_alla_algne_fail
GET /translations/{id}/original
laadi_alla_algne_üleslaaditud_fail
curl -X GET "https://api.i18nagent.ai/translations/{id}/original" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/translations/{id}/original', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/translations/{id}/original',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/translations/{id}/original", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Ülaltoodud käsk tagastab JSON-i kujul nagu see:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2025-09-19T08:57:08.357Z"
}
}
päringu_parameetrid
parameeter | nõutav | kirjeldus |
---|---|---|
id | jah | tõlke_id |
--------- | -------- | ----------- |
id | Yes | Translation ID |
jätka_tõlkimist_kontrollpunktist
POST /translations/{id}/resume
jätka_ebaõnnestunud_või_katkestatud_tõlkimist_konkreetsest_kontrollpunktist_või_automaatselt_viimasest_edukast_kontrollpunktist
curl -X POST "https://api.i18nagent.ai/translations/{id}/resume" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}'
const response = await fetch('https://api.i18nagent.ai/translations/{id}/resume', {
method: 'POST',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
})
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.post(
'https://api.i18nagent.ai/translations/{id}/resume',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
json={
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
data := map[string]interface{}{
"texts": []string{"Hello, world!", "Welcome to our service"},
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", "https://api.i18nagent.ai/translations/{id}/resume", bytes.NewBuffer(jsonData))
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Ülaltoodud käsk tagastab JSON-i kujul nagu see:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2025-09-19T08:57:08.357Z"
}
}
päringu_parameetrid
parameeter | nõutav | kirjeldus |
---|---|---|
id | jah | tõlke_id |
--------- | -------- | ----------- |
id | Yes | Translation ID |
päringuteksti_parameetrid
Parameeter | Tüüp | Nõutav | Kirjeldus |
---|---|---|---|
checkpointId | string | No | Opaque checkpoint ID to resume from (obtained from status endpoint). If not provided and autoDetect is true, will resume from last successful checkpoint. |
continueToEnd | boolean | No | Whether to continue processing all remaining content after resuming (default: true) |
autoDetect | boolean | No | Automatically detect and resume from the last successful checkpoint if checkpointId is not provided (default: true) |
Hangi hetkel aktiivsed tõlketööd
GET /translations/jobs/active
Hangi hetkel aktiivsete tõlketööde loend
curl -X GET "https://api.i18nagent.ai/translations/jobs/active" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/translations/jobs/active', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/translations/jobs/active',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/translations/jobs/active", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Ülaltoodud käsk tagastab JSON-i, mis on struktureeritud järgmiselt:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2025-09-19T08:57:08.357Z"
}
}
Tõrked
i18n-agent API kasutab järgmisi tõrkekooditähendusi:
Tõrkekood | Tähendus |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorized -- Your API key is invalid. |
402 | Payment Required -- Insufficient credits in your account. |
403 | Forbidden -- Your API key is inactive or team not found. |
404 | Not Found -- The specified resource could not be found. |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |
Tõrketeate vormingus
{
"error": "Detailed error message describing what went wrong",
"success": false
}