---
title: "Create a namespace"
method: POST
path: "/v2/costformation/namespace"
tags: ["costformation-namespaces"]
---

# Create a namespace

`POST /v2/costformation/namespace`

Creates a new costformation namespace for the organization

## Headers

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

## Request body

- NamespaceBody
  - `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.

## Response `200`

Namespace created 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
- `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)
