Trustami.AI API
Reference
Connectors
There are prebuilt connectors available in JavaScript, PHP and Golang.
Base-URL
https://api.trustami.ai
Authentication
All routes require authentication. Authentication is done via bearer auth using your token in the Authorization header.
Example
Authorization: Bearer my-token
Request
All request data has to be sent as valid JSON. Form data is not supported.
Response
Failed requests will look similar to this:
{
"status": false,
"error": "invalid token"
}
Rate Limiting
You are limited to sending one request every 500 milliseconds.
Routes
/lang
Instantly find out which language your input text is written in. 27 languages available.
POST parameters
Field | Type | Description |
---|---|---|
text | string | The text you want to detect the language of. |
Example Request
{
"text": "This is an example text"
}
Response Data
{
"text": {
"text": "This is an example text"
},
"lang": "en"
}
/sent
Battle-tested polarity classification for multilingual texts. Sentiment intensity included.
POST parameters
Field | Type | Description |
---|---|---|
texts | []string | A list of texts you want to detect the sentiment of. |
Example Request
{
"texts": [
"This is an example text"
]
}
Response Data
{
"text": "This is an example text",
"polarity": "Positiv",
"score": 1
}
or
{
"sentiments": [
{
"text": "This is the first example text",
"polarity": "positive",
"score": 1.0
},
{
"text": "This is the second example text",
"polarity": "positive",
"score": 1.0
}
]
}
/summ
Find out more by reading less. Summarization for multilingual texts.
POST parameters
Field | Type | Description |
---|---|---|
tasks | []task | The list of summary tasks |
task
Field | Type | Description |
---|---|---|
text | string | The text you want to summarize. |
lang | string | Target language of the generated summary. |
Example Request
{
"tasks": [
{
"text": "Als der Kalte Krieg wird der Konflikt zwischen den Westmächten unter Führung der Vereinigten Staaten von Amerika und dem sogenannten Ostblock unter Führung der Sowjetunion bezeichnet, den diese von 1947 bis 1989 mit nahezu allen Mitteln austrugen. Zu einer direkten militärischen Auseinandersetzung zwischen den Supermächten USA, der Sowjetunion und ihren jeweiligen Militärblöcken kam es nie, es gab allerdings Stellvertreterkriege, wie den Koreakrieg, Vietnamkrieg und den Krieg in Afghanistan. Der Kalte Krieg trat als Systemkonfrontation zwischen Kapitalismus und Kommunismus in Erscheinung und bestimmte in der zweiten Hälfte des 20. Jahrhunderts weltweit Außen- und Sicherheitspolitik.",
"lang": "DE"
}
]
}
Response Data
{
"tasks": [
{
"title": "Summary",
"body": "Der Kalte Krieg war ein ideologischer Konflikt zwischen den USA (West) und der Sowjetunion (Ost) von 1947 bis 1989. \n**Schlüsselpunkte:**\n* **Ideologische Konfrontation:** Kapitalismus vs. Kommunismus.\n* **Direkte militärische Auseinandersetzung:** Fehlanzeige.\n* **Stellvertreterkriege:** Korea, Vietnam, Afghanistan.\n* **Globale Auswirkungen:** Bestimmte Außen- und Sicherheitspolitik weltweit.\n\nDer Kalte Krieg prägte die zweite Hälfte des 20. Jahrhunderts und blieb trotz fehlender direkter Konfrontation ein existenzieller Konflikt.",
"has_error": false
}
]
}
/tokn
Get your text in order.
POST parameters
Field | Type | Description |
---|---|---|
text | string | The text you want to tokenize. The max length per text is limited to 3500 characters. |
advanced | boolean | Advanced sentence tokenization, true/false. (default: true) |
split_camel_case | boolean | Recognizes camel case and splits into two sentences. (default: true) |
Example Request
{
"text": "This is an example text",
"advanced": true,
"split_camel_case": true
}
Response Data
{
"sentences": [
"Das ist ein erster Satz.",
"Das ist der zweite Satz.",
"Das ist der dritte Satz."
]
}
/nert
Filter and classify your text by named entities.
POST parameters
Field | Type | Description |
---|---|---|
text | string | The text you want to have tagged with NE. |
language | string | "english" or "german". (default: "german") |
Example Request
{
"text": "This is an example text",
"language": "english"
}
Response Data
{
"recognized_named_entites": [
{"text": "Person XY", "type": "PER", "start_char": 123, "end_char": 456}
]
}
/keyw
Extract keywords and keyphrases from your text.
POST parameters
Field | Type | Description |
---|---|---|
text | string | The text you want to process. |
start | integer | Start of n_gram. (default: 1) |
end | integer | End of n_gram. (default: 2) |
top_n | integer | Top n keyphrases. (default: 5) |
use_mmr | boolean | Maximum marginal relevance. (default: true) |
diversity | float | Diversity of keyphrases from low (0) to high (1). (default: 0) |
Example Request
{
"text": "This is an example text",
"start": 1,
"end": 2,
"top_n": 5,
"use_mmr": true,
"diversity": 0.0
}
Response Data
{
"keywords": [
["keyphrase1", 0.123],
["keyphrase2", 0.456],
["keyphrase3", 0.789]
]
}
/tran
Translate your texts into various languages, including english, german, korean, chinese and many more.
POST parameters
Field | Type | Description |
---|---|---|
tasks | []task | The list of translation tasks |
task
Field | Type | Description |
---|---|---|
text | string | The text you want to translate. |
lang | string | Target language of the translated text. |
Example Request
{
"tasks": [
{
"text": "I’m a big fan of Trustami and use their affordable AI services.",
"lang": "DE"
}
]
}
Response Data
{
"tasks": [
{
"title": "Summary",
"body": "Ich bin ein großer Fan von Trustami und nutze ihre erschwinglichen KI-Dienste.",
"has_error": false
}
]
}
/subd
Translate your texts into various languages, including english, german, korean, chinese and many more.
POST parameters
Field | Type | Description |
---|---|---|
tasks | []task | The list of translation tasks |
task
Field | Type | Description |
---|---|---|
text | string | The text you want to translate. |
lang | string | Target language of the translated text. |
Example Request
{
"tasks": [
{
"text": "I’m a big fan of Trustami and use their affordable AI services.",
"lang": "DE"
}
]
}
Response Data
{
"tasks": [
{
"title": "Summary",
"body": "Ich bin ein großer Fan von Trustami und nutze ihre erschwinglichen KI-Dienste.",
"has_error": false
}
]
}