> ## 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.

# Create Source



## OpenAPI

````yaml /openapi-docs.yaml post /sources
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:
    post:
      tags:
        - Sources
      summary: Create Source
      operationId: create_source_v2_sources_post
      parameters:
        - name: organization_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Organization ID for usage tracking
            title: Organization Id
          description: Organization ID for usage tracking
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SourceCreateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Source'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    SourceCreateRequest:
      properties:
        type:
          type: string
          enum:
            - repository
            - documentation
            - research_paper
            - huggingface_dataset
            - local_folder
            - slack
            - google_drive
            - connector
          title: Type
        repository:
          anyOf:
            - type: string
            - type: 'null'
          title: Repository
        branch:
          anyOf:
            - type: string
            - type: 'null'
          title: Branch
        ref:
          anyOf:
            - type: string
            - type: 'null'
          title: Ref
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
        url_patterns:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Url Patterns
        exclude_patterns:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Exclude Patterns
        project_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Project Id
        max_age:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Age
        formats:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Formats
        only_main_content:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Only Main Content
        limit:
          anyOf:
            - type: integer
            - type: 'null'
          title: Limit
        max_depth:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Depth
        crawl_entire_domain:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Crawl Entire Domain
        wait_for:
          anyOf:
            - type: integer
            - type: 'null'
          title: Wait For
        include_screenshot:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Include Screenshot
        check_llms_txt:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Check Llms Txt
        llms_txt_strategy:
          anyOf:
            - type: string
            - type: 'null'
          title: Llms Txt Strategy
        add_as_global_source:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Add As Global Source
          default: true
        is_pdf:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Pdf
        is_spreadsheet:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Spreadsheet
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
        gcs_path:
          anyOf:
            - type: string
            - type: 'null'
          title: Gcs Path
        focus_instructions:
          anyOf:
            - type: string
            - type: 'null'
          title: Focus Instructions
        extract_branding:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Extract Branding
        extract_images:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Extract Images
        config:
          anyOf:
            - type: string
            - type: 'null'
          title: Config
        folder_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Folder Name
        folder_path:
          anyOf:
            - type: string
            - type: 'null'
          title: Folder Path
        files:
          anyOf:
            - items:
                $ref: '#/components/schemas/FileItem'
              type: array
            - type: 'null'
          title: Files
        database:
          anyOf:
            - $ref: '#/components/schemas/DatabaseFileItem'
            - type: 'null'
        slack_installation_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Slack Installation Id
        google_drive_installation_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Google Drive Installation Id
        google_drive_file_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Google Drive File Ids
        google_drive_folder_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Google Drive Folder Ids
      type: object
      required:
        - type
      title: SourceCreateRequest
    Source:
      properties:
        id:
          type: string
          title: Id
          description: Source identifier
        type:
          type: string
          enum:
            - repository
            - documentation
            - research_paper
            - huggingface_dataset
            - local_folder
            - slack
            - google_drive
            - connector
          title: Type
          description: Source type
        identifier:
          anyOf:
            - type: string
            - type: 'null'
          title: Identifier
          description: Canonical identifier (repo slug, URL, or folder path)
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
          description: Human-readable name
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
          description: Indexing status
        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)
        category_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Category Id
          description: Category assignment
        is_global:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Global
          description: Whether the source is global/shared
        global_source_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Global Source Id
          description: Global source ID if applicable
        global_namespace:
          anyOf:
            - type: string
            - type: 'null'
          title: Global Namespace
          description: Global namespace if applicable
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
          description: Type-specific metadata
        curation:
          anyOf:
            - $ref: '#/components/schemas/SourceCurationSummary'
            - type: 'null'
          description: Trust signals and curated guidance summary
      type: object
      required:
        - id
        - type
      title: Source
      description: Unified source representation.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    FileItem:
      properties:
        path:
          type: string
          title: Path
          description: Relative file path (e.g., 'src/main.py')
        content:
          type: string
          title: Content
          description: File content as UTF-8 string
      type: object
      required:
        - path
        - content
      title: FileItem
      description: A single file in the upload batch.
    DatabaseFileItem:
      properties:
        filename:
          type: string
          title: Filename
          description: Original filename (e.g., 'chat.db')
        content:
          type: string
          title: Content
          description: Base64-encoded database file content
      type: object
      required:
        - filename
        - content
      title: DatabaseFileItem
      description: A database file for upload.
    SourceCurationSummary:
      properties:
        trust_signals:
          $ref: '#/components/schemas/SourceTrustSignals'
          description: Derived trust signals
        overlay_summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Overlay Summary
          description: Short overlay summary if one exists
        recommended_queries:
          items:
            type: string
          type: array
          title: Recommended Queries
          description: Suggested prompts from the overlay
      type: object
      title: SourceCurationSummary
      description: Compact curation info embedded into source responses.
    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
    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.
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: API key must be provided in the Authorization header

````