## Documentation Index

Fetch the complete documentation index at: [/llms.txt](https://docs.cognigy.com/llms.txt)

Use this file to discover all available pages before exploring further.

---

### Create a Sentence

**API Endpoint:**  
`POST /v2.0/locales/{localeId}/yesnointents/{intentId}/sentences`

#### Example cURL Command

```bash
curl --request POST \
  --url https://api-trial.cognigy.ai/new/v2.0/locales/{localeId}/yesnointents/{intentId}/sentences \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "text": "`roger that`"
}
'"""
```

#### Example Python Code

```python
import requests

url = "https://api-trial.cognigy.ai/new/v2.0/locales/{localeId}/yesnointents/{intentId}/sentences"

payload = { "text": "`roger that`" }
headers = {
    "X-API-Key": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

#### Example JavaScript Code (Fetch API)

```javascript
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({text: '`roger that`'})
};

fetch('https://api-trial.cognigy.ai/new/v2.0/locales/{localeId}/yesnointents/{intentId}/sentences', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### API Responses

#### Success Response (201)
```
{
  "localeReference": "<string>",
  "feedbackReport": {
    "findings": [{}],
    "info": {
      "trueIntent": "<string>",
      "topIntent": "<string>",
      "runnerUp": "<string>",
      "topScore": 123,
      "runnerUpScore": 123,
      "difference": 123,
      "trueIntentName": "<string>",
      "topIntentName": "<string>",
      "runnerUpIntentName": "<string>"
    }
  },
  "text": "`roger that`",
  "_id": "<string>",
  "createdAt": 1694518620,
  "lastChanged": 1694518620,
  "createdBy": "<string>",
  "lastChangedBy": "<string>"
}
```

#### Error Responses
- **400 Bad Request**
```
{
  "type": "Bad Request",
  "title": "Bad Request Error",
  "status": 400,
  "detail": "Validation failed. Missing payload."
}
```

- **401 Unauthorized**
```
{
  "type": "Unauthorized",
  "title": "Unauthorized Error",
  "status": 401,
  "detail": "<string>"
}
```

- **404 Not Found**
```
{
  "type": "Not Found",
  "title": "Not Found Error",
  "status": 404,
  "detail": "<string>"
}
```

### Headers

- **X-API-Key**: string (header, required)
  - Supply the API Key in the HTTP header.
- **Accept**: enum<string>
  - The `Accept` header specifies the media type that the client expects in the response. Available options: `application/json`, `application/hal+json`, `application/xml`, `text/xml`, `text/csv`. The default value is `application/json`.

### Path Parameters

- **localeId**: string (required)
  - The unique identifier for the Locale. Required string length: `24`. Pattern: `^[a-z0-9]{24}$`.
- **intentId**: string (required)
  - The unique identifier for the Intent. Required string length: `24`. Pattern: `^[a-z0-9]{24}$`.

### Body

- **text**: string (required)
  - The text of the Yes/No Intent Sentence. Example: `"roger that"`.

---
