API-Referenz
Translayer API
Integrieren Sie KI-gestützte visuelle Übersetzung in Ihren Workflow. Laden Sie Seiten hoch, verfolgen Sie den Fortschritt in Echtzeit, laden Sie Ergebnisse herunter.
Basis-URL: https://translayer.app/api
Authentifizierung
Die Translayer API verwendet Ihre Firebase UID zur Authentifizierung. Übergeben Sie Ihre userId im Request-Body.
Pro-Plan erforderlich. API-Zugang ist im Pro-Plan ($199/Monat) verfügbar. Generieren Sie Ihren API-Schlüssel unter Dashboard → Einstellungen.
POST
/api/translate
Laden Sie Bilder zur Übersetzung hoch. Gibt eine Job-ID zur Fortschrittsverfolgung zurück.
Anfrage (multipart/form-data)
| Feld | Typ | Beschreibung |
|---|---|---|
| images | File[] | Page images (JPG, PNG, WebP). Required. |
| sourceLang | string | Source language or "auto" for detection. |
| targetLang | string | Target language (e.g. "pl", "en", "ja"). |
| mode | string | "fast" (0.5x credits), "standard" (1x), "advanced" (2x). |
| resolution | string | "original", "1K", "2K", "4K". |
| userId | string | Your Firebase UID. Required. |
| customPrompt | string | Optional translation instructions. |
Guthaben-Kostenformel
credits = ceil(pages × resolution_multiplier × mode_multiplier)
Beispiel (cURL)
curl -X POST https://translayer.app/api/translate \
-F "images=@page1.jpg" \
-F "images=@page2.jpg" \
-F "sourceLang=en" \
-F "targetLang=ja" \
-F "mode=standard" \
-F "resolution=2K" \
-F "userId=YOUR_FIREBASE_UID" Antwort
{
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"mode": "standard",
"creditsNeeded": 4
} 402 — Unzureichendes Guthaben 400 — Keine Dateien hochgeladen
GET
/api/jobs/:jobId/events
Echtzeit-Server-Sent-Events-Stream für den Übersetzungsfortschritt.
Beispiel (JavaScript)
const es = new EventSource('/api/jobs/' + jobId + '/events');
es.onmessage = (event) => {
const job = JSON.parse(event.data);
console.log(job.status, job.progress + '/' + job.total);
if (job.status === 'completed' || job.status === 'failed') {
es.close();
}
}; Event-Payload
{
"id": "job-uuid",
"status": "processing", // pending | processing | completed | failed
"progress": 3,
"total": 10,
"currentFile": "page_003.jpg",
"results": [
{ "sourceFilename": "page_001.jpg", "url": "/api/outputs/..." }
]
} GET
/api/download/:jobId
Laden Sie alle übersetzten Seiten als ZIP-Archiv herunter.
Beispiel (cURL)
curl -o translated.zip https://translayer.app/api/download/JOB_ID Dateiaufbewahrung
| Plan | Aufbewahrung |
|---|---|
| Free | 3 days |
| Starter | 14 days |
| Standard | 30 days |
| Pro | 90 days |
404 — Job nicht gefunden 410 — Abgelaufen
DELETE
/api/projects/:id
Löschen Sie ein Übersetzungsprojekt und seine Ausgabedateien.
Beispiel (cURL)
curl -X DELETE https://translayer.app/api/projects/JOB_ID \
-H "Content-Type: application/json" \
-d '{"userId": "YOUR_FIREBASE_UID"}' 403 — Nicht autorisiert 404 — Nicht gefunden
POST
/api/checkout
Erstellen Sie eine Stripe Checkout-Sitzung für ein Abonnement oder den Kauf eines Guthaben-Pakets.
curl -X POST https://translayer.app/api/checkout \
-H "Content-Type: application/json" \
-d '{
"priceId": "price_xxx",
"mode": "subscription",
"userId": "YOUR_FIREBASE_UID"
}'
// Response: { "url": "https://checkout.stripe.com/..." } Vollständiges Beispiel (Python)
import requests, json, sseclient
BASE = "https://translayer.app/api"
UID = "your_firebase_uid"
# 1. Upload pages for translation
files = [("images", open(f"page_{i}.jpg", "rb")) for i in range(1, 6)]
data = {"sourceLang": "en", "targetLang": "ja", "mode": "standard",
"resolution": "2K", "userId": UID}
res = requests.post(f"{BASE}/translate", files=files, data=data)
job_id = res.json()["jobId"]
print(f"Job started: {job_id}")
# 2. Track progress via SSE
response = requests.get(f"{BASE}/jobs/{job_id}/events", stream=True)
client = sseclient.SSEClient(response)
for event in client.events():
job = json.loads(event.data)
print(f"{job['progress']}/{job['total']} - {job['status']}")
if job["status"] in ("completed", "failed"):
break
# 3. Download ZIP
if job["status"] == "completed":
zip_res = requests.get(f"{BASE}/download/{job_id}")
with open("translated.zip", "wb") as f:
f.write(zip_res.content)
print("Downloaded translated.zip") Ratenlimits & Kontingente
| Plan | Seiten/Monat | Gleichzeitige Jobs | Maximale Dateigröße |
|---|---|---|---|
| Free | 10 | 1 | 5 MB |
| Starter | 75 | 2 | 10 MB |
| Standard | 500 | 5 | 25 MB |
| Pro | 1,000 | 10 | 50 MB |
Bereit zur Integration?
Starten Sie mit dem kostenlosen Plan oder upgraden Sie auf Pro für vollen API-Zugang.
Kostenlos starten