# delete\_\_organization\_{orgId}\_key\_{keyId}

`DELETE /organization/{idOrg}/key/{idKey}`

*Delete Specific Organization Key*

Delete a specific organization key by its ID. This operation is irreversible and will remove the key and its associated node relationships.

**Important Notes:**

* This operation deletes a specific key by its ID, not all keys for the organization
* All associated node-key relationships are also removed (cascade delete)
* This operation is irreversible - the key cannot be recovered
* System events are logged for audit purposes
* Any nodes using this specific key will need to re-register with a different key

**Access Control:**

* Requires ADMINISTRATOR or OWNER role within the organization
* Users can only delete keys for their own organization
* Key must exist and belong to the specified organization

**Security:**

* Key deletion is logged with detailed audit information
* System events are published for monitoring and alerting
* Private keys are permanently removed from the system

#### TypeScript Client Library

```typescript
public deleteOrgKey = async (idOrg: string, keyId: string): Promise<{ success: boolean; message: string }> => {
  return this.makeRequest<{ success: boolean; message: string }>(`organization/${idOrg}/key/${keyId}`, 'DELETE');
};
```

#### Code Samples

{% tabs %}
{% tab title="Shell" %}

```shell
# You can also use wget
curl -X DELETE https://backend.flashback.tech/organization/{idOrg}/key/{idKey} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'
```

{% endtab %}

{% tab title="HTTP" %}

```http
DELETE https://backend.flashback.tech/organization/{idOrg}/key/{idKey} HTTP/1.1
Host: localhost:3000
Accept: application/json
Authorization: Bearer {access-token}
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('https://backend.flashback.tech/organization/{idOrg}/key/{idKey}',
{
  method: 'DELETE',
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.delete 'https://backend.flashback.tech/organization/{idOrg}/key/{idKey}',
  params: {
  }, headers: headers

p JSON.parse(result)
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.delete('https://backend.flashback.tech/organization/{idOrg}/key/{idKey}', headers = headers)

print(r.json())
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE','https://backend.flashback.tech/organization/{idOrg}/key/{idKey}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...
```

{% endtab %}

{% tab title="Java" %}

```java
URL obj = new URL("https://backend.flashback.tech/organization/{idOrg}/key/{idKey}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{})
    req, err := http.NewRequest("DELETE", "https://backend.flashback.tech/organization/{idOrg}/key/{idKey}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}
```

{% endtab %}
{% endtabs %}

#### Parameters <a href="#delete__organization_-orgid-_key_-keyid-parameters" id="delete__organization_-orgid-_key_-keyid-parameters"></a>

| Name  | In   | Type   | Required | Description                                     |
| ----- | ---- | ------ | -------- | ----------------------------------------------- |
| idOrg | path | string | true     | Organization ID that owns the key               |
| idKey | path | string | true     | Unique identifier of the specific key to delete |

> Example responses

> 200 Response

```json
{
  "success": true,
  "message": "Organization key deleted successfully"
}
```

> 403 Response

```json
{
  "success": false,
  "message": "Access denied: you can only manage keys for your own organization"
}
```

> 404 Response

```json
{
  "success": false,
  "message": "Organization key not found or does not belong to this organization"
}
```

> 500 Response

```json
{
  "success": false,
  "message": "Internal server error"
}
```

#### Responses <a href="#delete__organization_-orgid-_key_-keyid-responses" id="delete__organization_-orgid-_key_-keyid-responses"></a>

| Status | Meaning                                                                    | Description                                     | Schema |
| ------ | -------------------------------------------------------------------------- | ----------------------------------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)                    | Key deleted successfully                        | Inline |
| 403    | [Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)             | Insufficient permissions or access denied       | Inline |
| 404    | [Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)             | Key not found or doesn't belong to organization | Inline |
| 500    | [Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1) | Failed to delete key                            | Inline |

#### Response Schema <a href="#delete__organization_-orgid-_key_-keyid-responseschema" id="delete__organization_-orgid-_key_-keyid-responseschema"></a>

Status Code **200**

| Name      | Type    | Required | Restrictions | Description              |
| --------- | ------- | -------- | ------------ | ------------------------ |
| » success | boolean | false    | none         | Operation success status |
| » message | string  | false    | none         | Success message          |

Status Code **403**

| Name      | Type    | Required | Restrictions | Description                                   |
| --------- | ------- | -------- | ------------ | --------------------------------------------- |
| » success | boolean | false    | none         | Operation success status                      |
| » message | string  | false    | none         | Error message describing the permission issue |

Status Code **404**

| Name      | Type    | Required | Restrictions | Description                            |
| --------- | ------- | -------- | ------------ | -------------------------------------- |
| » success | boolean | false    | none         | Operation success status               |
| » message | string  | false    | none         | Error message indicating key not found |

Status Code **500**

| Name      | Type    | Required | Restrictions | Description                                 |
| --------- | ------- | -------- | ------------ | ------------------------------------------- |
| » success | boolean | false    | none         | Operation success status                    |
| » message | string  | false    | none         | Error message describing the internal error |

To perform this operation, you must be authenticated by means of one of the following methods: BearerAuth


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flashback.tech/support-reference/platform-api-reference/storage-apis/node-registration/delete__organization_-orgid-_key_-keyid.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
