• Documentation
  • API
  • Examples of API Calls

Examples of API Calls

Before you begin, here are a few things to keep in mind about the Transifex API.

All API calls should use the following URL prefix:


All projects are handled under this URL schema:


Any resource content is handled under this URL schema:



Note that project_slug and resource_slug can be found in your project's URL: https://www.transifex.com/organization_slug/project_slug/resource_slug/

Creating a project

In order to create a new project on Transifex, using Transifex API, use the following API call:

$ curl -i -L --user username:password -d '{"slug":"documentation", "name":"Transifex Documentation", "source_language_code":"en", "private": true}' \
-H "Content-Type: application/json" -X POST https://www.transifex.com/api/2/projects/

So, the new project "Transifex Documentation" will be handled under this URL:


Uploading a new source file to Transifex

Let's assume that you would like to upload a new source file on Transifex under the project you just created with the following information:

  • organization_slug: transifex
  • project_slug: documentation
  • slug: api_doc,
  • name: API-Documentation

All you need to do is to type the following command line (note that slug and name above are example values specified by you):

$ curl -i -L --user username:password -H "Content-tye: multipart/form-data" \
-F slug=api_doc -F name=API-Documentation -F i18n_type=XLIFF -F content=@path_to_the_file \
-X POST http://www.transifex.com/api/2/project/documentation/resources/

Updating the source file

Now, let's assume that you have a new version of your source file and you need to update its content on Transifex. So, use the following API call in order to do that:

$ curl -i -L --user username:password -F file=@path_to_the_file \
-X PUT http://www.transifex.com/api/2/project/documentation/resource/api_doc/content/

Regarding the above case, please check this link in order to have an overall view of how Transifex handles updates of a source file.


  • New strings are being added.
  • Modified strings are considered new ones and are being added as well.
  • Strings which do not exist in the new source file (including ones which have been modified) are being removed from the database, along with their translations.

Uploading translation files to Transifex

Now, let's upload, for example, a French translation file to the "API-Documentation" resource. Use can simply do that, by using the following command line:

​$ curl -i -L --user username:password -F file=@path_to_the_file \
-X PUT http://www.transifex.com/api/2/project/documentation/resource/api_doc/translation/fr/

Add translation to a specific source string

Let's assume now that you want to translate a specific string of the "API-Documentation" resource to French.

Step 1

The first thing you need to do is to get the whole information of the desired string by typing the following command line:

$ curl -i -L --user username:password \
-X GET https://www.transifex.com/api/2/project/documentation/resource/api_doc/translation/fr/strings/?details&key=the_key_of_the_string


You need to know the key of the string you are interested in.

Please note that if you use the above URL without adding the key at the end of it: https://www.transifex.com/api/... then you will get the information for all the existing strings of the resource.

So, the above GET request will return something like this (example):

"comment": "",
"context": "",
"tags": null,
"character_limit": null,
"reviewed": false,
"user": "nelefth",
"key": "Trans_definition",
"source_string": "Transifex is a localization platform.",
"translation": "Transifex est une plate-forme de localisation.",
"last_update": "2015-10-16T16:17:19.307",
"pluralized": false,
"occurrences": "forms.py:189"

Step 2

After that, you need to calculate the hash of the string by using the following Python commands:

from hashlib import md5
keys = ["Trans_definition", '']
print( md5(':'.join(keys).encode('utf-8')).hexdigest() );
2a7cc1619ef9ae8b1274470301153ded (the hash will look like this)

In case the "context": is not None then please check this link in order to calculate the string hash correctly

Step 3

The final step is to upload the translation on Transifex by using the following API call:

$ curl -i -L --user your_username:your_password \
-H "Content-Type: application/json" --data ‘{"translation": "Transifex est une plate-forme de localisation."}' \
-X PUT https://www.transifex.com/api/2/project/documentation/resource/api_doc/translation/fr/string/2a7cc1619ef9ae8b1274470301153ded/