# 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="/pages/3GwQSmtvI9uhos4p1Z0r">/pages/3GwQSmtvI9uhos4p1Z0r</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 %}


---

# 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.ionos.com/cloud/containers/managed-kubernetes/api-how-tos.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.
