PTC API Reference
The PTC API uses REST and allows you to integrate software localization into your development process. The API endpoints let you add and update source files, retrieve information, manage translations, and more.
The PTC API can be used in live mode only. It supports standard HTTP methods and returns JSON-formatted responses. Authentication is token-based and project-specific.
Code Snippets
curl -X GET "https://app.ptc.wpml.org/api/v1/source_files/supported_extensions" \
-H "Authorization: Bearer YOUR_API_TOKEN"require 'net/http'
require 'uri'
uri = URI('https://app.ptc.wpml.org/api/v1/source_files/supported_extensions')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
response = http.request(request)
puts response.bodyimport requests
headers = {
'Authorization': 'Bearer YOUR_API_TOKEN'
}
response = requests.get('https://app.ptc.wpml.org/api/v1/source_files/supported_extensions', headers=headers)
print(response.json())<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://app.ptc.wpml.org/api/v1/source_files/supported_extensions',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_TOKEN'
],
]);
$response = curl_exec($curl);
curl_close($curl);
print_r(json_decode($response, true));
?>import okhttp3.*;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://app.ptc.wpml.org/api/v1/source_files/supported_extensions")
.addHeader("Authorization", "Bearer YOUR_API_TOKEN")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://app.ptc.wpml.org/api/v1/source_files/supported_extensions", nil)
req.Header.Add("Authorization", "Bearer YOUR_API_TOKEN")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", "YOUR_API_TOKEN");
var response = await client.GetAsync("https://app.ptc.wpml.org/api/v1/source_files/supported_extensions");
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);const axios = require('axios');
const response = await axios.get('https://app.ptc.wpml.org/api/v1/source_files/supported_extensions', {
headers: { 'Authorization': 'Bearer YOUR_API_TOKEN' }
});
console.log(response.data);The documentation uses cURL to show how to make HTTP requests to the PTC API, but you can switch tabs to see the same request in other languages.
Authentication
Creating API tokens is a Pro feature. It becomes available when you activate Pay-As-You-Go.
To get started:
-
Log into your PTC account. If you don’t have one yet, start a free trial and upload your first file manually.
-
To move an existing project to API integration, go to Settings → Manage API Tokens and add an access token. For subsequent projects, you can select API integration in the setup wizard.
All requests to the PTC API require authentication using a token that gives you access to a single project in PTC.
Include the token in the Authorization header of every request using the Bearer format:
Bearer <AUTHENTICATION_TOKEN>
Response Codes
The PTC API uses standard HTTP response codes to indicate the success or failure of a request.
Authentication Status Codes
The request worked as expected.
No valid API token was provided. Check if your token is correct, hasn’t expired, and is included in the Authorization header.
Rate Limiting
The PTC API implements rate limiting to ensure fair usage and maintain service quality. Limits are applied per organization and tracked across specific API operations.
| Limit Type | Requests | Time Frame | Scope |
|---|---|---|---|
| File Operations | 10 | 1 minute | Per Organization |
Affected Endpoints
POST /api/v1/source_files– Create the source filesPUT /api/v1/source_files/process– Process the source filesPOST /api/v1/source_files/bulk– Upload source files in bulk
When Rate Limits Are Exceeded
If a request exceeds the allowed rate, the API returns:
Status: 429 Too Many Requests
{
"error": "Rate limit exceeded"
}
Available API Categories
Upload and Manage Source Files via the API
Use these endpoints to upload, replace, and organize your source files. This includes:
- Uploading a single file or bulk uploading multiple files in a ZIP archive
- Replacing or updating an existing source file with new content
- Listing files with filtering, sorting, and pagination options
Go to Upload and Manage Source Files →
Get Supported File Formats and Target Languages via the API
Use these endpoints to check:
- The correct ISO codes to use when creating translation jobs or uploading translations
- Which languages your project supports
- All source file extensions you can upload to PTC, along with any additional translation files PTC can generate for those inputs
Go to Available File Formats and Target Languages →
Request and Retrieve Translations via the API
Use these endpoints to submit content for translation, track its progress, and retrieve translations. This includes:
- Creating translation jobs for JSON-structured content
- Checking the status of translation jobs
- Retrieving completed translations
Go to Request and Retrieve Translations →
Integrate Localization into Your CI/CD Pipeline with the PTC API
Use this guide to automate translations as part of your build process. This includes:
- Setting up PTC with GitHub Actions, GitLab CI/CD, or other CI/CD systems using ready-made configuration files
- Running translations automatically and securely during every build
Try PTC free for 30 days
Translate up to 20,000 words into 2 languages at no cost, then upgrade to Pro to unlock every feature.