Sentiment Analysis API

Sentiment analysis API uses machine learning to reveal the structure and meaning of text. You can extract information about people, places, and events, and better understand customer sentiment.

API Server

nlu-api.allganize.ai is Allganize's NLU API endpoint. If you are using on-prem, please use your API endpoint.

Getting API KEY

The NLU API uses API keys to authenticate requests that you can find in the Allganize NLU API dashboard. Go to Settings > General to find your API key. If you don't have an account yet, you can create one here.

Provide your API KEY in the request header API-KEY.

post
Sentiment Analysis API

https://nlu-api.allganize.ai/api/inference
Request
Response
Request
Headers
API-KEY
required
string
Your API Key can be found on your dashboard Settings menu, under the General tab.
Body Parameters
text
required
string
Input text you want to analyze. You can enter up to 2000 characters, after which the entered characters will be ignored.
Response
200: OK
The response has a classified result for the requested text. displayText: The result of the sentiment analysis. POSITIVE, NEUTRAL or NEGATIVE. id: The result of the sentiment analysis in an ID form. confidence: It shows the confidence value from AI model. Shown as a number value between 0 and 1.
{
"inputText": STRING,
"intent": {
"id": NUMBER,
"displayText": STRING,
"confidence": NUMBER
}
}

Request Example

Please replace YOUR_API_KEY with your one in the example below. Please see getting-api-key section.

curl https://nlu-api.allganize.ai/api/inference \
-d '{"text": "Loved the location and the breakfast. Would definitely stay here again!"}' \
-H "Content-Type: application/json" \
-H "API-KEY: YOUR_API_KEY"

Response Example

{
"inputText": "Loved the location and the breakfast. Would definitely stay here again!",
"intent": {
"id": 656,
"displayText": "POSITIVE",
"confidence": 0.9603047832230137
}
}

Error Messages

Please read the error message you get if you don't get the response that you expected.

Status Code

Error Code

Name

Message

Description

500

7000

API Error

Something went wrong

Default API error message for any uncategorized errors.

403

7001

Invalid API Key

API-KEY is not valid.

When the API Key requested to the header is invalid.

403

7002

Invalid JSON

Cannot decode the requested JSON body.

When the requested JSON is not decodable.

400

7003

Invalid Parameter

Requested parameters are not valid. 'text' is empty.

When the requested parameter is invalid (for example, when requesting inference with empty text).

405

-

Wrong HTTP Method

-

When the HTTP method used is not valid.

Error Response example

{
"type": "APIError",
"code": 7000,
"message": "Something went wrong."
}