Skip to main content
Stringhive Translations

API: Translations

Export translations

GET /api/hives/{slug}/export

Pull translated strings out of Stringhive. Requires read ability.

# All locales, JSON format
curl "https://www.stringhive.com/api/hives/my-app/export" \
  -H "Authorization: Bearer YOUR_TOKEN"

# Single locale
curl "https://www.stringhive.com/api/hives/my-app/export?locale=de" \
  -H "Authorization: Bearer YOUR_TOKEN"

# PHP format
curl "https://www.stringhive.com/api/hives/my-app/export?format=php&locale=de" \
  -H "Authorization: Bearer YOUR_TOKEN"

Query parameters:

Parameter Default Description
locale Specific locale to export. Omit to export all locales.
format json json or php

Response:

The response is a files object where each key is a filename and each value is the file content as a string.

{
  "files": {
    "auth.json": "{\"login\":\"Anmelden\",\"logout\":\"Abmelden\"}",
    "nav.json": "{\"home\":\"Startseite\",\"settings\":\"Einstellungen\"}"
  }
}

When exporting all locales, the filenames are locale codes (using your custom code if set):

{
  "files": {
    "de.json": "...",
    "fr.json": "...",
    "es.json": "..."
  }
}

Import translations

POST /api/hives/{slug}/translations/{locale}

Push translated strings into Stringhive for a specific locale. Requires write ability. The locale can be either the canonical code or your custom code.

curl -X POST https://www.stringhive.com/api/hives/my-app/translations/de \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "files": {
      "auth.php": {
        "login": "Anmelden",
        "logout": "Abmelden"
      }
    },
    "overwrite_strategy": "skip"
  }'

Body parameters:

Parameter Type Description
files object Keys are filenames, values are key-value translation objects
overwrite_strategy string skip (default) or overwrite

skip leaves existing translations alone. overwrite replaces them.

Response:

{
  "created": 2,
  "updated": 0,
  "skipped": 1240,
  "unknown": 3
}

unknown means the key exists in your file but doesn't match any source string in the Hive. Those translations are ignored.