OTA releases

Integrate

OTA releases

Ship translation changes to mobile apps without a new build.

On this page

Ship translation changes to a mobile app without a new build. You publish a release, a frozen copy of the project’s strings, and the app downloads it at runtime from a public, cached endpoint.

How it works#

  1. Open the project’s Releases tab and create a distribution key.
  2. Publish a release. It freezes the current translations: edits made afterwards reach no app until the next publish.
  3. At startup the app asks the endpoint for its language, keeps the result, and falls back to the strings bundled in the APK.

Publish a release#

Publishing needs the Publish OTA releases permission (owners and admins by default). Each release gets the next version number and keeps its options:

  • Reviewed translations only leaves out every translation not marked Reviewed.
  • With base-language fallback on, a missing or left-out value ships as the base language’s text.
  • Republish on an older release is the rollback: its strings ship again as a new version, so every app takes it as an update.

From CI, use a token with the release:publish scope. Agents can call the MCP publish_release tool. Both take the same options, or fromVersion to roll back:

# A token with the release:publish scope, e.g. as a CI step after translations land.
curl -fsS -X POST   -H "Authorization: Bearer $LANTERN_TOKEN" -H "Content-Type: application/json"   -d '{"reviewedOnly": true, "minAppVersion": "1.4", "note": "Spring copy"}'   https://lantern.abyss-inn.ch/api/v1/projects/my-project/releases
# Roll back: re-publish v5 as a new version
curl -fsS -X POST -H "Authorization: Bearer $LANTERN_TOKEN" -H "Content-Type: application/json"   -d '{"fromVersion": 5}' https://lantern.abyss-inn.ch/api/v1/projects/my-project/releases

The endpoint#

GET /api/v1/ota/<distribution-key>/<locale>?platform=android&appVersion=1.4.2
If-None-Match: "<etag from the last 200>"
Query parameterValuesMeaning
platformjson (default), androidandroid turns keys into resource names (home.title → home_title), the same names as the strings.xml export.
appVersion1 to 4 dotted numbers, like 1.4.2The build asking. Picks the newest release whose app-version range contains it.
sinceA release versionAnswers 304 if the app already holds this version or a newer one.

A 200 returns { "version", "locale", "publishedAt", "strings" } for that one language:

{
  "version": 7,
  "locale": "fr",
  "publishedAt": "2026-11-14T09:30:00.000Z",
  "strings": { "home_title": "Bienvenue", "cart_items": "{count, plural, one {# article} other {# articles}}" }
}

Caching#

  • Every 200 carries a strong ETag. Send it back as If-None-Match, and an unchanged release answers 304 with no body.
  • since does the same from a version number, for clients that don’t keep the ETag.
  • Cache-Control: public, max-age=300 lets the app or a proxy reuse a response for 300 seconds, so a new release or a rollback reaches apps within that time.
  • Responses are gzipped when the client sends Accept-Encoding: gzip, whatever reverse proxy sits in front of Lantern.

App versions#

A release can carry a min and a max app version. Both are inclusive and both are optional.

Use them when a release isn’t safe for older builds. If a string gains a placeholder (%1$s becomes %1$s, %2$d), an older build still passes one argument and crashes in getString. The strings bundled in the APK can’t prevent that, because the key still exists. Publish the new text with a min version, and older builds keep the release they can handle.

  • Versions are 1 to 4 dotted numbers, compared part by part: 1.10 is newer than 1.9, and 1.2 equals 1.2.0.
  • The endpoint serves the newest release whose range contains the appVersion the app sends. A max version pins old builds to an old release while new builds move on.
  • An app that sends no appVersion only gets releases with no range.

Android (Kotlin)#

The Android SDK does all of this for you. To roll your own, here is a minimal fetch with OkHttp. It stores the ETag and the body per language, and uses the stored copy on 304:

// OkHttp: fetch the latest release for this build, reuse the cached copy on 304.
// Keep the strings bundled in the APK as the fallback for any key a release lacks.
private const val BASE = "https://lantern.abyss-inn.ch/api/v1/ota"
private const val KEY = "ld_…" // the project's distribution key (not a secret)

fun fetchStrings(client: OkHttpClient, locale: String, prefs: SharedPreferences): JSONObject? {
    val url = "$BASE/$KEY/$locale?platform=android&appVersion=${BuildConfig.VERSION_NAME}"
    val request = Request.Builder().url(url).apply {
        prefs.getString("ota-etag-$locale", null)?.let { header("If-None-Match", it) }
    }.build()
    client.newCall(request).execute().use { res ->
        when (res.code) {
            200 -> {
                val body = res.body!!.string() // OkHttp un-gzips transparently
                prefs.edit()
                    .putString("ota-etag-$locale", res.header("ETag"))
                    .putString("ota-body-$locale", body)
                    .apply()
                return JSONObject(body).getJSONObject("strings")
            }
            304 -> return prefs.getString("ota-body-$locale", null)
                ?.let { JSONObject(it).getJSONObject("strings") }
            else -> return null // 404 / 429: keep the bundled strings
        }
    }
}

Look strings up by their resource name and fall back to getString(R.string.…) for any key the release doesn’t have. Fetch in the background at startup and apply the new strings on the next screen or launch.

Status codes#

StatusMeaning
200The release for this language
304Unchanged since your ETag or since version
400Unknown platform, or an appVersion that isn’t dotted numbers
404No release for this key, language or app version, or the key was revoked. All of these look the same on purpose.
429More than 60 requests a minute for one key from one IP, or 300 from one IP. Wait for Retry-After seconds.