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

# Add a tag to a document

> Add *tag* to the document.  If the (doc_id, tag) pair already exists
the existing row is returned with HTTP 201 (idempotent).



## OpenAPI

````yaml /api-reference/knowledge-api.json post /v1/knowledge/documents/{doc_id}/tags
openapi: 3.1.0
info:
  title: Strattum Knowledge API
  description: >-
    REST API that serves semantic document search — embeddings via the
    configured LLM provider, indexed in Qdrant, with metadata stored in
    PostgreSQL. (PRD-004, Workstream 1.4)
  version: 1.0.0
servers: []
security: []
paths:
  /v1/knowledge/documents/{doc_id}/tags:
    post:
      tags:
        - tags
      summary: Add a tag to a document
      description: |-
        Add *tag* to the document.  If the (doc_id, tag) pair already exists
        the existing row is returned with HTTP 201 (idempotent).
      operationId: add_tag_v1_knowledge_documents__doc_id__tags_post
      parameters:
        - name: doc_id
          in: path
          required: true
          schema:
            type: string
            title: Doc Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddTagRequest'
      responses:
        '201':
          description: Tag created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TagResponse'
        '404':
          description: Document not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '503':
          description: PostgreSQL unavailable
components:
  schemas:
    AddTagRequest:
      properties:
        tag:
          type: string
          maxLength: 256
          minLength: 1
          title: Tag
          description: Tag string to add to the document.
          examples:
            - politicas
            - sla
            - enterprise
        status:
          type: string
          title: Status
          description: 'Initial status: ''suggested'' | ''confirmed'' | ''rejected''.'
          default: suggested
        source:
          type: string
          title: Source
          description: 'Tag origin: ''auto'' | ''manual''.'
          default: manual
      type: object
      required:
        - tag
      title: AddTagRequest
      description: Request body for POST /knowledge/documents/{doc_id}/tags.
    TagResponse:
      properties:
        id:
          type: integer
          title: Id
        doc_id:
          type: string
          title: Doc Id
        tag:
          type: string
          title: Tag
        status:
          type: string
          title: Status
          description: '''suggested'' | ''confirmed'' | ''rejected'''
        source:
          type: string
          title: Source
          description: '''auto'' | ''manual'''
        created_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Created At
        updated_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Updated At
      type: object
      required:
        - id
        - doc_id
        - tag
        - status
        - source
      title: TagResponse
      description: A single tag record.
    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
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````