> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cnap.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Get cluster kubeconfig

> Returns the admin kubeconfig for a KaaS-managed cluster. The cluster must be in RUNNING status.

Supports content negotiation via the `Accept` header:
- `application/json` — returns JSON (default for API clients)
- `application/yaml` — returns YAML (default for kubectl/CLI)



## OpenAPI

````yaml /openapi.json get /v1/clusters/{id}/kubeconfig
openapi: 3.1.0
info:
  title: CNAP API
  version: 1.0.0
  description: >-
    Public API for managing CNAP workspaces, clusters, templates, products, and
    deployments.


    Authenticate with a Personal Access Token via the `Authorization: Bearer
    cnap_pat_...` header.


    Workspace-scoped endpoints require the `X-Workspace-Id` header.
servers:
  - url: https://api.cnap.tech
    description: Production
security: []
paths:
  /v1/clusters/{id}/kubeconfig:
    get:
      tags:
        - Clusters
      summary: Get cluster kubeconfig
      description: >-
        Returns the admin kubeconfig for a KaaS-managed cluster. The cluster
        must be in RUNNING status.


        Supports content negotiation via the `Accept` header:

        - `application/json` — returns JSON (default for API clients)

        - `application/yaml` — returns YAML (default for kubectl/CLI)
      parameters:
        - schema:
            type: string
            description: Cluster ID
          required: true
          description: Cluster ID
          name: id
          in: path
      responses:
        '200':
          description: Admin kubeconfig
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
                description: Kubeconfig as JSON
            application/yaml:
              schema:
                type: string
        '400':
          description: Cluster is not in RUNNING status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Not a member of the cluster workspace
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Cluster not found or not KaaS-managed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - BearerAuth: []
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: not_found
            message:
              type: string
              example: Resource not found
            param:
              type: string
              description: The request field that caused the error
              example: name
            suggestion:
              type: string
              example: Run `cnap clusters list` to see available clusters
            details: {}
          required:
            - code
            - message
      required:
        - error
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Personal Access Token (cnap_pat_...) or OAuth2 JWT. Create tokens at
        https://cnap.tech/account/tokens

````