---
title: "Creates a new direktiv namespace"
method: POST
path: "/api/v2/namespaces"
tags: ["namespaces"]
---

# Creates a new direktiv namespace

`POST /api/v2/namespaces`

## Request body

- object
  - `name` string — a unique name string of the namespace
  - `mirror` object, nullable — git mirror settings associated with the namespace (only with git mirrored namespace). Null value means this is a none mirrored (ordinary) namespace
    - `url` string — url of the git repo
    - `gitRef` string — git branch name
    - `authType` 'public' | 'ssh' | 'token' — this field indicated what kind of authentication is used
    - `authToken` string — (optional) auth token used to clone git repo
    - `publicKey` string — (optional) associated publish key ssh credential
    - `privateKey` string — (optional) associated private key ssh credential
    - `privateKeyPassphrase` string — (optional) associated private key passphrase ssh credential
    - `insecure` boolean — to ignore insecure ssl certificates

## Response `200`

data of the created direktiv namespace

- object
  - `data` object
    - `name` string — a unique string that represent name of the namespace
    - `isSystemNamespace` boolean — returns true only if this is a privileged namespace with special system-wide impacts.
    - `mirror` object, nullable — git mirror settings associated with the namespace (only with git mirrored namespace). Null value means this is a none mirrored (ordinary) namespace
      - `url` string — url of the git repo
      - `gitRef` string — git branch name
      - `authType` 'public' | 'ssh' | 'token' — this field indicated what kind of authentication is used
      - `publicKey` string — (optional) associated publish key ssh credential
      - `insecure` boolean — to ignore insecure ssl certificates
      - `createdAt` string — timestamp of creation date
      - `updatedAt` string — timestamp of last updating date
    - `createdAt` string — timestamp of creation date
    - `updatedAt` string — timestamp of last updating date

## Changes

- **2025-11-11** `cadb41a89182` — 4 breaking
  - the `mirror/authToken` request property type changed from `string(optional)` to `string`
  - the `mirror/privateKey` request property type changed from `string(optional)` to `string`
  - the `mirror/privateKeyPassphrase` request property type changed from `string(optional)` to `string`
  - the `mirror/publicKey` request property type changed from `string(optional)` to `string`
- **2025-11-11** `5316cab785be` — 2 breaking
  - the request property `mirror` became not nullable
  - the `data/mirror/publicKey` response's property type changed from `string(optional)` to `string` for status `200`
- **2025-11-11** `5ca26983939a` — 6 breaking, 1 info
  - the `mirror/authToken` request property type changed from `string` to `string(optional)`
  - the `mirror/privateKey` request property type changed from `string` to `string(optional)`
  - the `mirror/privateKeyPassphrase` request property type changed from `string` to `string(optional)`
  - the `mirror/publicKey` request property type changed from `string` to `string(optional)`
  - …3 more

[Change history](https://skmtc.dev/direktiv/apis/direktiv-apiv2-reference/changes/api/v2/namespaces/post.md)

---

[API](https://skmtc.dev/direktiv/apis/direktiv-apiv2-reference.md) · [All operations](https://skmtc.dev/direktiv/apis/direktiv-apiv2-reference/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/direktiv/direktiv-apiv2-reference/revisions/ad935afb0f54/schema)
