> ## Documentation Index
> Fetch the complete documentation index at: https://docs.emergence.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create or update a catalog tag

> Upsert a catalog tag. Parent category must exist and not be deleted. Returns 201 on create, 200 on update.



## OpenAPI

````yaml /openapi/em-runtime-utils-v2.yaml post /utils/metadata/tags
openapi: 3.1.0
info:
  title: em_runtime_utils
  version: 5.27.0
servers: []
security: []
paths:
  /utils/metadata/tags:
    post:
      tags:
        - metadata
      summary: Create or update a catalog tag
      description: >-
        Upsert a catalog tag. Parent category must exist and not be deleted.
        Returns 201 on create, 200 on update.
      operationId: upsert_catalog_tag
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CatalogTagCreateRequest'
      responses:
        '200':
          description: Updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CatalogTagDetail'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CatalogTagDetail'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Conflict
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - HTTPBearer: []
components:
  schemas:
    CatalogTagCreateRequest:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
          description: Tag name (e.g., 'Email', 'High')
        fully_qualified_name:
          type: string
          maxLength: 512
          minLength: 3
          title: Fully Qualified Name
          description: Two-segment FQN in Category.Tag format (e.g., 'PII.Email')
        description:
          anyOf:
            - type: string
              maxLength: 2000
            - type: 'null'
          title: Description
          description: Optional tag description
        style:
          anyOf:
            - $ref: '#/components/schemas/TagStyle'
            - type: 'null'
          description: Visual styling (color, icon)
        owners:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Owners
          description: Ownership information
      type: object
      required:
        - name
        - fully_qualified_name
      title: CatalogTagCreateRequest
      description: Request body for creating a catalog tag.
      example:
        description: Data containing email addresses
        fully_qualified_name: PII.Email
        name: Email
        style:
          color: '#FF6B6B'
          icon: mail
    CatalogTagDetail:
      properties:
        id:
          type: string
          title: Id
        asset_type:
          type: string
          title: Asset Type
          default: tag
        name:
          type: string
          title: Name
        fully_qualified_name:
          type: string
          title: Fully Qualified Name
        version:
          type: integer
          title: Version
        category_id:
          type: string
          title: Category Id
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        owners:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Owners
        style:
          anyOf:
            - $ref: '#/components/schemas/TagStyle'
            - type: 'null'
        created_by:
          type: string
          title: Created By
        updated_by:
          type: string
          title: Updated By
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        deleted_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Deleted At
      type: object
      required:
        - id
        - name
        - fully_qualified_name
        - version
        - category_id
        - created_by
        - updated_by
        - created_at
        - updated_at
      title: CatalogTagDetail
      description: Full catalog tag representation.
    ErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
      type: object
      required:
        - error
      title: ErrorResponse
      description: Standard error response model.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TagStyle:
      properties:
        color:
          anyOf:
            - type: string
              maxLength: 50
            - type: 'null'
          title: Color
          description: Tag color (e.g., '#FF0000', 'red')
        icon:
          anyOf:
            - type: string
              maxLength: 100
            - type: 'null'
          title: Icon
          description: Tag icon identifier
      type: object
      title: TagStyle
      description: Visual styling for a tag.
    ErrorBody:
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          title: Message
        details:
          additionalProperties: true
          type: object
          title: Details
        request_id:
          type: string
          title: Request Id
        timestamp:
          type: string
          format: date-time
          title: Timestamp
      type: object
      required:
        - code
        - message
        - request_id
        - timestamp
      title: ErrorBody
      description: Error body with structured details.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ErrorCode:
      type: string
      enum:
        - INVALID_REQUEST
        - INVALID_TOKEN
        - INSUFFICIENT_PERMISSIONS
        - RESOURCE_NOT_FOUND
        - RESOURCE_ALREADY_EXISTS
        - VALIDATION_ERROR
        - RATE_LIMIT_EXCEEDED
        - SERVICE_UNAVAILABLE
        - INTERNAL_ERROR
      title: ErrorCode
      description: Standard error codes for API responses.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````