Get Keyphrases from a Lexicon Entry - Cognigy Documentation
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Get Keyphrases from a Lexicon Entry
Endpoint: GET /v2.0/lexicons/{lexiconId}/entries/{entryId}/keyphrases
Example Requests
cURL
curl --request GET \
--url https://api-trial.cognigy.ai/new/v2.0/lexicons/{lexiconId}/entries/{entryId}/keyphrases \
--header 'X-API-Key: <api-key>'
Python
import requests
url = "https://api-trial.cognigy.ai/new/v2.0/lexicons/{lexiconId}/entries/{entryId}/keyphrases"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)
JavaScript
const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api-trial.cognigy.ai/new/v2.0/lexicons/{lexiconId}/entries/{entryId}/keyphrases', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-trial.cognigy.ai/new/v2.0/lexicons/{lexiconId}/entries/{entryId}/keyphrases",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Response Format
Success (200)
Returns array of Keyphrases of a Lexicon Entry:
[
{
"_id": "<string>",
"mainKeyphrase": "pizza",
"data": {},
"keyphrases": {
"_id": "<string>",
"value": "pizza",
"isMainKeyphrase": true
},
"slotReferences": [
"<string>"
]
}
]
Error Responses
- 400: Bad Request - Validation failed. Missing payload.
- 401: Unauthorized - Invalid API Key.
- 402: Payment Required - Validation failed. Missing payload.
- 403: Forbidden - Authorization failed.
- 404: Not Found - Resource not found.
- 500: Internal Server Error - An unknown error occurred.
Authorizations
API Key
- Header:
X-API-Key(required) - Supply the API Key in the HTTP header.
Headers
Accept
- The
Acceptheader specifies the media type that the client expects in the response. Possible values:application/jsonapplication/hal+jsonapplication/xmltext/xmltext/csv
Path Parameters
- lexiconId: (string) Required. The unique identifier for the Lexicon. String length:
24, pattern:^[a-z0-9]{24}$. - entryId: (string) Required. The unique identifier for the entry in the Lexicon. String length:
24, pattern:^[a-z0-9]{24}$.
Query Parameters
- projectId (string) Optional. The unique identifier for the Project.
- filter (string) Optional. The value field to filter the lexicon keyphrases.
- limit (integer) Optional. Maximum number of items to return. Default value is
25, maximum value is100. - skip (integer) Optional. Number of items to skip.
- sort (string) Optional. Field to sort results by; ex:
name:asc. - next (string) Optional. Cursor for pagination.
- previous (string) Optional. Cursor for pagination.