Transifex

  • Documentation
  • API
  • Introduction to the Transifex API

Introduction to the Transifex API

Transifex offers an extensive API that's designed to expose as much of Transifex's functionality as possible and make it easy to integrate Transifex with your existing tools. The API calls are REST compliant and make use of the most common HTTP methods such as GET, POST, PUT, and DELETE. The API is also used by the Transifex Client.

You'll find the main entities in the API in the left menu. Every project has a source language and a set of files (resources). For software projects, the source language is the language used in the source code. 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.

Base URL for API calls

All API calls should use the following URL prefix:

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

Authentication

Transifex requires all requests to the API to be authenticated through HTTP Basic Auth. The credentials to access the API are the same as the username and password you use to log into Transifex. Alternatively, you can also use an API token instead of your password. When using a token, the username field should be set to "api" and not your username.

To get your API token:

  • Head to your User Settings by going to the main navigation, and clicking on your profile image in the top right corner. 

  • In the left menu, click on API token.

  • Click Generate a key to generate a token.

To keep your API token secure, we'll only show it once, so please be sure to save it somewhere secure. In case you lose your API token, you can regenerate a new one at any time. However, when you regenerate a new token, you'll need to update your applications and replace the old token with the new one.

If you signed up for Transifex using social login, i.e. GitHub, Google, or LinkedIn, then your Transifex account won’t have a password associated with it by default. You can generate or change your password through your account settings page.

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's a list of the most useful options for cURL:

  • --user username:password: Give your username and your password (if your password contains special characters enclose it with apostrophe '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 api:<token> -X GET https://www.transifex.com/api/2/projects/

POST

$ curl -i -L --user api:<token> -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/

PUT

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

DELETE

$ curl -i -L --user api:<token> -X DELETE \
https://www.transifex.com/api/2/project/foo/

Heads up!

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

Terminology

Here are a few key terms to keep in mind:

  • Slug: A small string in the URL of a project or resource. Only alphanumeric characters, underscores _, and dashes - are allowed in the slug.
  • Source language: The language you are translating from. For a software program, this is the language strings in the source code is in.
  • i18n type: The format used in a resource for internationalization (i18n). For example, PO, TS, PROPERTIES, etc. Transifex supports over 25 file formats.

API rate limits

To maintain optimal performance for our API and ensure its available to all our customers, we limit the request rate to 6,000 requests/hour. Once past that limit, requests will be throttled and you may get a 503 status code. After one hour, you’ll be able to make API requests again at the normal rate.