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

# Add Semantic Category Template

> Add a semantic category template to a set type.

    Creates a category that will be inherited by all sets mapped to this
    set type. Template categories provide default extraction behavior
    that can be customized or disabled per-set.

    Returns the unique identifier of the created category template.



## OpenAPI

````yaml /openapi.json post /api/v2/memories/semantic/category/template
openapi: 3.1.0
info:
  title: MemMachine API
  version: 0.3.10
  description: >-
    Architectural Memory Systems for AI Agents. Specialized in episodic and
    semantic memory management with strict namespace isolation.
servers:
  - url: http://localhost:8080
security: []
tags:
  - name: Configuration
    description: System overview and memory subsystem configuration.
  - name: Episodic Configuration
    description: Per-project episodic memory subsystem configuration.
  - name: Memories
    description: Core operations for episodic and semantic memory ingestion and retrieval.
  - name: Projects
    description: Lifecycle management for isolated memory namespaces.
  - name: Resources
    description: Embedder, language model, and reranker lifecycle management.
  - name: 'Semantic Memory: Categories'
    description: Category, template, and tag management for semantic sets.
  - name: 'Semantic Memory: Features'
    description: Add, retrieve, and update individual semantic features.
  - name: 'Semantic Memory: Sets'
    description: Set type and set ID lifecycle, listing, and configuration.
  - name: System
    description: Infrastructure, health, and observability.
paths:
  /api/v2/memories/semantic/category/template:
    post:
      tags:
        - 'Semantic Memory: Categories'
      summary: Add Semantic Category Template
      description: |-
        Add a semantic category template to a set type.

            Creates a category that will be inherited by all sets mapped to this
            set type. Template categories provide default extraction behavior
            that can be customized or disabled per-set.

            Returns the unique identifier of the created category template.
      operationId: add_semantic_category_template
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddSemanticCategoryTemplateSpec'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddSemanticCategoryResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AddSemanticCategoryTemplateSpec:
      properties:
        org_id:
          type: string
          title: Org Id
          description: |2-

                The unique identifier of the organization.

                - Must not contain slashes (`/`).
                - Must contain only letters, numbers, underscores, hyphens, colon, and Unicode
                  characters (e.g., Chinese/Japanese/Korean). No slashes or other symbols
                  are allowed.

                This value determines the namespace the project belongs to.
                
          default: universal
          examples:
            - MemVerge
            - AI_Labs
        project_id:
          type: string
          title: Project Id
          description: |2-

                The identifier of the project.

                - Must be unique within the organization.
                - Must not contain slashes (`/`).
                - Must contain only letters, numbers, underscores, hyphens, colon, and Unicode
                  characters (e.g., Chinese/Japanese/Korean). No slashes or other symbols
                  are allowed.

                This ID is used in API paths and resource locations.
                
          default: universal
          examples:
            - memmachine
            - research123
            - qa_pipeline
        set_type_id:
          type: string
          title: Set Type Id
          description: |2-

                Unique identifier for the semantic set type.
        category_name:
          type: string
          title: Category Name
          description: |2-

                Human-readable name for the category. Categories group related features
                together for extraction and organization.
        prompt:
          type: string
          title: Prompt
          description: |2-

                The prompt template used for extracting features in this category.
                This drives the LLM's feature extraction behavior.
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: |2-

                Optional human-readable description of the category's purpose.
      type: object
      required:
        - set_type_id
        - category_name
        - prompt
      title: AddSemanticCategoryTemplateSpec
      description: Specification model for adding a semantic category template.
    AddSemanticCategoryResponse:
      properties:
        category_id:
          type: string
          title: Category Id
          description: |2-

                Unique identifier for the semantic category.
      type: object
      required:
        - category_id
      title: AddSemanticCategoryResponse
      description: Response model for adding a semantic category.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````