amaGama answers HTTP requests with JSON. The API lives under /api/v1/;
/tmserver/ is the older path to the same read API and still works.
Request TM suggestions with a GET of
<SERVER>/api/v1/<SOURCE_LANGUAGE>/<TARGET_LANGUAGE>/unit/<QUERY>, where:
Placeholder |
Description |
|---|---|
<SERVER> |
The URL of the amaGama server |
<SOURCE_LANGUAGE> |
Source language code: de, en, en_GB |
<TARGET_LANGUAGE> |
Target language: ar, es_AR, fr, hi |
<QUERY> |
The URL escaped string to be queried |
Note
<SOURCE_LANGUAGE> and <TARGET_LANGUAGE> should be language
codes in the form of LANG OR LANG_COUNTRY. LANG
should be a language code from ISO 639 and COUNTRY a
country code from ISO 3166. The
following are valid examples: ar, de, en, en_GB, es_AR, fr, gl, hi, tlh,…
For the public server the code en is used for the source language for most
of the FOSS localization files, not en_US.
For example:
https://amagama-live.translatehouse.org/api/v1/en/af/unit/Computer
The string can also be passed as source in the query string, which avoids
problems with / in the string on some web servers:
https://amagama-live.translatehouse.org/api/v1/en/af/unit/?source=Open%2FSave
It is possible to provide some options in the request URL by using a query string with one or more of the following fields.
Option |
Description |
|---|---|
min_similarity |
The minimum similarity between the string
to be searched and the strings to match.
See Levenshtein distance. Values
below 70 are raised to 70. Default:
|
max_candidates |
The maximum number of results, at most
30. Default: |
style |
The project’s checker style, so that
accelerators and similar markup are
matched as that project writes them ( |
exclude |
Comma-separated globs of block names to leave out, such as
|
only |
Comma-separated globs of the block names
to keep, such as |
weight |
Comma-separated |
licence |
Comma-separated globs of the SPDX licence
identifiers to keep, such as
|
exclude_checks |
Comma-separated globs of check names:
suggestions flagged with a matching
|
jsoncallback |
Wrap the reply in a call to this
JavaScript function (JSONP), served as
|
The source options are applied before max_candidates, and a suggestion’s
sources lists only the sources it keeps.
Of equally good suggestions, the one more of its kept sources supplied comes
first.
For example:
https://amagama-live.translatehouse.org/api/v1/en/af/unit/File?style=gnome&max_candidates=10
https://amagama-live.translatehouse.org/api/v1/en/af/unit/File?exclude=hosted-*&weight=gnome-*:1.5
licence lists the licences a client can use its suggestions under, as
globs of SPDX identifiers (case doesn’t
matter). Each source’s licence is an SPDX expression, and a source is kept
when the expression can be met with the listed licences alone:
A OR B lets you choose either licence, so one of them listed is enough.
A AND B applies both licences, so both must be listed.
A WITH exception only adds permissions to A, so A listed is enough.
With licence=GPL-*,MIT:
Source’s licence |
Kept |
Because |
|---|---|---|
|
yes |
GPL-* matches it |
|
no |
a glob matches the whole identifier: GPL-* isn’t LGPL |
|
yes |
you can use it under GPL-3.0-only |
|
no |
Apache-2.0 also applies, and isn’t listed |
|
yes |
MIT, and GPL-2.0-only for the choice |
|
yes |
GPL-* matches the licence |
A glob starting with ! leaves licences out: a licence is allowed when it
matches a listed glob and no ! one. With only ! globs, every other
licence is allowed. With licence=!AGPL-*:
Source’s licence |
Kept |
Because |
|---|---|---|
|
yes |
every licence but AGPL is allowed |
|
no |
AGPL-* is left out |
|
yes |
you can use it under MIT |
|
no |
AGPL-3.0-only also applies |
licence=GPL-*,!GPL-3.0-* keeps GPL-2.0-only but not GPL-3.0-only.
Sources with no known licence, or files under different licences, are left
out. A suggestion stays while any of its sources is kept, as with only.
A request returns 404 if the source language isn’t in the database or if no
string is given. It returns 400 if the source and target languages are the
same (en_US is the same as en, en_GB isn’t) or if a weight isn’t
glob:weight. Replies may be cached for an hour (Cache-Control:
max-age=3600, public).
A client asking ahead of need says so with a Sec-Purpose header: prefetch
for a lookup it expects to need soon (the next units), prefetch;bulk for one
of many fetched together (a whole file, to work offline). Ordinary lookups send
neither. Prefetches are answered like ordinary lookups. The public server
limits bulk requests from each client, and in total, so they can’t crowd out
people translating now: one over the limit gets a 429 with Retry-After,
and the client should wait that many seconds before its next bulk request.
Other lookups have a separate, higher limit for each client, well above what
someone translating sends; one over it gets a 429 with Retry-After too.
The results from a TM suggestion request are provided in JSON format. It is a list containing zero or more results. The results contain the following fields:
Field |
Description |
|---|---|
source |
Matching unit’s source language text |
target |
Matching unit’s target language text |
quality |
A Levenshtein distance measure of quality as percent |
rank |
An internal quantity that might disappear. Ignore. |
sources |
The blocks whose
imports supplied this translation, in
alphabetical order: |
checks |
The names of the checks this
translation fails, in the order the
rebuild ran them, such as
|
An example:
[
{
"source": "Computer",
"quality": 100.0,
"target": "Rekenaar",
"rank": 100.0,
"sources": ["gnome-51", "kde"],
"checks": []
},
{
"source": "Computers",
"quality": 88.888888888888886,
"target": "Rekenaars",
"rank": 100.0,
"sources": ["kde"],
"checks": []
},
{
"source": "&Computer",
"quality": 88.888888888888886,
"target": "Rekenaar",
"rank": 100.0,
"sources": ["kde"],
"checks": ["accelerators"]
},
{
"source": "_Computer",
"quality": 88.888888888888886,
"target": "_Rekenaar",
"rank": 100.0,
"sources": ["gnome-51"],
"checks": []
},
{
"source": "My Computer",
"quality": 72.727272727272734,
"target": "My Rekenaar",
"rank": 100.0,
"sources": ["legacy-2019"],
"checks": []
}
]
GET <SERVER>/api/v1/languages/ lists the languages in the database:
{
"sourceLanguages": ["en"],
"targetLanguages": ["af", "ar", "de"]
}
GET <SERVER>/api/v1/sources/ lists the blocks the
translations were imported from, one entry per block and source language.
The names are those suggestions give in sources. Titles are in the language ?lang= asks for,
or else the best of Accept-Language, among the translated ones; otherwise English. The reply gives that language as
lang and its text direction (ltr or rtl) as dir.
Field |
Description |
|---|---|
name |
The block’s name |
title |
Its title, or its name if it has none |
version |
Its release, such as |
displayTitle |
The title with its release, worded for the language |
licence |
Its SPDX licence expression, or null |
sourceLanguage |
The source language |
targetLanguages |
The target languages it was imported for |
units |
How many units its files gave, before those already there from other files were merged |
imported |
When it was last imported, in UTC |
weight |
Its default |
{
"lang": "en",
"dir": "ltr",
"sources": [
{
"name": "gnome-51",
"title": "GNOME",
"version": "51",
"displayTitle": "GNOME 51",
"licence": "GPL-2.0-or-later",
"sourceLanguage": "en",
"targetLanguages": ["af", "ar", "de"],
"units": 5000,
"weight": 1.0,
"imported": "2026-10-25T12:00:00Z"
}
]
}
GET <SERVER>/api/v1/stats/ returns the figures of the statistics page
(/stats/), as update_stats last computed
them; until it has, the reply is a 404 with an error. Times are in UTC.
Field |
Description |
|---|---|
version |
The format’s version, 1 |
computed |
When the translation figures were last computed |
sourceLanguages |
The figures of each source language, by code |
use |
The lookups per day, or null |
Each source language has:
Field |
Description |
|---|---|
built |
When the data was rebuilt (its last import) |
sources |
Source strings |
words |
Their words |
targets |
Translations |
languages |
Per target language: |
blocks |
Per block: |
checks |
|
history |
|
computed |
When these figures were computed |
use has computed and days: per day (in the server’s time zone),
date and the lookups by kind, ordinary, prefetch and bulk
(see Sec-Purpose), with limited, how many of them
were refused with a 429. They are totals only.
{
"version": 1,
"computed": "2026-11-01T18:00:00Z",
"sourceLanguages": {
"en": {
"built": "2026-11-01T12:00:00.000000Z",
"computed": "2026-11-01T18:00:00Z",
"sources": 1000,
"words": 5000,
"targets": 2000,
"languages": [
{"code": "af", "targets": 2000, "sources": 900, "words": 4000,
"coverage": 0.9, "checks": {"tags": 10}}
],
"blocks": [
{"name": "gnome-51", "title": "GNOME", "version": "51", "languages": 1,
"targets": 2000, "imported": "2026-11-01T12:00:00Z",
"checks": {"tags": 10}}
],
"checks": {
"flagged": ["tags"],
"failures": {"tags": 10},
"leftOutChecks": ["printf", "braces", "script"],
"leftOut": {"targets": 5, "checks": {"printf": 5, "braces": 0, "script": 0}},
"categories": {"tags": "critical", "printf": "critical", "braces": "critical",
"script": "critical"}
},
"history": [
{"built": "2026-11-01T12:00:00.000000Z", "sources": 1000, "words": 5000,
"targets": 2000, "languages": 1}
]
}
},
"use": {
"computed": "2026-11-02T00:30:00Z",
"days": [
{"date": "2026-11-01", "ordinary": 1000, "prefetch": 500, "bulk": 100,
"limited": 0}
]
}
}
When ENABLE_DATA_ALTERING_API is on (it is off by default), the
API also accepts translations. style can be passed as for lookups.
Method |
Path |
Body |
|---|---|---|
PUT or POST |
|
JSON object with |
POST |
|
JSON list of objects with
|
PUT |
|
A translation file; its format
is taken from |
The store requests reply added <N> units from <NAME>.
A request with a language code that isn’t valid, a body not shaped as above, or
a file that can’t be read returns 400.
Strings too long for the database’s index are skipped.
Each request is recorded as an import of block
api, named unit or <NAME>.