• 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 only allows authenticated requests to the API. Currently, the authentication method supported is HTTP Basic Authentication. The credentials to access the API are the same as those used to access Transifex itself, i.e. your username and password. All external applications should make use of HTTP Basic Authentication, if they need to perform some operations with the Transifex API.

In case you use social login social authentication to log in to Transifex (that is Facebook, LinkedIn, Twitter etc. credentials), you'll first need to get a Transifex password and use that to utilize the API. 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 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/

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/

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 6000 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.