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

`GET /organization/{idOrg}/key`

*List Organization Keys*

Retrieve all organization keys with their associated node information for the specified organization.

This endpoint returns a list of all RSA public keys generated for the organization, along with metadata about which nodes are associated with each key. This is useful for monitoring key usage and managing node associations.

**Key Features:**

* Lists all organization keys with creation timestamps
* Shows associated node information for each key
* Ordered by creation date (newest first)
* Includes key IDs and organization associations

**Access Control:**

* Requires ADMINISTRATOR or OWNER role within the organization
* Users can only view keys for their own organization
* No sensitive private key information is returned

**Security:**

* Only public keys are returned in the response
* Private keys are never exposed through this endpoint
* All operations are logged for security auditing

#### TypeScript Client Library

```typescript
public getOrgKeys = async (idOrg: string): Promise<GetOrganizationKeysResponse> => {
  return this.makeRequest<GetOrganizationKeysResponse>(`organization/${idOrg}/key`, 'GET');
};
```

#### Code Samples

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

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

{% endtab %}

{% tab title="HTTP" %}

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

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

{% endtab %}
{% endtabs %}

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

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

> Example responses

> 200 Response

```json
{
  "success": true,
  "data": [
    {
      "id": "key-123e4567-e89b-12d3-a456-426614174000",
      "orgId": "org-123e4567-e89b-12d3-a456-426614174000",
      "publicKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7VJTUt9Us8cKBwT1L6O5VfwlrP0xP2B5iZvr5Xq5BwL1K2Y3...\n-----END PUBLIC KEY-----",
      "createdAt": "2024-01-15T10:30:00.000Z",
      "nodeKeys": [
        {
          "keyId": "key-123e4567-e89b-12d3-a456-426614174000",
          "nodeId": "192.168.1.100"
        },
        {
          "keyId": "key-123e4567-e89b-12d3-a456-426614174000",
          "nodeId": "192.168.1.101"
        }
      ]
    },
    {
      "id": "key-987fcdeb-51a2-43d7-8f9e-123456789abc",
      "orgId": "org-123e4567-e89b-12d3-a456-426614174000",
      "publicKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA9XKSUv0Vt9dLcxwT2M7P6Wgxmr1yQ3C6iZws6Yq6CxM2L3Z4...\n-----END PUBLIC KEY-----",
      "createdAt": "2024-01-14T15:45:00.000Z",
      "nodeKeys": []
    }
  ]
}
```

> 403 Response

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

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

| Status | Meaning                                                                    | Description                               | Schema |
| ------ | -------------------------------------------------------------------------- | ----------------------------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)                    | List of organization keys                 | 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 retrieve keys                   | Inline |

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

Status Code **200**

| Name         | Type              | Required | Restrictions | Description                          |
| ------------ | ----------------- | -------- | ------------ | ------------------------------------ |
| » success    | boolean           | false    | none         | Operation success status             |
| » data       | \[object]         | false    | none         | Array of organization keys           |
| »» id        | string            | false    | none         | Unique identifier for the key        |
| »» orgId     | string            | false    | none         | Organization ID that owns the key    |
| »» publicKey | string            | false    | none         | RSA public key in PEM format         |
| »» createdAt | string(date-time) | false    | none         | Key creation timestamp               |
| »» nodeKeys  | \[object]         | false    | none         | Array of associated node information |
| »»» keyId    | string            | false    | none         | Key ID reference                     |
| »»» nodeId   | string            | false    | none         | Node IP address or identifier        |

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
