Locale API (1.0.0)

Download OpenAPI specification:Download

Introduction

The Locale API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

You can use the Locale API in test mode, which does not affect your live data or interact with real translators. The API key you use to authenticate the request determines whether the request is live mode or test mode.

Authentication

The Locale API uses API keys to authenticate requests. You can view and manage your API keys in the Settings of your projects.

Test mode secret keys have the prefix sk_test_ and live mode secret keys have the prefix sk_live_.

Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

Authentication to the API is performed via HTTP Bearer Auth. Use -H "Authorization: Bearer sk_test_YOUR_SECRET_KEY".

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

An API key is associated to a single project.

bearerAuth

Security Scheme Type HTTP
HTTP Authorization Scheme bearer

Error

Locale uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, etc.). Codes in the 5xx range indicate an error with Locale's servers.

Job

Job objects allow you to perform translation based on the project configuration associated to your API key. The API allows you to create, and retrieve individual jobs as well as list all your jobs.

Jobs are identified by a unique, random ID.

Create a translation job.

Trigger a new translation that will be processed in all languages set up on your project.

Authorizations:
Request Body schema: application/json
required
Array of objects (SegmentData)

Responses

Request samples

Content type
application/json
{
  • "segments": [
    ]
}

Response samples

Content type
application/json
{
  • "id": "job_RH4lg43DvWW",
  • "object": "job",
  • "status": "inProgress",
  • "livemode": true
}

Retrieve a translation job.

Retrieve a translation job by its id.

Authorizations:
path Parameters
id
required
string

Unique identifier for the object.

Responses

Response samples

Content type
application/json
{}

Job Result

{
  "id": "job_RH4lg43DvWW",
  "object": "job",
  "status": "delivered",
  "livemode" true,
  "segments": {
    "object": "list",
    "data": [
      {
        "id": "product#1#name",
        "object": "segment",
        "value": "ACME DIY Tornado Kit",
        "localeCode": "en-US"
      },
      {
        "id": "product#1#name",
        "object": "segment",
        "value": "Kit de Tornade DIY ACME",
        "localeCode": "fr"
      },
      {
        "id": "product#1#description",
        "object": "segment",
        "value": "Easily create your own tornadoes, anywhere.",
        "localeCode": "en-US"
      },
      {
        "id": "product#1#description",
        "object": "segment",
        "value": "Créez facilement et n'importe où, vos propres tornades.",
        "localeCode": "fr"
      }
    ]
  }
}

System

Echo

This is a dummy endpoint you can use to test if the server is accessible or to validate your credentials.

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "livemode": true
}