---
title: "Get or create namespace tags"
method: POST
path: "/namespacetags"
tags: ["TagService"]
---

# Get or create namespace tags

`POST /namespacetags`

## Request

- Base URL: `https://csp.infoblox.com/api/atlas-tagging/v2`
- URL: `https://csp.infoblox.com/api/atlas-tagging/v2/namespacetags`
- Auth: API key in header `Authorization`
- TypeScript: <https://skmtc.dev/infoblox/apis/atlas-tagging-api/docs/namespacetags/post.ts> (a function with typed inputs; its response is checked against the schema)

Validates the provided tags and returns or creates the corresponding namespace and tag definitions. Used internally by application services via tagging middleware.

## Query parameters

- `account_id` string

## Request body

- string: tagging.api.tags

## Response `201`

A successful response.

- ServiceNamespaceTagsResponse: NamespaceTagsResponse contains namespaces and tags returned by GetOrCreateNamespaceTags.
  - `namespaces` ServiceNamespace[]: The namespace objects (existing or newly created).
    - `created_at` string, date-time: Read-only. Timestamp created_at, equals to time when particular object was created. Format: RFC 3339 (ISO 8601).
    - `deleted_at` string, date-time: Read-only. Timestamp deleted_at, equals to time when particular object was deleted, by default equals to null. Format: RFC 3339 (ISO 8601).
    - `id` string: The resource identifier.
    - `name` string: Human-readable name for namespace.
    - `type` string: The namespace type. Valid values: "freeform" (default), "locked", "system".
    - `updated_at` string, date-time: Read-only. Timestamp updated_at, equals to time when particular object was updated, by default equals to created_at. Format: RFC 3339 (ISO 8601).
  - `tags` ServiceTag[]: The tag definition objects (existing or newly created).
    - `compartment_id` string: The compartment ID for multi-tenancy scoping.
    - `created_at` string, date-time: Read-only. Timestamp created_at, equals to time when particular object was created. Format: RFC 3339 (ISO 8601).
    - `deleted_at` string, date-time: Read-only. Timestamp deleted_at, equals to time when particular object was deleted, by default equals to null. Format: RFC 3339 (ISO 8601).
    - `id` string: The resource identifier.
    - `key` string: The tag key. Must be unique within a namespace and account.
    - `namespace` ServiceNamespace
      - `created_at` string, date-time: Read-only. Timestamp created_at, equals to time when particular object was created. Format: RFC 3339 (ISO 8601).
      - `deleted_at` string, date-time: Read-only. Timestamp deleted_at, equals to time when particular object was deleted, by default equals to null. Format: RFC 3339 (ISO 8601).
      - `id` string: The resource identifier.
      - `name` string: Human-readable name for namespace.
      - `type` string: The namespace type. Valid values: "freeform" (default), "locked", "system".
      - `updated_at` string, date-time: Read-only. Timestamp updated_at, equals to time when particular object was updated, by default equals to created_at. Format: RFC 3339 (ISO 8601).
    - `regexp` string: The tag regexp. POSIX regexp string, used for values validation. By default equals to "*" (allow all). Only applies to freeform tags.
    - `regexp_description` string: The regexp_description, optional human-readable description explaining the regexp validation pattern.
    - `status` string: The tag status. Valid values: "active" (default), "revoked" (soft-deleted).
    - `type` string: The tag type. Valid values: "freeform" (default — any value allowed), "restricted" (only predefined values allowed).
    - `updated_at` string, date-time: Read-only. Timestamp updated_at, equals to time when particular object was updated, by default equals to created_at. Format: RFC 3339 (ISO 8601).
    - `values` ServiceValue[]: The values is a repeated value objects which belongs to particular tag. For restricted tags, defines the set of allowed values.
      - `created_at` string, date-time: Read-only. Timestamp created_at, equals to time when particular object was created. Format: RFC 3339 (ISO 8601).
      - `deleted_at` string, date-time: Read-only. Timestamp deleted_at, equals to time when particular object was deleted, by default equals to null. Format: RFC 3339 (ISO 8601).
      - `id` string: The resource identifier.
      - `value` string: The value string. Trimmed of leading/trailing whitespace on input.
    - `version` integer: The version is used for optimistic concurrency control — prevents multiple users from updating the same tag simultaneously. Must match the current server-side version for updates to succeed.

## Other responses

- `default`: An unexpected error response.

---

[API](https://skmtc.dev/infoblox/apis/atlas-tagging-api.md) - [All operations](https://skmtc.dev/infoblox/apis/atlas-tagging-api/llms.txt) - [OpenAPI document](https://skmtc.dev/infoblox/apis/atlas-tagging-api/revisions/4255d62cedc5?raw)
