Documentation
API
Translation API: REST endpoints reference
This document describes the resources that make up the WebTranslateIt API. If you have any problems or requests, please contact support.
This API is considered stable. No breaking changes will occur.
Schema
All API access is over HTTPS and accessed from:
https://webtranslateit.com/api/
Data may be returned by WebTranslateIt as JSON, YAML and XML, depending on the endpoints.
Authentication
Authentication is made by so-called API tokens. Each project gets 2 unique API tokens you can find in the project settings:
- the read-write token. A token that allows calls to all API endpoints,
- the read-only token. A token that allows calls to
GETAPI endpoints (Project API, File API and Statistics API).
The token goes in the URL path — there is no Authorization header to set. Organization-level
endpoints take an Organization API token, which you will find in your organization settings.
Throughout these docs, PROJECT_TOKEN and ORGANIZATION_TOKEN mark the place to paste your own
token. Every example is otherwise ready to run:
/api/projects/:project_token.jsoncurl "https://webtranslateit.com/api/projects/PROJECT_TOKEN.json"
const response = await fetch(
'https://webtranslateit.com/api/projects/PROJECT_TOKEN.json'
)
const { project } = await response.json()
import requests
response = requests.get(
"https://webtranslateit.com/api/projects/PROJECT_TOKEN.json"
)
project = response.json()["project"]
require 'net/http'
require 'json'
uri = URI('https://webtranslateit.com/api/projects/PROJECT_TOKEN.json')
project = JSON.parse(Net::HTTP.get(uri))['project']
<?php
$ch = curl_init('https://webtranslateit.com/api/projects/PROJECT_TOKEN.json');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$project = json_decode(curl_exec($ch), true)['project'];
curl_close($ch);
{
"project": {
"name": "Doughnut",
"id": 406,
"source_locale": { "name": "English", "code": "en" },
"target_locales": [{ "name": "French", "code": "fr" }],
"project_files": []
}
}
Treat a read-write token like a password: it can delete files and segments, so keep it out of client-side code and out of version control.
Rate Limiting
We rate limit the API endpoints based on IPs to 25 req/sec. Subsequent requests are ignored and get a 429 response.
CORS
All API endpoints are accessible via Cross-origin resource sharing (CORS), which means that all endpoints can be requested from another domain from which the first resource was served.
HTTP Verbs
The WebTranslateIt API uses appropriate HTTP verbs for each action.
- GET Used for retrieving resources.
- POST Used for creating resources.
- PATCH Used for replacing resources (although PUT can also be used).
- DELETE Used for deleting resources.
Endpoints
11 different resources can be accessed. Their specification is separated into different sections in the documentation:
- Project API
- User API
- File API
- Stats API
- Locale API
- String API
- Translation API
- TermBase API
- TermBase Translation API
- Organization API
- Collaboration API
We made a ruby client that uses these endpoints. Use it or take a look at it as an implementation example.