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

# Subscribe to a global source

> Subscribe to an existing globally indexed public source. Creates a local reference for instant access without re-indexing.



## OpenAPI

````yaml /openapi-docs.yaml post /sources/subscribe
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/subscribe:
    post:
      tags:
        - Sources
      summary: Subscribe to a global source
      description: >-
        Subscribe to an existing globally indexed public source. Creates a local
        reference for instant access without re-indexing.
      operationId: subscribe_source_v2_sources_subscribe_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GlobalSourceSubscribeRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GlobalSourceSubscribeResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    GlobalSourceSubscribeRequest:
      properties:
        url:
          type: string
          title: Url
          description: >-
            URL of the source (GitHub repo, docs URL, arXiv URL/ID, or
            HuggingFace dataset URL)
        source_type:
          anyOf:
            - type: string
              enum:
                - repository
                - documentation
                - research_paper
                - huggingface_dataset
            - type: 'null'
          title: Source Type
          description: Source type. Auto-detected from URL if not provided.
        ref:
          anyOf:
            - type: string
            - type: 'null'
          title: Ref
          description: Git ref for repositories (branch, tag, or commit SHA)
      type: object
      required:
        - url
      title: GlobalSourceSubscribeRequest
      description: Request model for subscribing to a global source
    GlobalSourceSubscribeResponse:
      properties:
        action:
          type: string
          title: Action
          description: >-
            Action taken: instant_access | wait_for_indexing | not_indexed |
            use_private | indexing_started
        message:
          type: string
          title: Message
          description: Human-readable description of the action
        global_source_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Global Source Id
          description: Canonical ID of the global source
        namespace:
          anyOf:
            - type: string
            - type: 'null'
          title: Namespace
          description: TurboPuffer namespace for the source
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
          description: Current status of the global source
        local_reference_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Local Reference Id
          description: ID of the created local reference (project/data_source)
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
          description: Display name of the source
      type: object
      required:
        - action
        - message
      title: GlobalSourceSubscribeResponse
      description: Response model for global source subscription
    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
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: API key must be provided in the Authorization header

````