API

i18nexus API

API documentation for our developer-first translation management platform

Fetching Project Data

Get translations for a specific language and namespace

Returns a JSON object of a project’s translations for a specified language and namespace.

GET    https://api.i18nexus.com/project_resources/translations/:language_code/:namespace.json?api_key=:project_api_key
{
    "welcome": "Welcome to my app!",
    "goodbye": "Thanks for using my app!"
} 

Get all translations

Returns a nested JSON object of all project translations for all languages and namespaces.

GET    https://api.i18nexus.com/project_resources/translations.json?api_key=:project_api_key

{
    "en": {
        "my-first-namespace": {
            "welcome": "Welcome to my app!",
            "goodbye": "Thanks for using my app!"
        },
        "my-second-namespace": {
            "greeting": "How are you?"
        }
    },
    "es-MX": {
        "my-first-namespace": {
            "welcome": "¡Bienvenido a mi aplicación!",
            "goodbye": "¡Gracias por usar mi aplicación!"
        },
        "my-second-namespace": {
            "greeting": "¿Cómo estás?"
        }
    }
} 

Get versions

Returns a collection of a project’s exported versions ordered from newest to oldest.

By default the latest 10 versions will be returned, but this can be adjusted using the optional limit query parameter.

GET    https://api.i18nexus.com/project_resources/versions.json?api_key=:project_api_key&limit=10

{
    "collection": [
        {
            "created_at": 1631402817503,
            "description": "My version description",
            "download_url": "https://cdn.i18nexus.com/versions/1/translations.zip",
            "id": "c3ee93c5-66c8-487d-8cbb-0e6109550f35",
            "key_separation": true,
            "languages": ["en","es-MX"],
            "namespaces": ["my-first-namespace", "my-second-namespace"],
            "version_number": 1
        }
    ]
}  

Get namespaces

Returns a collection of a project’s namespaces.

GET    https://api.i18nexus.com/project_resources/namespaces.json?api_key=:project_api_key

{
    "collection": [
        {
            "id": "c3ee93c5-66c8-487d-8cbb-0e6109550f35",
            "title": "common",
            "created_at": 1631402817503,
        },
        {
            "id": "77915b03-496d-4c48-83c0-cece670ff5b3",
            "title": "homepage",
            "created_at": 1633402920418
        }
    ]
} 

Get languages

Returns a collection of a project’s languages.

GET    https://api.i18nexus.com/project_resources/languages.json?api_key=:project_api_key

{
    "collection": [
        {
            "name": "English",
            "full_code": "en",
            "language_code": "en",
            "country_code": null,
            "google_translate_code": "en",
            "base_language": true
        },
        {
            "name": "Spanish",
            "full_code": "es",
            "language_code": "es",
            "country_code": null,
            "google_translate_code": "es",
            "base_language": false
        }
    ]
} 

Advanced:

Almost all i18nexus users prefer using the following APIs through the i18nexus-cli, where each request is wrapped in a simple command.
Direct access to the following APIs is meant for teams who want to integrate i18nexus into their own management systems and workflows.

Writing Translations

The following requests allow for writing data to your i18nexus project, therefore a Personal Access Token is required as a header:
Authorization: Bearer <PERSONAL_ACCESS_TOKEN>

Personal Access Tokens are created in your user account settings in your i18nexus Dashboard:

User Settings

Create a new string

Creates a new string in your project’s base language, and creates machine translations for each of your project’s languages.

POST    https://api.i18nexus.com/project_resources/base_strings?api_key=:project_api_key
Parameters:

key string: The key of the string to create (Required)
value string: The value of the string to create (Required)
details string: The details of the string to create (Optional)
namespace string: The namespace in which to create the string (
Required)

 

Example Request Body:

{
    "key": "welcome_msg",
    "value": "Welcome to my app!",
    "details": "Appears in the home page header.",
    "namespace": "homepage"
} 
Update an existing string

Updates a string’s key, value, details, and/or namespace.

PATCH    https://api.i18nexus.com/project_resources/base_strings?api_key=:project_api_key
 
Parameters:

id object: An object containing the key and namespace of the string to update (Required)
key
string: The key of the string to create (Optional)
value string: The value of the string to create (Optional)
details string: The details of the string to create (
Optional)
namespace string: The namespace in which to create the string (
Optional)
reset_confirmed boolean: Required if updating the value of the string and the string contains confirmed translations. Determines whether or not to reset the values of confirmed translations with machine translations of the new value.

 

Example Request Body:

In this example we are changing the key and the value of the string with key notifications in namespace common.

{
    "id": {
        "key": "notifications",
        "namespace": "common"
    },
    "key": "notifications.alert",
    "value": "You have a new notification!",
    "reset_confirmed": true
} 
Delete a string

Deletes a string and its associated translations in your project.

DELETE    https://api.i18nexus.com/project_resources/base_strings?api_key=:project_api_key
 
Parameters:

id object: An object containing the key and namespace of the string to update (Required)

 

Example Request Body:

In this example we are deleting the string with key notificiations.alert from namespace common.

{
    "id": {
        "key": "notifications.alert",
        "namespace": "common"
    }
} 
Import strings from JSON

Imports a block of JSON key-value pairs into your project. This is the equivalent of using the Import tool in the Strings Management page.

POST    https://api.i18nexus.com/project_resources/import?api_key=:project_api_key
 
Parameters:

languages object: JSON block of strings with language codes as the keys (see example request body below) (Required)
namespace string: The namespace to import into (Required)
confirm booleanIf importing any translation strings (strings for a language that is not the project base language), mark them confirmed in i18nexus (default: false)
overwrite boolean: If any keys already exist in the target namespace, overwrite the values with the imported values (default: false)

 

Example Request Body:

In this example we are importing strings into our project’s common namespace for English (en) and Spanish (es).

You do not have to include all of your projects’ languages in your request, only the ones you wish to update.

{
    "namespace": "common",
    "confirm": true,
    "overwrite": true
    "languages": {
        "en": {
            "welcome_msg": "Welcome to my app!",
            "sign_in": "Sign In",
            "sign_out": "Sign out",
            "notifications": {
                "alert": "You have a new notification!"
            }
        },
        "es": {
            "welcome_msg": "¡Bienvenido a mi aplicación!",
            "sign_in": "Iniciar sesión",
            "sign_out": "Desconectar",
            "notifications": {
                "alert": "¡Tienes una nueva notificación!"
            }
        }
    }
} 
Create a new namespace

Adds a new namespace to your project

POST    https://api.i18nexus.com/project_resources/namespaces?api_key=:project_api_key
 
Parameters:

title string: The title of the namespace to create (Required)

 

Example Request Body:

{
    "title": "common"
} 

Need help?

We are always available for any questions you have. 

Click the chat bubble in the bottom right of this page, or email us at support@i18nexus.com