PTC

Find Supported File Formats and Languages via the API

Use these API endpoints to discover what source file formats and target languages your project supports before creating translation jobs.

Using these endpoints, you can query:

  • Target languages available for your project (with ISO codes)
  • Source file formats you can upload, plus any additional translation output formats PTC can generate for those files

All endpoints require a valid API token:

Authorization: Bearer YOUR_API_TOKEN

List All Target Languages

Retrieves the list of languages your project can be translated into. You can also use this endpoint to get the correct ISO codes when creating content translation jobs.

HTTP Request

GET https://app.ptc.wpml.org/api/v1/languages

Parameters

This endpoint does not accept any parameters.

Responses

Success Response

200 OKapplication/json
{
  "languages": [
    {
      "id": 123,
      "iso": "es",
      "name": "Spanish"
    },
    {
      "id": 124,
      "iso": "fr",
      "name": "French"
    },
    {
      "id": 125,
      "iso": "de",
      "name": "German"
    }
  ]
}
Response Schema
Field Type Description
languages array[object] The array of target language objects configured for this project.
languages[].id integer The unique identifier for the language.
languages[].iso string The ISO 639-1 language code (e.g., en, es, fr).
languages[].name string The human-readable name of the language.

Error Responses

Unauthorized
401 Unauthorized
{
  "error": "Unauthorized access. Please provide a valid API token."
}
Forbidden
403 Forbidden
{
  "error": "Access denied. Insufficient permissions."
}

Example Requests

Basic request:

curl -X GET "https://app.ptc.wpml.org/api/v1/languages" \
  -H "Content-Type: application/json"

Code Examples

const response = await fetch('https://app.ptc.wpml.org/api/v1/languages', {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json'
  }
});

const data = await response.json();
console.log('Available target languages:', data.languages);

// Get language codes only
const languageCodes = data.languages.map(lang => lang.iso);
console.log('Language codes:', languageCodes);

List Supported File Formats

Retrieves all source file extensions you can upload to PTC, along with any additional translation files PTC can generate for those inputs.

HTTP Request

GET https://app.ptc.wpml.org/api/v1/source_files/supported_extensions

Parameters

This endpoint does not accept any parameters.

Responses

Success Response

200 OKapplication/json
{
  "extensions": [
    {
      "extension": "po",
      "additional_translation_files": ["mo", "wp", "php"]
    },
    {
      "extension": "pot",
      "additional_translation_files": ["mo", "wp", "php"]
    },
    {
      "extension": "json",
      "additional_translation_files": []
    },
    {
      "extension": "yml",
      "additional_translation_files": []
    }
    //...
  ]
}
Response Schema
Field Type Description
extensions array An array of supported file extension objects.
extensions[].extension string The file extension, without the dot.
extensions[].additional_translation_files array An array of additional output formats available for this extension type.
Additional Translation Files

Some file types can generate extra translation files in other formats. For example, PO and POT files can produce:

  • mo – Compiled gettext files, used by many applications for faster loading
  • wp – JavaScript translation files used in WordPress for client-side internationalization
  • php – Translation files stored as PHP arrays

Code Examples

curl -X GET "https://app.ptc.wpml.org/api/v1/source_files/supported_extensions" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Next:

Request and retrieve translations via the API →