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

# Update Source Annotation



## OpenAPI

````yaml /openapi-docs.yaml patch /sources/{source_id}/annotations/{annotation_id}
openapi: 3.1.0
info:
  title: Nia AI API
  version: 1.1.0
  description: >-
    Nia AI API provides a single, consistent `sources` resource for all indexed
    content.


    ## Core Resources


    **Sources** (`/sources`)

    - `repository`

    - `documentation`

    - `research_paper`

    - `huggingface_dataset`

    - `local_folder`


    **Search** (`/search`)

    - `mode`: query | web | deep | universal


    Legacy endpoints are deprecated and will be removed in a future version.
    Prefer `/sources` and `/search` for new integrations.
servers:
  - url: https://apigcp.trynia.ai/v2
    description: Production API
  - url: http://localhost:8000/v2
    description: Local development
security:
  - ApiKeyAuth: []
tags:
  - name: Auth
    description: API-first signup, login, and API key bootstrapping
  - name: Sources
    description: >-
      Unified source management (repositories, documentation, papers, datasets,
      local folders)
  - name: Search
    description: Unified search endpoint with mode discriminator
  - name: Context Sharing
    description: Cross-agent context management and retrieval
  - name: Categories
    description: Category management for organizing indexed sources
  - name: GitHub Search
    description: Live GitHub search and repository exploration
  - name: Advisor
    description: Context-aware code advisor against indexed documentation
  - name: Dependencies
    description: Dependency analysis and documentation subscription
  - name: Usage
    description: Usage tracking and bulk operations
paths:
  /sources/{source_id}/annotations/{annotation_id}:
    patch:
      tags:
        - Sources
      summary: Update Source Annotation
      operationId: >-
        update_source_annotation_v2_sources__source_id__annotations__annotation_id__patch
      parameters:
        - name: source_id
          in: path
          required: true
          schema:
            type: string
            title: Source Id
        - name: annotation_id
          in: path
          required: true
          schema:
            type: string
            title: Annotation Id
        - name: type
          in: query
          required: false
          schema:
            anyOf:
              - enum:
                  - repository
                  - documentation
                  - research_paper
                  - huggingface_dataset
                  - local_folder
                  - slack
                  - google_drive
                  - connector
                type: string
              - type: 'null'
            description: Source type hint
            title: Type
          description: Source type hint
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SourceAnnotationUpdateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SourceCurationResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    SourceAnnotationUpdateRequest:
      properties:
        kind:
          anyOf:
            - type: string
              enum:
                - note
                - tip
                - warning
                - gotcha
            - type: 'null'
          title: Kind
          description: Updated annotation category
        content:
          anyOf:
            - type: string
              minLength: 1
            - type: 'null'
          title: Content
          description: Updated annotation body
      type: object
      title: SourceAnnotationUpdateRequest
    SourceCurationResponse:
      properties:
        source_id:
          type: string
          title: Source Id
          description: Source identifier
        source_type:
          type: string
          enum:
            - repository
            - documentation
            - research_paper
            - huggingface_dataset
            - local_folder
            - slack
            - google_drive
            - connector
          title: Source Type
          description: Source type
        trust_signals:
          $ref: '#/components/schemas/SourceTrustSignals'
          description: Derived trust signals
        overlay:
          anyOf:
            - $ref: '#/components/schemas/SourceCuratedOverlay'
            - type: 'null'
          description: Curated overlay if present
        annotations:
          items:
            $ref: '#/components/schemas/SourceAnnotation'
          type: array
          title: Annotations
          description: Saved annotations for the source
        created_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Created At
          description: Curation record creation timestamp (ISO)
        updated_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Updated At
          description: Curation record update timestamp (ISO)
      type: object
      required:
        - source_id
        - source_type
      title: SourceCurationResponse
      description: Full curation state for a source.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SourceTrustSignals:
      properties:
        trust_level:
          type: string
          enum:
            - low
            - medium
            - high
          title: Trust Level
          description: User or team trust preference for the source
          default: medium
        trust_tier:
          type: string
          enum:
            - low
            - medium
            - high
            - verified
          title: Trust Tier
          description: Effective trust tier after derived verified/global signals
          default: medium
        scope:
          type: string
          enum:
            - private
            - organization
            - global
          title: Scope
          description: Ownership scope of the source
          default: private
        is_global:
          type: boolean
          title: Is Global
          description: Whether the source references a shared global source
          default: false
        is_verified:
          type: boolean
          title: Is Verified
          description: Whether the source has a Nia-verified overlay
          default: false
        overlay_available:
          type: boolean
          title: Overlay Available
          description: Whether a curated overlay is attached
          default: false
        annotation_count:
          type: integer
          title: Annotation Count
          description: Number of saved annotations for this source
          default: 0
      type: object
      title: SourceTrustSignals
      description: Trust and curation signals attached to a source.
    SourceCuratedOverlay:
      properties:
        kind:
          type: string
          enum:
            - custom
            - nia_verified
          title: Kind
          description: Overlay provenance
          default: custom
        summary:
          type: string
          title: Summary
          description: Short high-confidence summary for the source
        guidance:
          anyOf:
            - type: string
            - type: 'null'
          title: Guidance
          description: Longer coding-agent guidance or caveats
        recommended_queries:
          items:
            type: string
          type: array
          title: Recommended Queries
          description: Suggested follow-up prompts for agents
        updated_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Updated At
          description: Last overlay update timestamp (ISO)
      type: object
      required:
        - summary
      title: SourceCuratedOverlay
      description: Structured high-confidence guidance layered on top of a source.
    SourceAnnotation:
      properties:
        id:
          type: string
          title: Id
          description: Annotation identifier
        kind:
          type: string
          enum:
            - note
            - tip
            - warning
            - gotcha
          title: Kind
          description: Annotation category
          default: note
        content:
          type: string
          title: Content
          description: Annotation text
        created_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Created At
          description: Creation timestamp (ISO)
        updated_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Updated At
          description: Last update timestamp (ISO)
      type: object
      required:
        - id
        - content
      title: SourceAnnotation
      description: A saved note attached to a source.
    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
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: API key must be provided in the Authorization header

````