# NLP Query

This endpoint will retrieve the best matching intent for the supplied query text. The matching will be done against the published version of the NLP intents: your bot must be online on at least one channel in order to successfully run this request.

### Request

Use the following request to execute the intents match:

```bash
curl --location --request GET 'https://publicapi.xenioo.com/nlp/detect' \
--header 'Authorization: Bearer <ACCOUNT_AUTH_TOKEN>' \
--header 'Content-Type: application/json'
--data-raw '{
	"Query":"<USER EXPRESSION>"
}'
```

### Response

If successful, the response will contained the detailed results of the NLP matching with the best matching intent and the full list of tokenized words and entities detected. The example below is an extract of a successful result.

```json
{
    "ParseTime": 0.0002919,
    "Best": {
        "Name": "Ordinare la pizza",
        "Key": "",
        "Confidence": 96.0,
        "BetGuess": "vorrei due belle margherite",
        "LocaleName": "Italiano",
        "Locale": "it"
    },
    "Words": [
        {
            "Original": "Vorrei",
            "Value": "volere",
            "Type": 0,
            "Position": 0
        },
        {
            "Original": "due",
            "Value": "due",
            "Type": 3,
            "Position": 1,
            "Entity": {
                "Name": "number",
                "Value": "2",
                "Confidence": 100.0
            }
        },
        {
            "Original": "belle",
            "Value": "belle",
            "Type": 0,
            "Position": 2
        },
        {
            "Original": "margherite",
            "Value": "margherite",
            "Type": 3,
            "Position": 3,
            "Entity": {
                "Name": "tipo_pizza",
                "Value": "margherita",
                "Confidence": 100.0
            }
        },
        {
            "Original": "dddd",
            "Value": "dddd",
            "Type": 0,
            "Position": 4
        }
    ]
}
```

### Response Codes

This endpoint will reply with the following standard HTTP codes.

| Code | Meaning                                                                         |
| ---- | ------------------------------------------------------------------------------- |
| 200  | Ok. The request has been successfully fulfilled.                                |
| 400  | Bad Request. The supplied token is invalid or does not have enough permissions. |
| 404  | Not Found. The account specified by the token could not be found.               |


---

# 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.mylinkconnect.com/connect-api/globa-platform-api/nlp-query.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.
