Rancher Management API

The Rancher Management API exposes Rancher's multi-cluster Kubernetes management capabilities as Kubernetes-style REST resources. It supports automation of cluster lifecycle, project and namespace management, user and access control, catalog and app management, and integration of Rancher into CI/CD and platform engineering workflows. Authentication is via bearer tokens generated from the Rancher UI or via the login endpoint, and the API is reached through the Rancher server URL.

Documentation

Specifications

Examples

Schemas & Data

Other Resources

OpenAPI Specification

rancher-management-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Rancher Management API
  description: >-
    The Rancher Management API exposes Rancher's multi-cluster Kubernetes
    management capabilities as Kubernetes-style REST resources. It enables
    automation of cluster lifecycle, project and namespace management, user
    and group access control, catalog and app management, and integration of
    Rancher into CI/CD and platform engineering workflows. The API is reached
    through the Rancher server URL and authenticated with bearer tokens
    generated from the Rancher UI or via the login endpoint.
  version: '1.0'
  contact:
    name: Rancher Support
    url: https://www.rancher.com/support-maintenance-terms
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
externalDocs:
  description: Rancher API Quick Start
  url: https://ranchermanager.docs.rancher.com/api/quickstart
servers:
  - url: https://{rancher_host}/v3
    description: Rancher v3 management API
    variables:
      rancher_host:
        default: rancher.example.com
        description: Rancher server hostname.
  - url: https://{rancher_host}/k8s/clusters/{cluster_id}
    description: Rancher Kubernetes API proxy for a specific downstream cluster
    variables:
      rancher_host:
        default: rancher.example.com
      cluster_id:
        default: c-m-xxxxxxxx
tags:
  - name: Clusters
    description: Downstream Kubernetes clusters managed by Rancher.
  - name: Projects
    description: Rancher projects, which group namespaces within a cluster for tenancy and policy.
  - name: Nodes
    description: Cluster nodes registered with Rancher.
  - name: Users
    description: Rancher users.
  - name: Tokens
    description: API tokens used to authenticate against the Rancher API.
  - name: Catalogs
    description: Helm chart catalogs registered with Rancher.
  - name: Apps
    description: Helm-based applications deployed through Rancher.
  - name: Roles
    description: Role templates and role bindings defining access policies.
paths:
  /clusters:
    get:
      tags:
        - Clusters
      summary: List clusters
      operationId: listClusters
      responses:
        '200':
          description: A collection of clusters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClusterCollection'
      security:
        - BearerAuth: []
    post:
      tags:
        - Clusters
      summary: Create a cluster
      operationId: createCluster
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Cluster'
      responses:
        '201':
          description: Cluster created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Cluster'
      security:
        - BearerAuth: []
  /clusters/{id}:
    get:
      tags:
        - Clusters
      summary: Retrieve a cluster
      operationId: getCluster
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: A cluster.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Cluster'
      security:
        - BearerAuth: []
    delete:
      tags:
        - Clusters
      summary: Delete a cluster
      operationId: deleteCluster
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: Cluster deleted.
      security:
        - BearerAuth: []
  /projects:
    get:
      tags:
        - Projects
      summary: List projects
      operationId: listProjects
      responses:
        '200':
          description: A collection of projects.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectCollection'
      security:
        - BearerAuth: []
    post:
      tags:
        - Projects
      summary: Create a project
      operationId: createProject
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Project'
      responses:
        '201':
          description: Project created.
      security:
        - BearerAuth: []
  /nodes:
    get:
      tags:
        - Nodes
      summary: List nodes
      operationId: listNodes
      responses:
        '200':
          description: A collection of nodes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NodeCollection'
      security:
        - BearerAuth: []
  /users:
    get:
      tags:
        - Users
      summary: List users
      operationId: listUsers
      responses:
        '200':
          description: A collection of users.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserCollection'
      security:
        - BearerAuth: []
  /tokens:
    get:
      tags:
        - Tokens
      summary: List tokens
      operationId: listTokens
      responses:
        '200':
          description: A collection of tokens.
      security:
        - BearerAuth: []
    post:
      tags:
        - Tokens
      summary: Create a token
      operationId: createToken
      responses:
        '201':
          description: Token created.
      security:
        - BearerAuth: []
  /catalogs:
    get:
      tags:
        - Catalogs
      summary: List catalogs
      operationId: listCatalogs
      responses:
        '200':
          description: A collection of catalogs.
      security:
        - BearerAuth: []
  /apps:
    get:
      tags:
        - Apps
      summary: List apps
      operationId: listApps
      responses:
        '200':
          description: A collection of apps.
      security:
        - BearerAuth: []
  /roleTemplates:
    get:
      tags:
        - Roles
      summary: List role templates
      operationId: listRoleTemplates
      responses:
        '200':
          description: A collection of role templates.
      security:
        - BearerAuth: []
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: token-XXXXX:secret
  schemas:
    Cluster:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        kubernetesVersion:
          type: string
        provider:
          type: string
        state:
          type: string
    ClusterCollection:
      type: object
      properties:
        type:
          type: string
        data:
          type: array
          items:
            $ref: '#/components/schemas/Cluster'
    Project:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        clusterId:
          type: string
        description:
          type: string
    ProjectCollection:
      type: object
      properties:
        type:
          type: string
        data:
          type: array
          items:
            $ref: '#/components/schemas/Project'
    Node:
      type: object
      properties:
        id:
          type: string
        clusterId:
          type: string
        hostname:
          type: string
        state:
          type: string
        roles:
          type: array
          items:
            type: string
    NodeCollection:
      type: object
      properties:
        type:
          type: string
        data:
          type: array
          items:
            $ref: '#/components/schemas/Node'
    User:
      type: object
      properties:
        id:
          type: string
        username:
          type: string
        name:
          type: string
        enabled:
          type: boolean
    UserCollection:
      type: object
      properties:
        type:
          type: string
        data:
          type: array
          items:
            $ref: '#/components/schemas/User'