Import API (machine to machine)

Push everything you have. Sprachrohr creates missing keys and fills in translations.

Why an import API

Developers often fill their local locale files (increasingly with AI) and only pull from Sprachrohr before a release, so local work never makes it back. The import API closes that loop: push everything, Sprachrohr creates missing keys and fills in translations.

1. Create an import API key

Create an import API key in the application settings (/applications/<id>/settings). It is separate from the public read key, can be rotated or revoked independently and is shown only once.

2. Push all translations in one request

Locales may be given as de_DE, de-DE or de, nested objects are flattened to dotted keys:

Terminal
curl -X POST 'https://app.sprachrohr.net/api/translations/<slug>/import' \
  -H 'Authorization: Bearer <import api key>' \
  -H 'Content-Type: application/json' \
  --data '{"de_DE": {"generic": {"save": "Speichern"}}, "en_GB": {"generic.save": "Save"}}'

By default only missing or empty translations are filled, so translator edits in Sprachrohr survive. Add ?overwrite=true or send the object form below to replace existing translations. ?namespace=<ns> targets a namespace other than default.

Terminal
curl -X POST 'https://app.sprachrohr.net/api/translations/<slug>/import' \
  -H 'Authorization: Bearer <import api key>' \
  -H 'Content-Type: application/json' \
  --data '{"namespace": "default", "overwrite": true, "translations": {"de_DE": {"generic.save": "Speichern"}}}'

3. Poll the job

The response is 202 Accepted with a job. Poll statusUrl until status is completed or failed:

Terminal
curl 'https://app.sprachrohr.net/api/translations/<slug>/import/<jobId>' \
  -H 'Authorization: Bearer <import api key>'

A completed job reports how many keys were created and how many translations were added, updated or kept, per language.

Background jobs

  • Imports run as background jobs in chunks of 500 keys; interrupted jobs are resumed on the next start.
  • The UI import (/applications/<id>/import) uses the same pipeline and accepts several files at once.
  • The full specification is served at /api-docs.

Typical CI setup

  1. Store the import key as a protected CI variable.
  2. After tests pass on the main branch, post the locale files of the build in one request.
  3. Optionally poll the job and fail the pipeline if the status is failed.
Leave overwrite off in CI. Local files are usually behind the translators; the default merge keeps their work and only adds what is missing.