NAV Navbar
curl php

Introduction

The Topcontent API allows you to make and manage your orders through a simple REST API.

Authentication

In order to use the API, you should authenticate your request by including your API key in each request as a GET or POST as a 'api_key' param.

Headers

Make sure you have the following content type headers are set on every request:

Accept: application/json Content-Type: application/json

URI

Topcontent API is hosted on the following base URI:

https://app.topcontent.com/api

Errors

Topcontent uses conventional HTTP response codes to indicate the success or failure of an API request. The table below contains a summary of the typical response codes:

Code Description
200 Everything is ok.
400 Valid data was given but the request has failed.
401 No valid API Key was given.
404 The request resource could not be found.
422 The payload has missing required parameters or invalid data was given.
429 Too many attempts.
500 Request failed due to an internal error in Topcontent.
503 Topcontent offline for maintenance.

Languages

The Topcontent API supports these language for content tasks:

Language Code Language Name
NO Norwegian
DA Danish
EN English
FI Finnish
SV Swedish
DE German
RU Russian
ES Spanish
NL Dutch
FR French
IT Italian
PL Polish
GR Greek
JA Japanese
PT Portuguese (Portugal)
BR Portuguese (Brazil)

Language Directions

The Topcontent API supports these language directions for translation tasks:

Language direction Language From Language To
Swedish to Danish SV DA
Swedish to English SV EN
Swedish to Norwegian SV NO
Swedish to Finnish SV FI
Swedish to German SV DE
Danish to Swedish DA SV
Danish to English DA EN
Danish to Norwegian DA NO
Danish to Finnish DA FI
English to Swedish EN SV
English to Danish EN DA
English to Norwegian EN NO
English to Finnish EN FI
English to Russian EN RU
English to Spanish EN ES
English to German EN DE
English to Dutch EN NL
English to French EN FR
English to Italian EN IT
English to Polish EN PL
English to Japanese EN JA
English to Portuguese (Brazil) EN BR
English to Portuguese (Portugal) EN PT
Norwegian to Swedish NO SV
Norwegian to Danish NO DA
Norwegian to English NO EN
Norwegian to Finnish NO FI
Finnish to Swedish FI SV
Finnish to English FI EN
Russian to English RU EN
German to Swedish DE SV
Dutch to English NL EN
Dutch to German NL DE
French to Dutch FR NL
Polish to English PL EN

Qualities

The Topcontent API supports these qualities:

Quality Quality Code
sq Standard Quality
bq Business Quality

Translation Orders

Add a text to translate

<?php
// Variables
$apiKey = '';
$requestId = '';
$text = '';
$languageFrom = '';
$languageTo = '';
$urlInfo = '';
$quality = '';

Payload

  {
    "api_key": "your_api_key",
    "request_id": "request_1",
    "text": "Original Text",
    "language_from": "SV",
    "language_to": "NO",
    "quality": "sq",
    "instructions": "Casual voice",
  }

Successful json response

  {
    "request_id": "request_1",
    "text": "Original Text",
    "language_from": "SV",
    "language_to": "NO",
    "quality": "sq",
    "instructions": "Casual voice",
    "created_at": "2019-01-09 09:00:00"
  }

Error json response

 {
    "request_id": [
        "The request_id has already been sent by you to the API earlier. Please make sure you send unique ids."
    ],
    "language_to": [
        "The language_to is required."
    ]
}

HTTP Request

POST /api/task

Parameters

Key Description
api_key Must be your API Key
request_id Must be unique, maximum length of 190 characters
text Text for translation. Maximum length of 5000 words
language_from Language code for an original language. Valid language directions.
language_to Language code for a language that a text should be translated to. Valid language directions.
quality Optional, the default is "sq". Valid options.
instructions Optional. To improve the accuracy add the instruction for a translator.

Receiving translated text

Payload

{
    "request_id": "request_1",
    "text": "Original Text",
    "translation": "Translated Text",
    "language_from": "SV",
    "language_to": "NO",
    "quality": "sq",
    "words": "2",
    "api_key": "your_api_key",
    "created_at": "2016-05-09 09:00:00",
    "returned_at": "2016-05-09 09:10:00"
}

Your callback URL will be called when the text has been successfully translated by Topcontent.

Get text by ID

Payload

  {
    "api_key": "your_api_key",
  }

Successful json response

  {
    "request_id": "request_1",
    "text": "Original Text",
    "translation": "Translation",
    "language_from": "SV",
    "language_to": "NO",
    "quality": "sq",
    "words": "2",
    "api_key": "your_api_key",
    "created_at": "2016-05-09 09:00:00"
}

Error json response

{
    "id": [
        "Please make sure you send a correct id."
    ],
}

HTTP Request

POST /api/task/{request_id}

Parameters

Key Description
api_key Must be your API Key

Review Orders

Approved Item

Payload

  {
    "api_key": "your_api_key",
  }

Successful json response

  {
    "request_id": "request_1",
    "text": "Original Text",
    "translation": "Translation",
    "language_from": "SV",
    "language_to": "NO",
    "quality": "sq",
    "words": "2",
    "api_key": "your_api_key",
    "created_at": "2016-05-09 09:00:00"
}

Error json response

{
    "id": [
        "Please make sure you send a correct id."
    ],
}

HTTP Request

POST /api/task/{request_id}/approved

Declined Item

Payload

  {
    "api_key": "your_api_key",
  }

Successful json response

  {
    "request_id": "request_1",
    "text": "Original Text",
    "translation": "Translation",
    "language_from": "SV",
    "language_to": "NO",
    "quality": "sq",
    "words": "2",
    "api_key": "your_api_key",
    "created_at": "2016-05-09 09:00:00"
}

Error json response

{
    "id": [
        "Please make sure you send a correct id."
    ],
}

HTTP Request

POST /api/task/{request_id}/declined