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
|
jsoncallback |
Wrap the reply in a call to this JavaScript function (JSONP). |
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).
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: |
An example:
[
{
"source": "Computer",
"quality": 100.0,
"target": "Rekenaar",
"rank": 100.0,
"sources": ["gnome-51", "kde"]
},
{
"source": "Computers",
"quality": 88.888888888888886,
"target": "Rekenaars",
"rank": 100.0,
"sources": ["kde"]
},
{
"source": "&Computer",
"quality": 88.888888888888886,
"target": "Rekenaar",
"rank": 100.0,
"sources": ["libreoffice-26.8"]
},
{
"source": "_Computer",
"quality": 88.888888888888886,
"target": "_Rekenaar",
"rank": 100.0,
"sources": ["gnome-51"]
},
{
"source": "My Computer",
"quality": 72.727272727272734,
"target": "My Rekenaar",
"rank": 100.0,
"sources": ["legacy-2019"]
}
]
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"
}
]
}
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 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>.