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

`DELETE /organization/{idOrg}/key`

*Delete Organization Keys*

Permanently delete all organization keys for the specified organization. This operation is irreversible and will remove all keys and their associated node relationships.

**Important Notes:**

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

**Access Control:**

* Requires ADMINISTRATOR or OWNER role within the organization
* Users can only delete keys for their own organization
* No authentication required for node operations (uses cryptographic signatures)

**Security:**

* All key deletions are 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 deleteOrgKeys = async (idOrg: string): Promise<{ success: boolean; message: string }> => {
  return this.makeRequest<{ success: boolean; message: string }>(`organization/${idOrg}/key`, 'DELETE');
};
```

#### Code Samples

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

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

{% endtab %}

{% tab title="HTTP" %}

```http
DELETE https://backend.flashback.tech/organization/{idOrg}/key 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',
{
  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',
  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', 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', 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");
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", data)
    req.Header = headers

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

{% endtab %}
{% endtabs %}

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

| Name  | In   | Type   | Required | Description                                  |
| ----- | ---- | ------ | -------- | -------------------------------------------- |
| idOrg | path | string | true     | Organization ID for which to delete all keys |

> Example responses

> 200 Response

```json
{
  "success": true,
  "message": "Successfully deleted 3 organization key(s)"
}
```

> 403 Response

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

> 500 Response

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

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

| Status | Meaning                                                                    | Description                               | Schema |
| ------ | -------------------------------------------------------------------------- | ----------------------------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)                    | Keys deleted successfully                 | Inline |
| 403    | [Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)             | Insufficient permissions or access denied | Inline |
| 500    | [Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1) | Failed to delete keys                     | Inline |

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

Status Code **200**

| Name      | Type    | Required | Restrictions | Description                                |
| --------- | ------- | -------- | ------------ | ------------------------------------------ |
| » success | boolean | false    | none         | Operation success status                   |
| » message | string  | false    | none         | Success message with count of deleted keys |

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 **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
