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

# Context-aware code advisor

> Analyze codebase context against Nia's indexed documentation to get tailored recommendations.



## OpenAPI

````yaml /openapi-docs.yaml post /advisor
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:
  /advisor:
    post:
      tags:
        - Advisor
      summary: Context-aware code advisor
      description: >-
        Analyze codebase context against Nia's indexed documentation to get
        tailored recommendations.
      operationId: analyze_codebase_v2_advisor_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AdvisorRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdvisorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AdvisorRequest:
      properties:
        query:
          type: string
          title: Query
          description: User's question
        codebase:
          $ref: '#/components/schemas/CodebaseContext'
          description: User's codebase context
        search_scope:
          anyOf:
            - $ref: '#/components/schemas/SearchScope'
            - type: 'null'
          description: Nia search scope
        output_format:
          type: string
          enum:
            - explanation
            - checklist
            - diff
            - structured
          title: Output Format
          description: Output format
          default: explanation
      type: object
      required:
        - query
        - codebase
      title: AdvisorRequest
      description: Request model for advisor endpoint.
    AdvisorResponse:
      properties:
        advice:
          type: string
          title: Advice
          description: Tailored advice
        sources_searched:
          type: integer
          title: Sources Searched
          description: Number of sources searched
          default: 0
        output_format:
          type: string
          title: Output Format
          default: explanation
      type: object
      required:
        - advice
      title: AdvisorResponse
      description: Response model for advisor endpoint.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    CodebaseContext:
      properties:
        files:
          additionalProperties:
            type: string
          type: object
          title: Files
          description: Map of file_path -> file_content
        file_tree:
          anyOf:
            - type: string
            - type: 'null'
          title: File Tree
          description: Directory structure (from tree command or similar)
        dependencies:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Dependencies
          description: 'Dependency files: package.json, requirements.txt, etc.'
        git_diff:
          anyOf:
            - type: string
            - type: 'null'
          title: Git Diff
          description: Git diff for migration/upgrade scenarios
        summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Summary
          description: High-level description of the codebase
        focus_paths:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Focus Paths
          description: Paths to prioritize in analysis
      type: object
      title: CodebaseContext
      description: Structured codebase context from the user.
    SearchScope:
      properties:
        repositories:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Repositories
          description: Repository identifiers to search
        data_sources:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Data Sources
          description: Documentation source IDs to search
      type: object
      title: SearchScope
      description: Scope for searching Nia's indexed sources.
    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

````