Cached translations endpoints
Fetch translations from pre-built S3/R2 JSON files — zero database reads.
Overview
The cached endpoints serve the same translation data as the live endpoints but read directly from static JSON files stored in Cloudflare R2 (or any S3-compatible bucket). This means:
- No database query in the hot path — ideal for high traffic.
- Sub-50ms p99 response times from edge CDN.
- Eventual consistency — changes made in the portal take effect after the next cache-build job runs (typically 1–2 minutes).
For most production setups, use cached endpoints for all GET requests and rely on live endpoints only when you need up-to-the-second freshness.
GET /v1/cached/manifest
Returns the project manifest from S3 cache.
Request
GET https://sapi.i18nme.com/v1/cached/manifest| Header | Required | Description |
|---|---|---|
X-API-Key | ✅ | Your project API key |
Response
Same shape as GET /v1/manifest.
{
"languages": [
{ "code": "en", "name": "English", "iso": "en" }
]
}GET /v1/cached/translations/
Returns all translations for a language from S3 cache.
Request
GET https://sapi.i18nme.com/v1/cached/translations/{language}| Parameter | In | Required | Description |
|---|---|---|---|
language | path | ✅ | Language code (e.g. en) |
Response
Same nested-object shape as GET /v1/translations/{language}.
GET /v1/cached/translations/{language}/
Returns a single group from the S3-cached translation file.
GET https://sapi.i18nme.com/v1/cached/translations/{language}/{group}GET /v1/cached/translations/{language}/{group}/
Returns a single key value from S3 cache.
GET https://sapi.i18nme.com/v1/cached/translations/{language}/{group}/{key}Response:
{ "value": "Welcome" }Examples
# Cached manifest
curl https://sapi.i18nme.com/v1/cached/manifest \
-H "X-API-Key: key_live_XXXX"
# All cached translations for German
curl https://sapi.i18nme.com/v1/cached/translations/de \
-H "X-API-Key: key_live_XXXX"const BASE = 'https://sapi.i18nme.com'
const HEADERS = { 'X-API-Key': process.env.I18N_API_KEY }
// Use cached endpoint — recommended for production
const tr = await fetch(`${BASE}/v1/cached/translations/de`, { headers: HEADERS })
.then(r => r.json())import httpx, os
HEADERS = {'X-API-Key': os.environ['I18N_API_KEY']}
tr = httpx.get(
'https://sapi.i18nme.com/v1/cached/translations/de',
headers=HEADERS
).json()Cache invalidation
The cache is rebuilt automatically after a portal action (key approval, bulk translation, manual publish). You can also trigger a rebuild from Project → Settings → Rebuild cache in the portal.
Cache-aside pattern on your side:
// Simple in-process cache with 60-second TTL
let cache = {}
async function getTranslations(lang) {
const key = `tr:${lang}`
if (cache[key] && Date.now() - cache[key].ts < 60_000) return cache[key].data
const data = await fetch(`https://sapi.i18nme.com/v1/cached/translations/${lang}`, {
headers: { 'X-API-Key': process.env.I18N_API_KEY }
}).then(r => r.json())
cache[key] = { data, ts: Date.now() }
return data
}