---
title: "Update a namespace"
method: PUT
path: "/v2/costformation/namespace/{id}"
tags: ["costformation-namespaces"]
---

# Update a namespace

`PUT /v2/costformation/namespace/{id}`

Replaces the settings for a specific namespace, including role-based access control (`view_role_ids`, `edit_role_ids`) and the optional `display_name`. `edit_role_ids` must be a subset of `view_role_ids`.

## Path parameters

- `id` string, required

## Headers

- `cloudzero-idempotency-key` string
- `cloudzero-test-key` string

## Request body

- UpdateNamespaceBody
  - `view_role_ids` string[], nullable — List of Role IDs whose members can view dimensions in this namespace. If null or empty, the namespace is publicly visible to all users.
  - `edit_role_ids` string[], nullable — List of Role IDs whose members can create and edit dimensions in this namespace. If null or empty, the namespace is publicly editable. Must be a subset of `view_role_ids`.
  - `display_name` string, nullable — Optional human-friendly display name for the namespace. If not provided, the namespace identifier (FQN) is used as the display name.

## Response `200`

Namespace updated successfully

- NamespaceResponse — Wrapper object for a single namespace response
  - `namespace` NamespaceBody, required
    - `id` string, required — The namespace identifier (FQN format, e.g. `User:MyNamespace`)
    - `view_role_ids` string[], nullable — List of Role IDs whose members can view dimensions in this namespace. If null or empty, the namespace is publicly visible to all users.
    - `edit_role_ids` string[], nullable — List of Role IDs whose members can create and edit dimensions in this namespace. If null or empty, the namespace is publicly editable. Must be a subset of `view_role_ids`.
    - `display_name` string, nullable — Optional human-friendly display name for the namespace. If not provided, the namespace identifier (FQN) is used as the display name.

## Other responses

- `400` — Bad Request Error
- `403` — Forbidden
- `404` — Not Found Error
- `422` — Invalid CloudZero CostFormation Namespace Format Error

---

[API](https://skmtc.dev/cloudzero/apis/cloudzero-api-v2-resources.md) · [All operations](https://skmtc.dev/cloudzero/apis/cloudzero-api-v2-resources/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/cloudzero/cloudzero-api-v2-resources/revisions/fd805a0e75e5/schema)
