# Review Analysis API

## API Server

Allganize 의 API 엔드포인트는 [nlu-api.allganize.ai](https://nlu-api.allganize.ai) 입니다. On-prem 플랜을 사용중이시라면 사용을 원하는 API 엔드포인트를 사용하시면 됩니다.

## API 키 얻기

모든 NLU API 들은 요청을 검증하기 위해 API 키를 사용합니다. API 키는 [NLU API 대시보드](https://nlu.allganize.ai/projects)의 설정 메뉴에서 찾을 수 있습니다. NLU API 대시보드 계정이 없다면 [여기](https://nlu.allganize.ai/signup)에서 생성할 수 있습니다.&#x20;

#### &#x20;Request 헤더의 `API-KEY` 에 할당된 `API KEY` 를 입력해야 합니다.

## Review Conversion API

<mark style="color:green;">`POST`</mark> `https://nlu-api.allganize.ai/api/inference`

#### Headers

| Name    | Type   | Description                                   |
| ------- | ------ | --------------------------------------------- |
| API-KEY | string | 할당된 API 키입니다. 대시보드의 설정 메뉴 > 일반 탭에서 찾을 수 있습니다. |

#### Request Body

| Name | Type   | Description                                                 |
| ---- | ------ | ----------------------------------------------------------- |
| text | string | 분석을 원하는 텍스트입니다. 최대 2000자까지 입력하실 수 있으며, 그 이후의 텍스트는 처되지 않습니다. |

{% tabs %}
{% tab title="200 Response 에는 카테고리별 고객 평가 정보가 포함되어 있습니다.

category: 고객 평가 카테고리입니다. 카테고리는 NLU API 대시보드에서 정의할 수 있습니다.
sentiment: 각 카테고리별 평가 정보입니다. NLU API 대시보드에서 정의할 수 있습니다." %}

```
{
  "inputText": STRING,
  "reviewSentiments": [
    {
      "category": STRING,
      "sentiment": STRING,
    }, ...
  ]
}
```

{% endtab %}
{% endtabs %}

### Request Example

YOUR API KEY 를 프로젝트의 API 키로 바꾸어야 합니다. [API 키 얻기](https://docs.allganize.ai/v/ko/review-conversion-api#api) 항목을 참고하세요.&#x20;

```
curl https://nlu-api.allganize.ai/api/inference \
-d '{"text": "프론트에서 정말 친절하게 대해주시네요! 방키가 갑자기 안돼서 프론트로 전화했더니 대처도 빠르게 해주겼고 마음에 들었습니다! 방도 정말 꺠끗해요!"}' \
-H "Content-Type: application/json" \
-H "API-KEY: YOUR_API_KEY"
```

### Response Example

```
{
  "inputText": "프론트에서 정말 친절하게 대해주시네요! 방키가 갑자기 안돼서 프론트로 전화했더니 대처도 빠르게 해주고 마음에 들었습니다! 방도 정말 꺠끗해요!"
  "reviewSentiments": [ 
    { "category": "시설", "sentiment": "1", "keywords": [{"text": “방도 정말 꺠끗해요!"”, "index": 69]},
    { "category": "서비스", "sentiment": "2", "keywords": [{"text": “프론트에서 정말 친절하게 대해주시네요!”, "index": 0}, {"text": “프론트로 전화했더니 대처도 빠르게 해주고 ”, "index": 34}]}
  ]
}
```

## 에러 메시지

예상했던 response 를 받지 못한 경우 에러 메시지를 확인해 주세요.&#x20;

<table data-header-hidden><thead><tr><th width="221">Status Code</th><th>Error Code</th><th>Name</th><th>Message</th><th>Description</th></tr></thead><tbody><tr><td>Status Code</td><td>Error Code</td><td>Name</td><td>Message</td><td>Description</td></tr><tr><td>500</td><td>7000</td><td>API Error</td><td>Something went wrong</td><td>API 처리 실패에 대한 기본 메시지로, 분류되지 않은 에러 발생시 수령</td></tr><tr><td>403</td><td>7001</td><td>Invalid API Key</td><td>API-KEY is not valid</td><td>헤더에 요청한 API Key가 유효하지 않은 경우 수</td></tr><tr><td>403</td><td>7002</td><td>Invalid JSON</td><td>Cannot decode tuen requested JSON body</td><td>요청한 JSON 파일이 잘못되어 Decode가 불가능한 경우 수령</td></tr><tr><td>400</td><td>7003</td><td>Invalid Parameter</td><td>Requested parameters are not valid. 'text' is empty.</td><td>요청된 파라미터가 잘못된 경우(e.g., 빈 텍스트로 인퍼런스를 요청 등) 수령</td></tr><tr><td>403</td><td>7004</td><td>Payment error</td><td>billing error.</td><td>지불 관련 일반 오류 (e.g., 지불 기한이 넘어간 경우 등)가 발생한 경우 수령</td></tr><tr><td>405</td><td>-</td><td>Wrong HTTP Method</td><td>-</td><td>잘못된 HTTP 메소드를 사용한 경우 수령</td></tr></tbody></table>

### Error Response example

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.allganize.ai/api-reference/korean/review-conversion-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
