Galenio API v1.0

Dokumentace REST API.

Referenční dokumentace pro integraci služby pro překlad zdravotnického textu. Obsahuje autentizaci, request a response schémata, limity, chybové stavy a bezpečnostní chování výstupů.

formát JSON

HTTPS REST API s tenant API klíči a metadata-only request traces.

Overview

Medical translation API

Galenio API přijímá zdravotnický text, překládá ho do cílového jazyka a vrací buď jednoduchý překlad, nebo detailní report z validační pipeline. Služba je určena pro aplikace, portály a interní systémy, které potřebují překlad pacientské komunikace.

Base URL https://product-api-gateway-2hiukp37.ew.gateway.dev
verze v1.0
protokol HTTPS
formát JSON
auth API key

Core capabilities

  • Překlad jednoho textu nebo dávky textů.
  • Dva režimy odpovědi: translation a report.
  • Deterministické kontroly pro dávkování, jednotky, čísla, negace a strukturu textu.
  • Stavy položek ok, warning a blocked.
  • Request trace přes request_id bez ukládání raw textu.

Quickstart

První request

Pro překlad stačí poslat zdrojový jazyk, cílový jazyk, text a klientský API klíč v hlavičce X-API-Key.

curl -X POST "https://product-api-gateway-2hiukp37.ew.gateway.dev/v1/translate" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $GALENIO_API_KEY" \
  -d '{
    "source_language": "en",
    "target_language": "cs",
    "text": "Take one 10 mg tablet every morning after breakfast."
  }'

Response

{
  "request_id": "req_01JQ8M7K2X4N9P6R3T5V",
  "response_mode": "translation",
  "results": [
    {
      "client_item_id": null,
      "status": "ok",
      "text": "Užívejte jednu 10mg tabletu každé ráno po snídani."
    }
  ]
}

Authentication

API keys

Klientské endpointy používají hlavičku X-API-Key. Admin endpointy používají hlavičku X-Admin-Key. Klíče jsou tenant-specific a mohou mít omezené scopes.

Header Použití Příklad
X-API-Key Klientské překlady a povolené trace lookupy. X-API-Key: $GALENIO_API_KEY
X-Admin-Key Admin operace, usage reporty, metriky a správa klientů. X-Admin-Key: $GALENIO_ADMIN_KEY

Scopes

Scope Oprávnění
translate:run Spuštění překladu přes POST /v1/translate.
trace:read Čtení vlastních request traces klienta.
admin:traces:read Čtení request traces napříč klienty.
admin:clients:read Seznam klientů.
admin:clients:write Revokace klienta a rotace klientského klíče.
admin:usage:read Usage reporty.
admin:metrics:read Prometheus metriky.

Endpoints

Endpoint reference

Method Path Auth Description
GET /health/live none Liveness check.
GET /health/ready none Readiness check.
POST /v1/translate X-API-Key Translate one or more medical texts.
GET /v1/admin/requests/{request_id} X-Admin-Key or scoped X-API-Key Read metadata-only request trace.
GET /v1/admin/clients X-Admin-Key List configured clients.
POST /v1/admin/clients/{client_id}/revoke X-Admin-Key Disable a client.
POST /v1/admin/clients/{client_id}/rotate-key X-Admin-Key Generate a new client API key.
GET /v1/admin/usage/clients/{client_id} X-Admin-Key Read client usage report.
GET /metrics X-Admin-Key Prometheus metrics.

Translate

POST /v1/translate

Endpoint podporuje single-text request přes text i batch request přes items. V jednom requestu musí být použita právě jedna z těchto variant.

Headers

Content-Type: application/json
X-API-Key: $GALENIO_API_KEY

Single text

{
  "source_language": "en",
  "target_language": "cs",
  "response_mode": "translation",
  "text": "Take one 10 mg tablet every morning after breakfast."
}

Batch with report

{
  "source_language": "en",
  "target_language": "cs",
  "response_mode": "report",
  "context": "Patient-facing medical instructions. Preserve dosage, units, frequency, negation, storage conditions, and warning meaning exactly.",
  "items": [
    {
      "client_item_id": "dose-1",
      "text": "Take one 10 mg tablet every morning after breakfast."
    },
    {
      "client_item_id": "warning-1",
      "text": "Do not take this medicine if you are allergic to penicillin."
    }
  ]
}

Schemas

Request and response schema

Request body

Field Type Required Description
source_language string yes Source language code. Alias: source_lang.
target_language string yes Target language code. Alias: target_lang.
response_mode string no translation by default, or report.
context string or null no Optional translation context, max 4000 characters.
text string conditional Single-text input. Required when items is not used.
items array conditional Batch input. Required when text is not used.

Batch item

Field Type Required Description
client_item_id string or null no Client correlation id, max 128 characters.
text string yes Text to translate, max 3000 characters.

Response body

{
  "request_id": "req_01JQ8M7K2X4N9P6R3T5V",
  "response_mode": "report",
  "results": [
    {
      "client_item_id": "dose-1",
      "status": "ok",
      "text": "Užívejte jednu 10mg tabletu každé ráno po snídani.",
      "code": null,
      "message": null
    }
  ],
  "report": {
    "items": [],
    "runtime": {}
  }
}
Field Type Description
request_id string Request id for support and trace lookup.
response_mode string Resolved response mode.
results array One result per input item.
report object or null Detailed report only when response_mode is report.

Statuses

Item status semantics

ok

Translation passed validation and is returned in text.

warning

Translation is returned, but the client should display or log the warning.

blocked

Translation is not returned because the item failed final safety validation.

Blocked response example

{
  "request_id": "req_01JQ8M7K2X4N9P6R3T5V",
  "response_mode": "report",
  "results": [
    {
      "client_item_id": "dose-risk",
      "status": "blocked",
      "code": "critical_guardrail_failure",
      "message": "Translation blocked because final guardrails reported CRITICAL severity."
    }
  ],
  "report": {
    "items": [
      {
        "client_item_id": "dose-risk",
        "status": "blocked",
        "source_language": "en",
        "target_language": "cs",
        "final_translation": null,
        "guardrails": {
          "final": {
            "severity": "CRITICAL",
            "issues": []
          }
        }
      }
    ],
    "runtime": {}
  }
}

Limits

Languages and request limits

Supported languages

ar, bg, cs, de, en, ro, ru, es, uk, vi

Default limits

Limit Value
Max batch items 20
Max characters per item 3000
Max characters per request 20000
Max context length 4000 characters

Tenant configuration may further restrict allowed languages, language pairs, batch size, character limits and usage quotas. Self-translation is rejected, for example en -> en.

Errors

Error response format

{
  "request_id": "req_01JQ8M7K2X4N9P6R3T5V",
  "error": {
    "code": "validation_error",
    "message": "Request validation failed.",
    "status_code": 400,
    "details": {}
  }
}
Status Meaning
400 Validation error.
401 Missing or invalid API key.
403 Missing scope or tenant policy violation.
422 Request schema validation error.
429 Usage limit exceeded.
503 Runtime, provider or pipeline failure.

Traces

Request trace lookup

Every translate response includes request_id. Use it for support and trace lookup. Trace records are metadata-only: they include counts, statuses, timings, guardrail summaries and usage metadata, but not raw source text, translated text or provider payloads.

GET /v1/admin/requests/{request_id}

Admins can read traces across clients with X-Admin-Key. Clients can read only their own traces when their key includes trace:read.

Admin API

Client and usage management

Admin endpoints are intended for operational tooling and require admin scopes. Do not expose admin keys in client-side applications.

Endpoint Purpose
GET /v1/admin/clients List client tenants and their policy configuration.
POST /v1/admin/clients/{client_id}/revoke Disable client access.
POST /v1/admin/clients/{client_id}/rotate-key Generate a new plaintext client key and store only its hash.
GET /v1/admin/usage/clients/{client_id}?days=30 Read usage totals, daily breakdown and estimated billing values.
GET /metrics Read Prometheus metrics.

Key rotation response

{
  "client": {
    "id": "8f4b7b2e-63dc-4cb6-99d8-5d236ec8bf42",
    "name": "patient-portal-production",
    "is_active": true,
    "scopes": ["translate:run"]
  },
  "api_key": "gln_live_[redacted]"
}

Safety

Guardrails and privacy

Galenio API validates translated output before returning it. Critical unresolved guardrail findings block the item and no translation text is returned.

Medical values

Numbers, dosages, units, frequency, negation and sensitive decimal values.

Text structure

Paragraphs, bullet lists, numbered lists, tables, URLs, e-mails and codes.

Placeholders

HTML tags, braces, bracket placeholders, percent placeholders and duplicated markers.

Medical review Machine translation is not a substitute for clinical review. In safety-sensitive workflows, clients should treat warning and blocked as review signals.

Support

Access and support

Pro klientský API klíč, přístup k admin operacím nebo integrační dotazy napište na tomaskroupa@galenio.app.