Introduction
Welcome to the powerTM API.
This API allows for high performance TM & TB management
Generalities
All the API calls return JSON-formatted data
Listing calls return paginated data with 50 items per page
Authentication
To authorize, use this code:
# With shell, you can just pass the correct header with each request
curl "api_endpoint_here" \
-H "Authorization: ***"
Make sure to replace
***with your API key.
powerTM uses API keys to allow access to the API. You can register a new powerTM API key on your admin interface.
Kittn expects for the API key to be included in all API requests to the server in a header that looks like the following:
Authorization: ***
Projects
Project list
curl "https://power-tm.com/api/projects?page=1" \
-H "Authorization: ***"
The above command returns JSON structured like this:
{
"data": [
{
"id": 1,
"name": "My translation project",
"created_at": "2022-01-01T10:44:00"
}
],
"pages": 48,
}
This endpoint retrieves all translation projects.
HTTP Request
GET https://power-tm.com/api/projects
Query Parameters
| Parameter | Default | Description |
|---|---|---|
| page | 1 | Page to retrieve. |
Retrieve project
curl "https://power-tm.com/api/project/1" \
-H "Authorization: ***"
The above command returns JSON structured like this:
{
"id": 1,
"name": "My translation project",
"source_locale_id": 1,
"target_locale_ids": [2, 3, 4],
"file_ids": [123, 124],
"created_at": "2022-01-01T10:44:00"
}
This endpoint retrieves detailed information about a single translation project.
HTTP Request
GET https://power-tm.com/api/projects/{project_id}
URL Parameters
| Parameter | Description |
|---|---|
| project_id | ID of the project to retrieve. |
Create project
curl -X POST "https://power-tm.com/api/project" \
-H "Authorization: ***" \
--data-raw '{
"name": "My new translation project"
"source_locale_id": 1,
"target_locale_ids": [2, 3, 4]
}'
The above command returns JSON structured like this:
{
"success": true,
"created_id": 2
}
This endpoint creates a new translation project.
HTTP Request
POST https://power-tm.com/api/project
JSON body Parameters
| Parameter | Mandatory | Description |
|---|---|---|
| name | yes | Name of the project |
| source_locale_id | yes | ID of the source locale |
| target_locale_ids | yes | ID of the target locales |
Update project
curl -X POST "https://power-tm.com/api/project/2" \
-H "Authorization: ***" \
--data-raw '{
"name": "My updated translation project"
}'
The above command returns JSON structured like this:
{
"success": true
}
This endpoint updates a translation project.
HTTP Request
POST https://power-tm.com/api/project/{project_id}
URL Parameters
| Parameter | Description |
|---|---|
| project_id | ID of the project to update. |
JSON body Parameters
| Parameter | Mandatory | Description |
|---|---|---|
| name | no | Name of the project |
| source_locale_id | no | ID of the source locale |
| target_locale_ids | no | ID of the target locales |
Delete project
curl -X POST "https://power-tm.com/api/project/2/delete" \
-H "Authorization: ***"
The above command returns JSON structured like this:
{
"success": true
}
This endpoint deletes a translation project.
HTTP Request
POST https://power-tm.com/api/project/{project_id}/delete
URL Parameters
| Parameter | Description |
|---|---|
| project_id | ID of the project to delete. |
Project files
Get project files
curl "https://power-tm.com/api/project/1/files?page=1" \
-H "Authorization: ***"
The above command returns JSON structured like this:
{
"data": [
{
"id": 1,
"filename": "trans_file.xlsx",
"keycount": 653
}
],
"pages": 1,
}
This endpoint retrieves all the files of a translation project.
HTTP Request
GET https://power-tm.com/api/project/{project_id}/files
URL Parameters
| Parameter | Description |
|---|---|
| project_id | ID of the project to retrieve files for |
Query Parameters
| Parameter | Default | Description |
|---|---|---|
| page | 1 | Page to retrieve. |
Create project file
curl -X POST "https://power-tm.com/api/project/2/file" \
-H "Authorization: ***" \
--data-raw '{
"filename": "trans_file.pdf"
}'
The above command returns JSON structured like this:
{
"success": true,
"created_id": 2
}
This endpoint creates a new translation project file.
HTTP Request
POST https://power-tm.com/api/project/{project_id}/file
JSON body Parameters
| Parameter | Mandatory | Description |
|---|---|---|
| filename | yes | Filename of the file. |
Update project file
curl -X POST "https://power-tm.com/api/project/2/file/2" \
-H "Authorization: ***" \
--data-raw '{
"filename": "updated_trans_file.pdf"
}'
The above command returns JSON structured like this:
{
"success": true
}
This endpoint updates a translation project file.
HTTP Request
POST https://power-tm.com/api/project/{project_id}/file/{file_id}
URL Parameters
| Parameter | Description |
|---|---|
| project_id | ID of the project to update. |
| file_id | ID of the file to update. |
JSON body Parameters
| Parameter | Mandatory | Description |
|---|---|---|
| filename | no | Name of the file to update |
Delete project file
curl -X POST "https://power-tm.com/api/project/2/file/2/delete" \
-H "Authorization: ***"
The above command returns JSON structured like this:
{
"success": true
}
This endpoint deletes a translation project file.
HTTP Request
POST https://power-tm.com/api/project/{project_id}/file/{file_id}/delete
URL Parameters
| Parameter | Description |
|---|---|
| project_id | ID of the project you want to delete a file for |
| file_id | ID of the project file to delete. |
Segments and translations
Get file segments
curl "https://power-tm.com/api/project/1/file/1/segments" \
-H "Authorization: ***"
The above command returns JSON structured like this:
{
"data": [
{
"id": 1,
"locale": 1,
"text": "My first segment",
"translations": [{
"id": 1,
"locale_id": 2,
"text": "Mon premier segment"
}]
}
],
"pages": 178,
}
This endpoint retrieves all the segments of a translation file.
HTTP Request
GET https://power-tm.com/api/project/{project_id}/file/{file_id}/segments
URL Parameters
| Parameter | Description |
|---|---|
| project_id | ID of the project. |
| file_id | ID of the file to retrieve segments for. |
Query Parameters
| Parameter | Default | Description |
|---|---|---|
| page | 1 | Page to retrieve. |
| with_translation | true | Retrieve segment translations |
Create segments
curl -X POST "https://power-tm.com/api/project/2/file/2/segments" \
-H "Authorization: ***" \
--data-raw '[{
"text": "First segment",
"translations": [{
"locale_id": 1,
"text": "Premier segment"
}]
}]'
The above command returns JSON structured like this:
{
"success": true
}
This endpoint creates new translation segments.
HTTP Request
POST https://power-tm.com/api/project/{project_id}/file/{file_id}/segments
URL Parameters
| Parameter | Description |
|---|---|
| project_id | ID of the project. |
| file_id | ID of the file to create segments for. |
JSON body Parameters
An array of segment, see below
Segment
| Parameter | Mandatory | Description |
|---|---|---|
| text | yes | Segment text |
| translations | yes | Array of segment translation see below |
Segment translation
| Parameter | Mandatory | Description |
|---|---|---|
| locale_id | yes | Translation locale |
| text | yes | Translation text |
Delete segment
curl -X POST "https://power-tm.com/api/project/2/file/2/segment/2" \
-H "Authorization: ***"
The above command returns JSON structured like this:
{
"success": true
}
This endpoint deletes a translation segment.
HTTP Request
POST https://power-tm.com/api/project/{project_id}/file/{file_id}/segment/{segment_id}
URL Parameters
| Parameter | Description |
|---|---|
| project_id | ID of the project. |
| file_id | ID of the file. |
| segment_id | ID of the segment to delete. |
Search TM
curl "https://power-tm.com/api/translation/search?q=first&locale=2&type=source" \
-H "Authorization: ***"
The above command returns JSON structured like this:
{
"data": [
{
"segment_id": 1,
"locale_id": 1,
"project_id": 1,
"file_id": 1,
"text": "My first segment"
},
{
"segment_id": 1,
"translation_id": 2,
"locale_id": 2,
"project_id": 1,
"file_id": 1,
"text": "My first segment"
}
],
"pages": 17,
}
This endpoint retrieves segments and translations that match the search.
Will return translation_id if the matched text is a translation (target text).
HTTP Request
GET https://power-tm.com/api/translation/search
Query Parameters
| Parameter | Default | Description |
|---|---|---|
| q | Mandatory | Query string. |
| locale | all | ID of the locale to search the text in. all or no parameter for no filtering. |
| type | all | source for source text search only, target for target text search only, all for both. |
| page | 1 | Page to retrieve. |
Get segment details
curl "https://power-tm.com/api/project/1/file/1/segment/1" \
-H "Authorization: ***"
The above command returns JSON structured like this:
{
"id": 1,
"locale": 1,
"text": "My first segment",
"translations": [{
"id": 1,
"locale_id": 2,
"text": "Mon premier segment"
}]
}
This endpoint retrieves all the segments of a translation file.
HTTP Request
GET https://power-tm.com/api/project/{project_id}/file/{file_id}/segment/{segment_id}
URL Parameters
| Parameter | Description |
|---|---|
| project_id | ID of the project. |
| file_id | ID of the file to retrieve segment for. |
| segment_id | ID of the segment to retrieve |
Glossaries
Glossary list
curl "https://power-tm.com/api/glossaries?page=1" \
-H "Authorization: ***"
The above command returns JSON structured like this:
{
"data": [
{
"id": 1,
"name": "My glossary",
"created_at": "2022-01-01T10:44:00"
}
],
"pages": 4,
}
This endpoint retrieves all the glossaries.
HTTP Request
GET https://power-tm.com/api/glossaries
Query Parameters
| Parameter | Default | Description |
|---|---|---|
| page | 1 | Page to retrieve. |
Create glossary
curl -X POST "https://power-tm.com/api/glossary" \
-H "Authorization: ***" \
--data-raw '{
"name": "My new translation project"
}'
The above command returns JSON structured like this:
{
"success": true,
"created_id": 2
}
This endpoint creates a new translation project.
HTTP Request
POST https://power-tm.com/api/glossary
JSON body Parameters
| Parameter | Mandatory | Description |
|---|---|---|
| name | yes | Name of the glossary |
Update glossary
curl -X POST "https://power-tm.com/api/glossary/2" \
-H "Authorization: ***" \
--data-raw '{
"name": "My updated glossary"
}'
The above command returns JSON structured like this:
{
"success": true
}
This endpoint updates a glossary.
HTTP Request
POST https://power-tm.com/api/glossary/{glossary_id}
URL Parameters
| Parameter | Description |
|---|---|
| glossary_id | ID of the glossary to update. |
JSON body Parameters
| Parameter | Mandatory | Description |
|---|---|---|
| name | no | Name of the project |
Delete glossary
curl -X POST "https://power-tm.com/api/glossary/2/delete" \
-H "Authorization: ***"
The above command returns JSON structured like this:
{
"success": true
}
This endpoint deletes a glossary.
HTTP Request
POST https://power-tm.com/api/glossary/{glossary_id}/delete
URL Parameters
| Parameter | Description |
|---|---|
| glossary_id | ID of the glossary to delete. |
Glossary term
Glossary term list
curl "https://power-tm.com/api/glossary/1/terms?page=1" \
-H "Authorization: ***"
The above command returns JSON structured like this:
{
"data": [
{
"id": 1,
"locale_id": 1
"term": "My glossary term",
}
],
"pages": 4,
}
This endpoint retrieves all the terms in a glossary.
HTTP Request
GET https://power-tm.com/api/glossary/{glossary_id}/terms
URL Parameters
| Parameter | Description |
|---|---|
| glossary_id | ID of the glossary to create a term for. |
Query Parameters
| Parameter | Default | Description |
|---|---|---|
| page | 1 | Page to retrieve. |
Glossary term details
curl "https://power-tm.com/api/glossary/1/term/1" \
-H "Authorization: ***"
The above command returns JSON structured like this:
{
"term": "My glossary term",
"locale_id": 1,
"translations": [{
"id": 1,
"locale_id": 2,
"text": "Mon terme de glossaire"
}]
}
This endpoint retrieves the details of a term in a glossary.
HTTP Request
GET https://power-tm.com/api/glossary/{glossary_id}/term/{term_id}
URL Parameters
| Parameter | Description |
|---|---|
| glossary_id | ID of the glossary to retrieve a term for. |
| term_id | ID of the term to retrieve |
Add term to glossary
curl -X POST "https://power-tm.com/api/glossary/1/term" \
-H "Authorization: ***" \
--data-raw '{
"locale_id": 1,
"text": "My glossary term",
"translations": [{
"locale_id": 2,
"text": "Mon terme de glossaire"
}]
}'
The above command returns JSON structured like this:
{
"success": true,
"created_id": 2
}
This endpoint creates a new glossary term.
HTTP Request
POST https://power-tm.com/api/glossary/{glossary_id}/term
URL Parameters
| Parameter | Description |
|---|---|
| glossary_id | ID of the glossary to create a term for. |
JSON body Parameters
| Parameter | Mandatory | Description |
|---|---|---|
| locale_id | yes | Locale of the new term |
| text | yes | Term text |
| translations | no | Array of term translation |
Term translation
| Parameter | Mandatory | Description |
|---|---|---|
| locale_id | yes | Locale of the term translation |
| text | yes | Term translation text |
Update glossary term
curl -X POST "https://power-tm.com/api/glossary/1/term/1" \
-H "Authorization: ***" \
--data-raw '{
"locale_id": 1,
"text": "My updated glossary term"
}'
The above command returns JSON structured like this:
{
"success": true,
"created_id": 2
}
This endpoint updates a glossary term.
HTTP Request
POST https://power-tm.com/api/glossary/{glossary_id}/term/{term_id}
URL Parameters
| Parameter | Description |
|---|---|
| glossary_id | ID of the glossary to update a term for. |
| term_id | ID of the term to update |
JSON body Parameters
| Parameter | Mandatory | Description |
|---|---|---|
| locale_id | no | Locale of the term |
| text | no | Term text |
Delete glossary term
curl -X POST "https://power-tm.com/api/glossary/1/term/1/delete" \
-H "Authorization: ***"
The above command returns JSON structured like this:
{
"success": true,
}
This endpoint deletes a glossary term.
HTTP Request
POST https://power-tm.com/api/glossary/{glossary_id}/term/{term_id}/delete
URL Parameters
| Parameter | Description |
|---|---|
| glossary_id | ID of the glossary to delete a term for. |
| term_id | ID of the term to delete |
Glossary term translation
Add translation to glossary term
curl -X POST "https://power-tm.com/api/glossary/1/term/1/translation" \
-H "Authorization: ***" \
--data-raw '{
"locale_id": 2,
"text": "Mon terme de glossaire"
}'
The above command returns JSON structured like this:
{
"success": true,
"created_id": 2
}
This endpoint creates a new glossary term.
HTTP Request
POST https://power-tm.com/api/glossary/{glossary_id}/term/{term_id}/translation
URL Parameters
| Parameter | Description |
|---|---|
| glossary_id | ID of the glossary to update a term for. |
| term_id | ID of the glossary term to add a translation for |
JSON body Parameters
| Parameter | Mandatory | Description |
|---|---|---|
| locale_id | yes | Locale of the translation |
| text | yes | Translation text |
Update term translation
curl -X POST "https://power-tm.com/api/glossary/1/term/1/translation/1" \
-H "Authorization: ***" \
--data-raw '{
"text": "My updated glossary term"
}'
The above command returns JSON structured like this:
{
"success": true
}
This endpoint updates a glossary term translation.
HTTP Request
POST https://power-tm.com/api/glossary/{glossary_id}/term/{term_id}/translation/{translation_id}
URL Parameters
| Parameter | Description |
|---|---|
| glossary_id | ID of the glossary to update a term for. |
| term_id | ID of the term to update |
| translation_id | ID of the translation to update |
JSON body Parameters
| Parameter | Mandatory | Description |
|---|---|---|
| text | no | Term text |
Delete term translation
curl -X POST "https://power-tm.com/api/glossary/1/term/1/translation/1/delete" \
-H "Authorization: ***"
The above command returns JSON structured like this:
{
"success": true
}
This endpoint deletes a glossary term translation.
HTTP Request
POST https://power-tm.com/api/glossary/{glossary_id}/term/{term_id}/translation/{translation_id}/delete
URL Parameters
| Parameter | Description |
|---|---|
| glossary_id | ID of the glossary to update a term for. |
| term_id | ID of the term to update |
| translation_id | ID of the translation to update |
Locales
Locales list
curl "https://power-tm.com/api/locales" \
-H "Authorization: ***"
The above command returns JSON structured like this:
[{
"id": 1,
"locale": "en_US",
"name": "English (USA)"
}]
This endpoint retrieves all available locales
HTTP Request
GET https://power-tm.com/api/locales
Errors
The PowerTM API uses the following error codes:
| Error Code | Meaning |
|---|---|
| 400 | Bad Request -- Your request is invalid. |
| 401 | Unauthorized -- Your API key is wrong. |
| 403 | Forbidden -- Insufficient permissions. |
| 404 | Not Found -- The specified resource could not be found. |
| 405 | Method Not Allowed -- You tried to access a resource with an invalid method. |
| 500 | Internal Server Error -- We had a problem with our server. Try again later. |