The Transifex API

Transifex offers an extensive API (Application Programmable Interface).

We try to expose as much of the functionality of Transifex as possible to the API, so that it is easier for you to automate your workflow and integrate Transifex in your existing tools. The API is used in the Transifex Client, too.

The API calls are REST compliant and make use of the most common HTTP methods such as GET, POST, PUT and DELETE.

The main entities in the API can be found on the left menu. Each project has a source language and a set of files (resources). In the case of a software project, the source language is the language used in the source code for the translatable strings.

Each resource in turn consists of the source file, that is, the internationalization file with the translatable strings in the source language, and the translations of the strings.

Basic API usage

You can use a variety of (desktop or web-based) tools to test the API. A quick way to do it is through the command-line tool cURL.

Here is a list with the most useful options for cURL:

  • --user user:password: Give your username and your password.
  • -L: Follow HTTP redirections.
  • -i: Show response headers.
  • -X <METHOD>: Specify a HTTP method to use (GET, POST, PUT, DELETE).
  • -d: Pass in parameters enclosed in quotes; multiple parameters are separated by '&'.
  • -H: Add any extra headers.

Examples

GET

curl -i -L --user username:password -X GET https://www.transifex.com/api/2/projects/

POST

curl -i -L --user username:password -X POST \
-d '{"slug":"foo","name":"Foo","source_language_code":"en","description":"Description"}' \
-H "Content-Type: application/json" https://www.transifex.com/api/2/projects/

curl -i -L --user username:password -X POST -H "Content-Type: application/json" \
-d '{"slug": "bar", "name": "Bar", "i18n_type": "XHTML", "content": "<p>Bar</p>"}' \
https://www.transifex.com/api/2/project/foo/resources/

PUT

curl -i -L --user username:password -X PUT -d '{"name":"Foo2"}' \
-H "Content-Type: application/json" https://www.transifex.com/api/2/project/foo/

DELETE

curl -i -L --user username:password -X DELETE \
https://www.transifex.com/api/2/project/foo/

Note: The trailing slash in the URLs is necessary to avoid any redirects, especially for POST requests.

Authentication

Transifex allows only authenticated requests to the API. Currently, the authentication method supported is the HTTP Basic Authentication. The credentials to access the API are the same as those used to access Transifex itself (username and password). All external applications should make use of the HTTP Basic Authentication, if they need to perform some operations with the Transifex API.

In case a user uses social authentication to log in to Transifex (that is Facebook, LinkedIn, Twitter etc. credentials), she/he needs to generate a Transifex password first and use that to utilize the API. You can generate or change your password through your account settings page.

Terminology

  • slug: A small string that will be used in the URL of a project or resource. The allowed characters are the alphanumeric characters as well as the characters '_' and '-'.

  • source language​: The language that the content is originally written into. For instance, in a software program, this is the language used for the strings in the source code.

  • ​i18n type: The format used in a resource for internationalization (i18n). For example, PO, TS, PROPERTIES etc. Check the list of supported formats.​

​​Base URL for API Calls

All API calls should use the following URL prefix:

https://www.transifex.com/api/2/