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

# Overview

> The R2R APIs enables developers to build powerful AI systems that integrates the strengths of semantic search, knowledge graphs, and prompt-based generation for advanced question answering and intelligent assistants.

## What Is RAG on R2R?

### **Retrieval and Generation Workflow:**

RAG operates in two phases:

1. **Retrieve** relevant document chunks via semantic search or knowledge graph lookup.
2. **Generate** coherent and contextually accurate responses using the retrieved chunks and your customized prompts.

* **Why It Matters:** By tapping into real, structured, or unstructured content, RAG systems produce answers grounded in facts, avoiding hallucinations and improving trustworthiness.

## Core Components

| Component              | Description                                                                                       |
| ---------------------- | ------------------------------------------------------------------------------------------------- |
| **Documents & Chunks** | Ingested files or text are segmented into **Chunks**, the basis for retrieval.                    |
| **Indices**            | Vector indices enable fast similarity search over chunk embeddings.                               |
| **Graphs**             | Knowledge graph extracts relationships and entities, enabling intelligent navigation of concepts. |
| **Prompts**            | Prompt templates shape the generation step, with type-safe inputs and version control.            |
| **System Endpoints**   | Provide health checks, diagnostics, and monitoring for your RAG pipeline.                         |

## Getting Started

To get started with the R2R APIs, you will need to:

* [Install R2R](https://github.com/SciPhi-AI/R2R) in your environment.
* Run the server with `python -m r2r.serve`, or configure FastAPI settings for production use.

For detailed installation and setup instructions, refer to the R2R [Installation Guide](https://r2r-docs.sciphi.ai/self-hosting/installation/overview).

## Authentication

### API keys

IO Intelligence APIs authenticate requests using API keys. You can [generate API keys from your account](https://ai.io.net/ai/api-keys):

<Warning>
  Always treat your API key as a secret. Do not share it or expose it in client-side code (e.g., browsers or mobile apps). Instead, store it securely in an environment variable or a key management service on your backend server.
</Warning>

Include the API key in an `Authorization` HTTP header for all API requests:

```
Authorization: Bearer \$IOINTELLIGENCE_API_KEY
```

## Example of a RAG Workflow

### Step 1: Retreive relevant chunks

<CodeGroup>
  ```curl curl theme={null}
  curl -X POST https://api.intelligence.io.solutions/api/r2r/v3/retrieval/search /
    -H "Authorization: Bearer \$IOINTELLIGENCE_API_KEY" /
    -H "Content-Type: application/json" /
    -d '{
      "query": "What is Retrieval-Augmented Generation?",
      "top_k": 5
  }'
  ```
</CodeGroup>

### Step 2: Generate a response

Assuming you have retrieved relevant chunks and want to pass them as context:

<CodeGroup>
  ```curl curl theme={null}
  curl -X POST https://api.intelligence.io.solutions/api/r2r/v3/rag/generate /
    -H "Authorization: Bearer \$IOINTELLIGENCE_API_KEY" /
    -H "Content-Type: application/json" /
    -d '{
      "prompt_name": "default_rag",
      "inputs": {
        "query": "What is Retrieval-Augmented Generation?",
        "context": "Chunk 1 text/nChunk 2 text/nChunk 3 text" //it's just example chunk text
      }
  }'
  ```
</CodeGroup>

## Token Quotas & Usage

Each account has daily usage limits based on model and request volume. Refer to the [IO Intelligence Payments ](/guides/payment/io-intelligence-payments) for further information.

## Next Steps

Explore the following API references for more detailed guides:

* [**Retrieval**](/reference/rag/retrieval) – Perform semantic and hybrid search across ingested data
* [**Documents**](/reference/rag/documents) – Management and metadata of documents.
* [**Graphs**](/reference/rag/graphs) – Entity extraction and knowledge graphs.
* [**Indices**](/reference/rag/indices) – Create and configure embeddings.
* [**Chunks**](/reference/rag/chunks) – Ingest, list and search documents.
* [**Users**](/reference/rag/users) – Manage API users, authentication, and access control.
* [**Collections**](/reference/rag/collections) – Group related documents and control indexing scope.
* [**Conversations**](/reference/rag/conversations) – Manage chat sessions, history, and context retention.
* [**Prompts**](/reference/rag/prompts) – Template definition and versioning.
* [**System**](/reference/rag/system) – Health and diagnostics.
