ZPK Translate
An API to translate in more than 120 languages that beats Google Translate both in terms of translation quality and price per character.
ZPK Translate allows you to perform text and document translations using the latest translation technologies, an API that uses traditional algorithms created by humans, and also the latest advances in machine learning.
With the ZPK Translation API you will get more accurate translations, in less time, and at a lower price than our competitors.
API connection
Server and protocols involved.
Server: | https://zpk.systems |
---|---|
Scheme: | HTTPS, secure connections only. |
Protocol: |
JSON recommended
Sending a JSON in the request body, and specifying a Content-Type: application/json header in the request Files should be sent encoded as a base64 string. Form-Data not recommended
Format used in web forms, not recommended. When sending a form_data request you can send all the fields separately. However if the request is very large we recommend that you send the content of the request in a single text field called _json (with an underscore). This special parameter will be processed by our backend as if it were a regular JSON request. |
The server to send the requests to is https://zpk.systems, using a secure HTTPS connection.
The recommended communication type is JSON, in which case we will specify in the connection a Content-Type: application/json, and we will send the request body as a valid JSON string.
Text translation
Endpoint & parameters
Parameter | Description |
---|---|
application_id |
string required An application id. You can get the id of an application by clicking on 'details' in your panel |
api_key |
string required The API KEY of the application that makes the call to this API, you can obtain it in your panel, by clicking on the 'details' button of an application |
texts |
array required An array containing each element of it a text to translate and one or more translation languages. The language of the text you provide will be autodetected by ZPK, however you can specify it if you wish. Structure of an array element:
Example of texts[] element
|
Responses
Example response
{
"success": true,
"results": [
{
"source": "Los seres humanos son libres.",
"source_language": "es",
"translations": {
"en": "Human beings are free.",
"it": "Gli esseri umani sono liberi."
}
},
{
"source": "El perro es amarillo",
"source_language": "es",
"translations": {
"en": "the dog is yellow",
"it": "il cane è giallo"
}
}
],
"costs": {
"characters": 626,
"characters_substracted_from_free_quota": 0,
"characters_substracted_from_credit": 626,
"price_per_character_mili_eur": 16,
"total_cost": 0.010016
}
}
Response structure
Parameter | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
success |
boleano A boolean indicating whether the request could be successfully processed, true if so. |
||||||||
results |
translations array An array that will contain all the translations made.
|
||||||||
errors |
associative : array One or more errors in case of errors, the errors array is only returned in case the success bolean boolean is false. Cada elemento del array errors contiene:
|
||||||||
costs |
associative : array Detailed breakdown of the costs of this request to the translation API characters: Total number of characters.
characters_substracted_from_free_quota: Characters substracted from your monthly free quota.
characters_substracted_from_credit: The number of characters that are billed..
price_per_character_mili_eur: Price per character in euros/1000000 (million part of euro)
total_cost: Total request cost in euros.
|
Error response
{
"success": false,
"errors": [
{
"id": "MISSING_REQUIRED_PARAMETER",
"message": "Required parameter 'texts' not sent",
"on": "texts"
}
]
}
Obtaining all supported languages
Get all languages
You can get all supported languages and translations by calling the following endpoint:
Parameter | Description |
---|---|
application_id |
string required An application id. You can get the id of an application by clicking on 'details' in your panel |
api_key |
string required The API KEY of the application that makes the call to this API, you can obtain it in your panel, by clicking on the 'details' button of an application |
Example languages response
{
"success": true,
"languages": [
{
"code": "es",
"name": "español",
"localized": {
"af": "Spaans",
"ak": "Spanish",
"am": "ስፓኒሽኛ",
"more": "...",
"zu": "isi-Spanish"
},
"from": [
"af",
"ay",
"...",
"zh-CN"
],
"to": [
"af",
"ak",
"...",
"zu"
]
},
{
"more_languages_here":"..."
}
],
"costs": {
"total_cost": 0.01
}
}
Response structure
Parameter | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
success |
boleano A boolean indicating whether the request could be successfully processed, true if so. |
||||||||||
languages |
array An array containing all the languages that the API supports, and extra information about each language, such as name in different languages, and languages supported as source/target.
|
||||||||||
costs |
array of costs An associative array that will only contain a total_cost key with the cost of this API request Requesting a language listing is an API request that will be billed. We recommend saving this data in cache. |
PHP Integration
ZPK-PHP is an open source composer-installable library that will allow you to integrate our APIs into your PHP project with minimal effort.
Installing PHP ZPK with composer
composer require zpksystems/phpzpk
Translation example in PHP
<?php
require 'vendor/autoload.php';
use zpksystems\phpzpk\zpkApplication;
use zpksystems\phpzpk\zpkTranslator;
$t = new zpkTranslator( new zpkApplication('appid','key') );
$t->addTranslation("Buenos días, bienvenido al sitio web de ZPK Systems.",['en','it']);
$response = $t->translate();
Pricing
If you do not have enough credit in your account when making a request, the ZpkTranslate API will return an error.