Create a Sentence - Cognigy Documentation

Documentation Index

Fetch the complete documentation index at: /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

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

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)

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

{
  "type": "Bad Request",
  "title": "Bad Request Error",
  "status": 400,
  "detail": "Validation failed. Missing payload."
}
{
  "type": "Unauthorized",
  "title": "Unauthorized Error",
  "status": 401,
  "detail": "<string>"
}
{
  "type": "Not Found",
  "title": "Not Found Error",
  "status": 404,
  "detail": "<string>"
}

Headers

Path Parameters

Body