---
title: "Update a cluster in a project"
method: PUT
path: "/api/v4/projects/{id}/clusters/{cluster_id}"
tags: ["clusters"]
---

# Update a cluster in a project

`PUT /api/v4/projects/{id}/clusters/{cluster_id}`

## Request

- Base URL: `https://gitlab.com`
- URL: `https://gitlab.com/api/v4/projects/{id}/clusters/{cluster_id}`
- Auth: none declared

Updates a cluster in a specified project.

## Path parameters

- `id` string, required
- `cluster_id` integer, required

## Request body

- PutApiV4ProjectsIdClustersClusterId: Update a cluster in a project
  - `name` string: Cluster name
  - `domain` string: Cluster base domain
  - `environment_scope` string: The associated environment to the cluster
  - `namespace_per_environment` boolean: Deploy each environment to a separate Kubernetes namespace
  - `management_project_id` integer: The ID of the management project
  - `enabled` boolean: Determines if cluster is active or not
  - `managed` boolean: Determines if GitLab will manage namespaces and service accounts for this cluster
  - `platform_kubernetes_attributes` object: Platform Kubernetes data
    - `api_url` string: URL to access the Kubernetes API
    - `token` string: Token to authenticate against Kubernetes
    - `ca_cert` string: TLS certificate (needed if API is using a self-signed TLS certificate)
    - `namespace` string: Unique namespace related to Project

## Response `200`

Update a cluster in a project

- APIEntitiesClusterProject: API_Entities_ClusterProject model
  - `id` string, required
  - `name` string, required
  - `created_at` string, required
  - `domain` string, required
  - `enabled` string, required
  - `managed` string, required
  - `provider_type` string, required
  - `platform_type` string, required
  - `environment_scope` string, required
  - `cluster_type` string, required
  - `namespace_per_environment` string, required
  - `user` APIEntitiesUserBasic, required: API_Entities_UserBasic model
    - `id` integer, required
    - `username` string, required
    - `public_email` string, required
    - `name` string, required
    - `state` string, required
    - `locked` boolean, required
    - `avatar_url` string, required
    - `avatar_path` string
    - `custom_attributes` APIEntitiesCustomAttribute[]
      - `key` string, required
      - `value` string, required
    - `web_url` string, required
  - `platform_kubernetes` APIEntitiesPlatformKubernetes, required
    - `api_url` string, required
    - `namespace` string, required
    - `authorization_type` string, required
    - `ca_cert` string, required
  - `provider_gcp` APIEntitiesProviderGcp, required
    - `cluster_id` string, required
    - `status_name` string, required
    - `gcp_project_id` string, required
    - `zone` string, required
    - `machine_type` string, required
    - `num_nodes` string, required
    - `endpoint` string, required
  - `management_project` APIEntitiesProjectIdentity, required
    - `id` integer, required
    - `description` string, required
    - `name` string, required
    - `name_with_namespace` string, required
    - `path` string, required
    - `path_with_namespace` string, required
    - `created_at` string, date-time, required
  - `project` APIEntitiesBasicProjectDetails, required: API_Entities_BasicProjectDetails model
    - `id` integer, required
    - `description` string, required
    - `name` string, required
    - `name_with_namespace` string, required
    - `path` string, required
    - `path_with_namespace` string, required
    - `created_at` string, date-time, required
    - `default_branch` string
    - `tag_list` string[], required
    - `topics` string[], required
    - `ssh_url_to_repo` string, required
    - `http_url_to_repo` string, required
    - `web_url` string, required
    - `readme_url` string
    - `forks_count` integer
    - `license_url` string
    - `license` APIEntitiesLicenseBasic
      - `key` string, required
      - `name` string, required
      - `nickname` string, required
      - `html_url` string, required
      - `source_url` string, required
    - `avatar_url` string, required
    - `star_count` integer, required
    - `last_activity_at` string, date-time, required
    - `visibility` string, required
    - `namespace` APIEntitiesNamespaceBasic, required
      - `id` integer, required
      - `name` string, required
      - `path` string, required
      - `kind` string, required
      - `full_path` string, required
      - `parent_id` integer, required
      - `avatar_url` string, required
      - `web_url` string, required
    - `custom_attributes` APIEntitiesCustomAttribute: API_Entities_CustomAttribute model
      - `key` string, required
      - `value` string, required
    - `repository_storage` string

## Other responses

- `400`: Validation error
- `403`: Forbidden
- `404`: Not found

---

[API](https://skmtc.dev/gitlab/apis/gitlab-api.md) - [All operations](https://skmtc.dev/gitlab/apis/gitlab-api/llms.txt) - [OpenAPI document](https://skmtc.dev/gitlab/apis/gitlab-api/revisions/b234947ef3f2?raw)
