# API How-Tos

All Kubernetes API instructions can be found in the main Cloud API specification file.

| [<mark style="color:blue;">**Cloud API - Open API Specification file**</mark>](https://api.ionos.com/docs/cloud/v6/) |
| -------------------------------------------------------------------------------------------------------------------- |

To access the Kubernetes API, which the cluster provides, you can download the `kubeconfig` file and use it with tools such as `kubectl`.

| [<mark style="color:blue;">**Get Kubernetes Configuration Files**</mark>](https://api.ionos.com/docs/cloud/v6/#tag/Kubernetes/operation/k8sKubeconfigGet) |
| --------------------------------------------------------------------------------------------------------------------------------------------------------- |

## Quick Links

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><mark style="color:blue;"><strong>Set User Privileges</strong></mark></td><td>Learn how to set user privileges to create and manage Kubernetes cluster and node pools via the API.</td><td><a href="api-how-tos/set-user-privileges">set-user-privileges</a></td></tr></tbody></table>

## Retrieve Kubernetes configuration files

<mark style="color:blue;">`GET`</mark> `https://api.ionos.com/cloudapi/v6/k8s/{k8sClusterId}/kubeconfig`

Retrieve a configuration file for the specified Kubernetes cluster, in YAML or JSON format as defined in the Accept header; the default Accept header is application/yaml.

#### Path Parameters

| Name                                           | Type   | Description                              |
| ---------------------------------------------- | ------ | ---------------------------------------- |
| k8sClusterId<mark style="color:red;">\*</mark> | String | The unique ID of the Kubernetes cluster. |

#### Query Parameters

| Name  | Type   | Description                                        |
| ----- | ------ | -------------------------------------------------- |
| depth | String | Controls the detail depth of the response objects. |

#### Headers

| Name              | Type    | Description                                                                                                    |
| ----------------- | ------- | -------------------------------------------------------------------------------------------------------------- |
| X-Contract-Number | Integer | Users with multiple contracts must provide the contract number, for which all API requests are to be executed. |

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

```javascript
{}
```

{% endtab %}

{% tab title="400: Bad Request Any erroneous status code: 400 (parse error), 401 (auth error), 402 (trial access), 403 (insufficient privileges), 404 (not found), 405 (unsupported HTTP method), 415 (unsupported content type, 422 (validation error)), 429 (request rate limit exceeded), 500 (server error), or 503 (maintenance)." %}

```javascript
{
    "httpStatus": 400,
    "messages": {
        "errorCode": "123",
        "message": "Error message example."
    }
}
```

{% endtab %}
{% endtabs %}
