## 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.

GET

/v2.0/aiagents/{aiAgentId}

### Try it

Get an AI Agent

#### cURL

```bash
curl --request GET \
  --url https://api-trial.cognigy.ai/new/v2.0/aiagents/{aiAgentId} \
  --header 'X-API-Key: <api-key>'
```

#### Python

```python
import requests

url = "https://api-trial.cognigy.ai/new/v2.0/aiagents/{aiAgentId}"

headers = {"X-API-Key": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
```

#### JavaScript (Fetch API)

```javascript
const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};

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

#### PHP

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api-trial.cognigy.ai/new/v2.0/aiagents/{aiAgentId}",
  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;
}
?>
```

#### Go

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

url := "https://api-trial.cognigy.ai/new/v2.0/aiagents/{aiAgentId}"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("X-API-Key", "<api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}
```

#### Error Responses

- **200**: Success response for a valid request
- **400**: Bad Request
- **401**: Unauthorized
- **402**: Payment Required
- **403**: Forbidden
- **404**: Not Found
- **500**: Internal Server Error

### Response Object

```json
{
  "name": "Cognigy AI Agent",
  "image": "https://cognigy.com/ai-agent.png",
  "imageOptimizedFormat": true,
  "knowledgeReferenceId": "c7b3b3b3-3b3b-3b3b-3b3b-3b3b3b3b3b3b",
  "description": "I am a virtual assistant that can help you with your questions.",
  "speakingStyle": {
    "completeness": "concise",
    "formality": "formal"
  },
  "voiceConfigs": {
    "ttsVoice": "Xb7hH8MSUJpSbSDYk0k2",
    "ttsLanguage": "zh",
    "ttsVendor": "Elevenlabs",
    "ttsModel": "eleven_multilingual_v2",
    "ttsLabel": "microsoft US",
    "ttsDisableCache": false
  },
  "enableVoiceConfigs": false,
  "enableAutoLanguageDetection": true,
  "safetySettings": {
    "avoidHarmfulContent": true,
    "avoidUngroundedContent": true,
    "avoidCopyrightInfringements": true,
    "preventJailbreakAndManipulation": true
  },
  "contactProfilesOption": "selectedProfileFields",
  "contactProfilesSelected": ["name", "email"],
  "instructions": "I can help you with your questions, provide information and much more.",
  "_id": "<string>",
  "createdAt": 1694518620,
  "lastChanged": 1694518620,
  "createdBy": "<string>",
  "lastChangedBy": "<string>"
}
```
