はじめに

i18n-agent 翻訳 APIへようこそ!文化適応型のAI翻訳サービス

このAPI ドキュメントでは、利用可能なすべてのエンドポイント、認証方法、リクエスト/レスポンス形式、およびエラーコードについて包括的な情報を提供します。

ベースURL

Environment URL
Development http://localhost:8000
Production https://api.i18nagent.ai

主な機能

  • 🌐 Multi-language Support 多言語対応 - 10言語以上への文化適応型コンテンツ翻訳
  • 🚀 Real-time Streaming リアルタイムストリーミング - 進捗状況のサーバー送信イベント
  • 📁 File Translation ファイル翻訳 - JSON、YAML、XML、CSVなどの形式をサポート
  • 🔐 Secure Authentication セキュアな認証 - APIキーによる認証
  • 💳 Credit System クレジットシステム - 従量制の価格モデル
  • 🤖 AI-Powered AI駆動 - 高度な大規模言語モデルを使用した正確な翻訳

認証

認証には、このコードを使用してください:

# 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()
}

i18n_your_api_key_hereをあなたのAPIキーに置き換えることを忘れないでください。

i18n-agent account dashboard アカウントダッシュボードからAPIキーを取得できます。これを使用してAPIへのアクセスを許可します。

APIキーは、以下のようなヘッダーでサーバーへのすべてのAPIリクエストに含める必要があります:

Authorization: Bearer i18n_your_api_key_here

i18n_your_api_key_here


You must replace i18n_your_api_key_here with your personal API key.

エンドポイント

サービス情報

サービス情報を取得

GET /

サービスのメタデータと利用可能なエンドポイントを返します

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()
}

上記のコマンドは以下のような構造のJSONを返します:

{
  "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"
  }
}

モニタリング

ヘルスチェック

GET /health

サービスの健康状態を確認します

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()
}

上記のコマンドは以下のような構造のJSONを返します:

{
  "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"
  }
}

クレジット

チームクレジットを取得

GET /credits

認証されたチームの現在のクレジット残高を取得します

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()
}

上記のコマンドは以下のような構造のJSONを返します:

{
  "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"
  }
}

言語

サポートされている言語のリスト

GET /languages

品質評価付きのサポートされているすべての言語のリストを取得します

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()
}

上記のコマンドは以下のような構造のJSONを返します:

{
  "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"
  }
}

機械翻訳

機械翻訳の作成

POST /translations

テキストデータと文書コンテンツの両方を機械翻訳するための統合エンドポイント

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()
}

上記のコマンドは以下のような構造のJSONデータを返します:

{
  "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"
  }
}

リクエストパラメータ

Parameter Type Required Description

ストリーミング進捗付きの機械翻訳作成

POST /translations/stream

リアルタイムの進捗更新のためのServer-Sent Events(SSE)を使用した機械翻訳の作成

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()
}

上記のコマンドは以下のような構造のJSONデータを返します:

{
  "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"
  }
}

リクエストパラメータ

Parameter Type Required Description
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')

機械翻訳コスト見積もりの取得

POST /translations/estimate

機械翻訳に必要な単語数とクレジット数の計算

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()
}

上記のコマンドは以下のような構造のJSONデータを返します:

{
  "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"
  }
}

リクエストパラメータ

Parameter Type Required Description
content string Yes Content to analyze
fileType string No File type for content analysis (default: txt)

コンテンツ分析

機械翻訳準備のためのコンテンツ分析

POST /analyze

機械翻訳前に潜在的な問題を特定し、改善提案を得るためのコンテンツ分析。このエンドポイントは機械翻訳と同じ料金(1単語あたり0.001クレジット)でクレジットを消費します。

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()
}

上記のコマンドは以下のような構造のJSONデータを返します:

{
  "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"
  }
}

リクエストパラメータ

Parameter Type Required Description
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

機械翻訳ジョブ

機械翻訳詳細の取得

GET /translations/{id}

IDによる特定の機械翻訳の詳細を取得

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()
}

上記のコマンドは以下のような構造のJSONデータを返します:

{
  "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"
  }
}

クエリパラメータ

Parameter Required Description
id Yes Translation ID

機械翻訳ステータスの取得

GET /translations/{id}/status

機械翻訳ジョブの現在のステータスを取得

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()
}

上記のコマンドは、以下のような構造のJSONデータを返します。

{
  "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"
  }
}

クエリパラメーター

Parameter Required Description
id Yes Translation ID

翻訳結果のダウンロード

GET /translations/{id}/result

翻訳されたコンテンツをダウンロードします。

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()
}

上記のコマンドは、以下のような構造のJSONデータを返します。

{
  "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"
  }
}

クエリパラメーター

Parameter Required Description
id Yes Translation ID
language No Language code for specific language result

オリジナルファイルのダウンロード

GET /translations/{id}/original

アップロードされたオリジナルファイルをダウンロードします。

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()
}

上記のコマンドは、以下のような構造のJSONデータを返します。

{
  "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"
  }
}

クエリパラメーター

Parameter Required Description
id Yes Translation ID

チェックポイントから翻訳を再開

POST /translations/{id}/resume

失敗または中断された翻訳を、特定のチェックポイントから、または最後に成功したチェックポイントから自動的に再開します。

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()
}

上記のコマンドは、以下のような構造のJSONデータを返します。

{
  "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"
  }
}

クエリパラメーター

Parameter Required Description
id Yes Translation ID

リクエストボディパラメーター

Parameter Type Required Description
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)

アクティブな翻訳ジョブの取得

GET /translations/jobs/active

現在アクティブな翻訳ジョブのリストを取得します。

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()
}

上記のコマンドは、以下のような構造のJSONデータを返します。

{
  "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"
  }
}

エラー

i18n-agent APIは、以下のエラーコードを使用します。

Error Code Meaning
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.

エラーレスポンスフォーマット

{
  "error": "Detailed error message describing what went wrong",
  "success": false
}