## DELETE API Endpoint

### Delete an API Key

To delete an API key for the current user, you can use the following endpoint:

```
DELETE /v2.0/users/me/apikeys/{apiKeyId}
```

### Example cURL Request

```bash
curl --request DELETE \
  --url https://api-trial.cognigy.ai/new/v2.0/users/me/apikeys/{apiKeyId} \
  --header 'X-API-Key: <api-key>'
```

### Example Using Python (requests Library)

```python
import requests

url = "https://api-trial.cognigy.ai/new/v2.0/users/me/apikeys/{apiKeyId}"

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

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

print(response.text)
```

### Example Using JavaScript (fetch API)

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

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

### Example Using PHP (cURL)

```php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api-trial.cognigy.ai/new/v2.0/users/me/apikeys/{apiKeyId}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  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;
}
```

### Example Using Go

```go
package main

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

func main() {
	url := "https://api-trial.cognigy.ai/new/v2.0/users/me/apikeys/{apiKeyId}"

req, _ := http.NewRequest("DELETE", 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 Codes
| Status Code | Type                     | Detail                                        |
|-------------|--------------------------|----------------------------------------------|
| 400         | Bad Request              | Validation failed. Missing payload.          |
| 401         | Unauthorized             | <string>                                     |
| 402         | Payment Required         | Validation failed. Missing payload.          |
| 403         | Forbidden                | <string>                                     |
| 404         | Not Found                | <string>                                     |
| 405         | Method Not Allowed       | <string>                                     |
| 409         | Conflict                 | <string>                                     |
| 413         | Payload Too Large        | <string>                                     |
| 500         | Internal Server Error    | <string>                                     |
| 501         | Not Implemented          | <string>                                     |
| 502         | Bad Gateway              | <string>                                     |
| 503         | Service Unavailable      | <string>                                     |
| 504         | Gateway Timeout          | <string>                                     |

### Response
Status 204: The API key was removed successfully.

### Authorizations
* API Key: Required in HTTP header as `X-API-Key`.

### Headers
* `Accept`: Specifies the media type expected in the response.
  * Options: `application/json`, `application/hal+json`, `application/xml`, `text/xml`, `text/csv`. Default is `application/json`.

### Path Parameters
* `apiKeyId`: Required, the Id of an API key. Length: 24 characters, pattern: `^[a-z0-9]{24}$`.
