# DELETE /v1/account/apikey

> Delete an API key of your ReportingCloud account with the key query parameter: 200 OK on success, 404 for a key the account doesn't have, 403 if not authorized.

- **Product:** ReportingCloud
- **Section:** Documentation
- **Kind:** Endpoint
- **Path:** ReportingCloud > API Reference > Web API > Account > /apikey > DELETE /v1/account/apikey
- **1917 words**
- **Web URL:** https://docs.textcontrol.com/reporting-cloud/reference/web-api/account/apikey/delete/
- **LLMs URL:** https://docs.textcontrol.com/reporting-cloud/reference/web-api/account/apikey/delete/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/reporting-cloud/reference/web-api/account/apikey/delete/llms-full.txt

---

`DELETE` `https://api.reporting.cloud/v1/account/apikey`

### Description

Deletes an API key of the account. Any key of the account can delete another one, and a request can delete the key it is signed with. Once deleted, the key is refused at once with 403 (Forbidden). See [API Keys](https://docs.textcontrol.com/reporting-cloud/installation/api-keys/llms-full.txt).

### Examples

#### HTTP

Request:

```bash
curl -u username:password -X DELETE \
  "https://api.reporting.cloud/v1/account/apikey?key=NP9trbSJIByk109sLWa2euvXT977rU4W1G5BjvtCXA"
```

#### C#

Request:

```csharp
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using TXTextControl.ReportingCloud;

class RCSamples
{
    public static void DeleteAPIKey(string key)
    {
        ReportingCloud rc = new ReportingCloud(
            "username",
            "password",
            new Uri("https://api.reporting.cloud"));

        try
        {
            if (rc.DeleteAccountAPIKey(key))
            {
                Console.WriteLine("Deleted API key " + key + ".");
            }
        }
        catch (Exception e)
        {
            Console.WriteLine("An error occurred: " + e.Message);
        }
    }
}
```

Results:

```text
Deleted API key NP9trbSJIByk109sLWa2euvXT977rU4W1G5BjvtCXA.
```

#### Java

Request:

```java
import com.textcontrol.reportingcloud.ReportingCloud;

import java.io.IOException;

public class ReportingCloudSample {
    public static void main(String[] args) throws IOException {
        String key = "NP9trbSJIByk109sLWa2euvXT977rU4W1G5BjvtCXA";

        ReportingCloud r = new ReportingCloud("username", "password");
        r.deleteAPIKey(key);

        System.out.println("Deleted API key " + key + ".");
    }
}
```

Results:

```text
Deleted API key NP9trbSJIByk109sLWa2euvXT977rU4W1G5BjvtCXA.
```

#### Ruby

Request:

```ruby
#!/usr/bin/env ruby

require "txtextcontrol/reportingcloud"

reporting_cloud = TXTextControl::ReportingCloud::ReportingCloud.new("username", "password")

key = "NP9trbSJIByk109sLWa2euvXT977rU4W1G5BjvtCXA"
reporting_cloud.delete_api_key(key)

puts "Deleted API key #{key}."
```

Results:

```text
Deleted API key NP9trbSJIByk109sLWa2euvXT977rU4W1G5BjvtCXA.
```

#### PHP

Request:

```php
<?php

require_once __DIR__ . '/vendor/autoload.php';

use TextControl\ReportingCloud\ReportingCloud;

$reportingCloud = new ReportingCloud([
    'api_key' => (string) getenv('REPORTINGCLOUD_API_KEY'),
]);

var_dump($reportingCloud->deleteApiKey('NP9trbSJIByk109sLWa2euvXT977rU4W1G5BjvtCXA'));
```

Results:

```text
bool(true)
```

### Authorization

This endpoint requires a "ReportingCloud-APIKey" or a "Basic" user authorization to access the user account, data and templates. Only one of these two methods is required.

[API Keys](https://docs.textcontrol.com/reporting-cloud/installation/api-keys/llms-full.txt) describes how to create an API key, and [Authentication](https://docs.textcontrol.com/reporting-cloud/document-processing/authentication/llms-full.txt) explains both header forms.

#### ReportingCloud-APIKey

| Header field | Description |
|---|---|
| Authorization | **Required**. A valid ReportingCloud account is required. The Authorization field is constructed as follows: An API key needs to be generated in the portal or with [PUT /v1/account/apikey](https://docs.textcontrol.com/reporting-cloud/reference/web-api/account/apikey/put/llms-full.txt). The authorization method and a space, "ReportingCloud-APIKey ", is then put before the actual API key string. For example: `Authorization: ReportingCloud-APIKey oMDM4MrAqL9QEOpyzupnQW5NjvCNtvE5cVDaaLqxI` |

#### Basic

| Header field | Description |
|---|---|
| Authorization | **Required**. A valid ReportingCloud account is required. The Authorization field is constructed as follows: The user name and password are combined into a string separated by a colon, for example `username:password`. The resulting string is encoded using the RFC2045-MIME variant of Base64, except not limited to 76 char/line. The authorization method and a space, "Basic ", is then put before the encoded string. For example: `Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l` |

### Request Parameters

| Name | Type | Value | Optional |
|---|---|---|---|
| key | String | The API key to be deleted. It is matched regardless of case. | no |

### Success Response

| Status | Description |
|---|---|
| 200 | On success, the HTTP status code in the response header is 200 (OK). The response has no body. |

### Error Response

| Status | Description |
|---|---|
| 403 | A 403 (Forbidden) is returned, if the user is not authorized. |
| 404 | A 404 (Not Found) is returned, if the account has no API key that matches the key parameter, or the parameter is empty. |
| 405 | A 405 (Method Not Allowed) is returned, if the key parameter is missing or the request uses another HTTP method than DELETE. The Allow header of the response names DELETE, or PUT when the key parameter is missing. |
| 500 | A 500 (Internal Server Error) is returned, if the request has no Authorization header, an empty one or one that is not the authorization method, a space and the credentials. |

---

## Nearby

- **Previous:** [/v1/account/apikey](https://docs.textcontrol.com/reporting-cloud/reference/web-api/account/apikey/llms-full.txt)
- **Next:** [PUT /v1/account/apikey](https://docs.textcontrol.com/reporting-cloud/reference/web-api/account/apikey/put/llms-full.txt)
