> For the complete documentation index, see [llms.txt](https://docs.enclaive.cloud/enclaive-multi-cloud-platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.enclaive.cloud/enclaive-multi-cloud-platform/developers/api/client-api/vhsm/byos.md).

# BYOS

The "BYOS" (Bring Your Own Key) section is dedicated to the storage of customer keys for cloud providers. Customers can securely store their keys within this section, which they can later use when creating resources within the cloud provider's ecosystem. This ensures that customers have control and ownership of their encryption keys, enhancing data security and compliance.

## Create BYOS

<mark style="color:green;">`POST`</mark> `{{BASE_URL}}/api/teams/{id}/subscriptions/{cloudProviderId}`

Create personal subscriptions that will be used to create resources.

#### Path Parameters

| Name                                              | Type   | Description       |
| ------------------------------------------------- | ------ | ----------------- |
| <mark style="color:red;">\*</mark>                | String | team id           |
| cloudProviderId<mark style="color:red;">\*</mark> | String | Cloud provider id |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer Token |

#### Request Body

| Name                                   | Type   | Description |
| -------------------------------------- | ------ | ----------- |
| data<mark style="color:red;">\*</mark> | Object |             |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "_id": "654a15394213381ddd0f2e58",
    "team": "6548a41f38406c14db33b61e",
    "cloudProvider": "6548a383e2442d14b6bf9681",
    "history": [
        {
            "status": true,
            "_id": "654a15394213381ddd0f2e59",
            "user": "6548a41138406c14db33b606",
            "createdAt": "2023-11-07T10:45:13.690Z"
        }
    ],
    "createdAt": "2023-11-07T10:45:13.696Z",
    "updatedAt": "2023-11-07T10:45:13.696Z"
}
```

{% endtab %}
{% endtabs %}

<details>

<summary>Request payload</summary>

```json
{
    "_id": "654a15394213381ddd0f2e58",
    "team": "6548a41f38406c14db33b61e",
    "cloudProvider": "6548a383e2442d14b6bf9681",
    "history": [
        {
            "status": true,
            "_id": "654a15394213381ddd0f2e59",
            "user": "6548a41138406c14db33b606",
            "createdAt": "2023-11-07T10:45:13.690Z"
        }
    ],
    "createdAt": "2023-11-07T10:45:13.696Z",
    "updatedAt": "2023-11-07T10:45:13.696Z"
}
```

</details>

***

## Get BYOS

<mark style="color:blue;">`GET`</mark> `{{BASE_URL}}/api/teams/{id}/subscriptions`

Get all subscriptions for a specific team.

#### Path Parameters

| Name                               | Type   | Description |
| ---------------------------------- | ------ | ----------- |
| <mark style="color:red;">\*</mark> | String | team id     |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer Token |

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "_id": "6548e75ceb0d1f0516677cf9",
        "team": "6548a41f38406c14db33b61e",
        "cloudProvider": "6548a383e2442d14b6bf9682",
        "history": [
            {
                "status": true,
                "_id": "6548e75ceb0d1f0516677cfa",
                "user": "6548a41138406c14db33b606",
                "createdAt": "2023-11-06T13:17:16.605Z"
            }
        ],
        "createdAt": "2023-11-06T13:17:16.611Z",
        "updatedAt": "2023-11-06T13:17:16.611Z"
    }
]
```

{% endtab %}
{% endtabs %}

## Delete BYOS

<mark style="color:red;">`DELETE`</mark> `{{BASE_URL}}/api/teams/{id}/subscriptions/{cloudProviderId}`

Delete subscription for specific cloud provider.

#### Path Parameters

| Name            | Type   | Description       |
| --------------- | ------ | ----------------- |
|                 | String | team id           |
| cloudProviderId | String | cloud provider id |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer Token |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "_id": "654a15394213381ddd0f2e58",
    "team": "6548a41f38406c14db33b61e",
    "cloudProvider": "6548a383e2442d14b6bf9681",
}
```

{% endtab %}
{% endtabs %}
