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

# Run AutoRAG agent over all data

> Uses the AutoRAG agent to answer a question about any data that the user can access.



## OpenAPI

````yaml /api-reference/openapi.yml post /query/autorag
openapi: 3.0.3
info:
  title: DataLinks
  version: 2.2.3
servers:
  - url: https://api.datalinks.com/api/v1
    description: production server
security:
  - bearerAuth: []
  - openId:
      - implicit
paths:
  /query/autorag:
    post:
      tags:
        - autorag
      summary: Run AutoRAG agent over all data
      description: >-
        Uses the AutoRAG agent to answer a question about any data that the user
        can access.
      operationId: autorag
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AutoRagRequest'
        required: true
      responses:
        '200':
          $ref: '#/components/responses/AutoRagResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    AutoRagRequest:
      required:
        - namespace
        - query
        - username
      type: object
      properties:
        username:
          type: string
        namespace:
          type: string
        query:
          type: string
          example: What do llamas drink to cool themselves down?
        helperPrompt:
          type: string
          example: You're a prophet of the alpacalypse. Your task is to spit the word!
        model:
          type: string
        provider:
          type: string
        conversationId:
          type: string
          description: >-
            Existing conversation to continue. Omit to start a new conversation;
            the id is returned on the run-started SSE event.
    AutoRagResponseData:
      required:
        - response
        - steps
      type: object
      properties:
        response:
          type: string
          description: Final response generated for the user's question.
        steps:
          type: array
          description: List of steps executed during the AutoRAG process.
          items:
            required:
              - data
              - instruction
              - query
              - reasoning
            type: object
            properties:
              instruction:
                type: string
                description: The instruction generated and executed for this step.
              query:
                type: string
                description: The query derived from the instruction.
              reasoning:
                type: string
                description: >-
                  The reasoning produced by the LLM when generating the query
                  for this step.
              data:
                $ref: '#/components/schemas/DataArray'
    ErrorResponse:
      required:
        - error_code
        - message
      type: object
      properties:
        error_code:
          type: string
          example: UNAUTHORIZED
        error_message:
          type: string
          example: ''
        message:
          type: string
          example: Missing authentication token
        sub_errors:
          type: array
          items:
            required:
              - code
              - message
            type: object
            properties:
              code:
                type: string
              message:
                type: string
    DataArray:
      type: array
      description: Array of ontology data objects retrieved from queries.
      items:
        type: object
        additionalProperties: true
  responses:
    AutoRagResponse:
      description: >-
        Response containing step-by-step RAG execution results and the final
        answer.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AutoRagResponseData'
    Unauthorized:
      description: >-
        Unauthorized. This error occurs if the authentication token is missing
        or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      description: >
        Use a Bearer token for authentication. Submit the token using the
        `Authorization`

        header: `Authorization: Bearer <token>`.
      scheme: bearer
    openId:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: >-
            https://login.datalinks.com/realms/datalinks-realm/protocol/openid-connect/auth
          scopes:
            openid: openid

````