Documentation

Getting Started with Ragpie

Everything you need to integrate RAG-as-a-Service into your applications. From quick start guides to comprehensive API references.

Quick Start Guide

Follow these steps to integrate Ragpie into your application in under 5 minutes.

1

Sign up and get your API key

Create a free account and obtain your API key from the dashboard.

After signing up, navigate to your dashboard and copy your API key from the Settings section. Keep this key secure and never share it publicly.

Environment Setupbash
# Set your API key as an environment variable
export RAGPIE_API_KEY="your_api_key_here"
2

Upload your documents

Upload documents to create your knowledge base.

Upload documents using the API or dashboard. Supported formats include PDF, DOCX, TXT, CSV, and more.

Upload Document (Python)python
import requests

# Upload a document
url = "https://api.ragpie.com/documents"
headers = {
    "Authorization": f"Bearer {RAGPIE_API_KEY}",
}
files = {
    "file": open("document.pdf", "rb"),
}
data = {
    "title": "My Document",
    "chunking_strategy": "semantic",  # or "fixed", "recursive"
}

response = requests.post(url, headers=headers, files=files, data=data)
document = response.json()
print(f"Document ID: {document['id']}")
3

Create a chat session

Start a chat session to interact with your documents.

Create a chat session and start asking questions about your documents.

Create Chat & Send Message (Python)python
import requests

# Create a chat session
url = "https://api.ragpie.com/chats"
headers = {
    "Authorization": f"Bearer {RAGPIE_API_KEY}",
    "Content-Type": "application/json",
}
data = {
    "title": "Customer Support Chat",
    "model": "gpt-4o-mini",
    "temperature": 0.7,
}

response = requests.post(url, headers=headers, json=data)
chat = response.json()
chat_id = chat["id"]

# Send a message
message_url = f"https://api.ragpie.com/chats/{chat_id}/messages"
message_data = {
    "content": "What are the key features of this product?",
    "stream": False,
}

response = requests.post(message_url, headers=headers, json=message_data)
message = response.json()
print(f"Response: {message['response']}")
4

Start querying

Query your knowledge base and get AI-powered answers.

You can now query your knowledge base with natural language questions. The AI will retrieve relevant information from your documents and generate accurate responses.

Congratulations! You're now ready to build with Ragpie.

Check out the API reference below for more advanced features and customization options.

API Reference

Complete reference for all Ragpie API endpoints with code examples in multiple languages.

Authentication

All API requests require authentication using your API key.

POST/auth/register

Create a new account

Register User (cURL)curl
curl -X POST https://api.ragpie.com/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "secure_password",
    "full_name": "John Doe"
  }'
Register User (JavaScript)javascript
const response = await fetch('https://api.ragpie.com/auth/register', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    email: 'user@example.com',
    password: 'secure_password',
    full_name: 'John Doe',
  }),
});

const data = await response.json();
console.log('User created:', data);
POST/auth/login

Login and receive an access token

Login (Python)python
import requests

url = "https://api.ragpie.com/auth/login"
data = {
    "username": "user@example.com",
    "password": "secure_password",
}

response = requests.post(url, data=data)
tokens = response.json()
access_token = tokens["access_token"]
print(f"Access Token: {access_token}")

Documents

Upload, manage, and retrieve documents in your knowledge base.

POST/documents

Upload a new document

Upload Document (cURL)curl
curl -X POST https://api.ragpie.com/documents \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@document.pdf" \
  -F "title=My Document" \
  -F "chunking_strategy=semantic"
Upload Document (Python)python
import requests

url = "https://api.ragpie.com/documents"
headers = {"Authorization": f"Bearer {api_key}"}
files = {"file": open("document.pdf", "rb")}
data = {
    "title": "My Document",
    "chunking_strategy": "semantic",
}

response = requests.post(url, headers=headers, files=files, data=data)
document = response.json()
GET/documents

List all documents

List Documents (JavaScript)javascript
const response = await fetch('https://api.ragpie.com/documents', {
  headers: {
    'Authorization': `Bearer ${apiKey}`,
  },
});

const documents = await response.json();
console.log('Documents:', documents);
GET/documents/{document_id}

Get a specific document

Get Document (Python)python
import requests

url = f"https://api.ragpie.com/documents/{document_id}"
headers = {"Authorization": f"Bearer {api_key}"}

response = requests.get(url, headers=headers)
document = response.json()
print(f"Document: {document['title']}")
DELETE/documents/{document_id}

Delete a document

Delete Document (cURL)curl
curl -X DELETE https://api.ragpie.com/documents/doc_123456 \
  -H "Authorization: Bearer YOUR_API_KEY"

Chat Sessions

Create and manage chat sessions for RAG-based conversations.

POST/chats

Create a new chat session

Create Chat (Python)python
import requests

url = "https://api.ragpie.com/chats"
headers = {
    "Authorization": f"Bearer {api_key}",
    "Content-Type": "application/json",
}
data = {
    "title": "Product Q&A",
    "model": "gpt-4o-mini",
    "temperature": 0.7,
}

response = requests.post(url, headers=headers, json=data)
chat = response.json()
print(f"Chat ID: {chat['id']}")
POST/chats/{chat_id}/messages

Send a message to a chat session

Send Message (JavaScript)javascript
const response = await fetch(`https://api.ragpie.com/chats/${chatId}/messages`, {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    content: 'What are the main features?',
    stream: false,
  }),
});

const message = await response.json();
console.log('AI Response:', message.response);
Send Message with Streaming (Python)python
import requests

url = f"https://api.ragpie.com/chats/{chat_id}/messages"
headers = {
    "Authorization": f"Bearer {api_key}",
    "Content-Type": "application/json",
}
data = {
    "content": "Explain the pricing model",
    "stream": True,
}

response = requests.post(url, headers=headers, json=data, stream=True)
for line in response.iter_lines():
    if line:
        print(line.decode('utf-8'))
GET/chats/{chat_id}/messages

Get all messages in a chat

Get Messages (cURL)curl
curl https://api.ragpie.com/chats/chat_123456/messages \
  -H "Authorization: Bearer YOUR_API_KEY"

RAG Operations

Advanced RAG operations for document processing and indexing.

POST/rag/documents/{document_id}/reindex

Re-index a document with new embeddings

Reindex Document (Python)python
import requests

url = f"https://api.ragpie.com/rag/documents/{document_id}/reindex"
headers = {"Authorization": f"Bearer {api_key}"}

response = requests.post(url, headers=headers)
result = response.json()
print(f"Re-indexing status: {result['status']}")
GET/rag/embedding-status

Check embedding processing status

Check Embedding Status (JavaScript)javascript
const response = await fetch('https://api.ragpie.com/rag/embedding-status', {
  headers: {
    'Authorization': `Bearer ${apiKey}`,
  },
});

const status = await response.json();
console.log('Queue status:', status);

Official SDKs

Use our official SDKs to integrate Ragpie into your applications with ease. All SDKs provide type-safe, idiomatic interfaces for their respective languages.

🐍

Python SDK

Official Python client library for Ragpie API

Coming Soon

Installation

pip install ragpie-sdk

Quick Example

Python SDK Examplepython
from ragpie import RagpieClient

# Initialize the client
client = RagpieClient(api_key="your_api_key")

# Upload a document
document = client.documents.create(
    file=open("document.pdf", "rb"),
    title="My Document",
    chunking_strategy="semantic"
)

# Create a chat session
chat = client.chats.create(
    title="Customer Support",
    model="gpt-4o-mini"
)

# Send a message
response = chat.send_message("What are the key features?")
print(response.content)

JavaScript/TypeScript SDK

Official JavaScript/TypeScript client for Node.js and browsers

Coming Soon

Installation

npm install @ragpie/sdk

Quick Example

JavaScript/TypeScript SDK Examplejavascript
import { RagpieClient } from '@ragpie/sdk';

// Initialize the client
const client = new RagpieClient({
  apiKey: 'your_api_key',
});

// Upload a document
const document = await client.documents.create({
  file: documentFile,
  title: 'My Document',
  chunkingStrategy: 'semantic',
});

// Create a chat session
const chat = await client.chats.create({
  title: 'Customer Support',
  model: 'gpt-4o-mini',
});

// Send a message
const response = await chat.sendMessage('What are the key features?');
console.log(response.content);
🔷

Go SDK

Official Go client library for Ragpie API

Coming Soon

Installation

go get github.com/ragpie/ragpie-go

Quick Example

Go SDK Examplego
package main

import (
    "fmt"
    "github.com/ragpie/ragpie-go"
)

func main() {
    // Initialize the client
    client := ragpie.NewClient("your_api_key")

    // Upload a document
    doc, err := client.Documents.Create(&ragpie.DocumentCreateParams{
        File: "document.pdf",
        Title: "My Document",
        ChunkingStrategy: "semantic",
    })

    // Create a chat session
    chat, err := client.Chats.Create(&ragpie.ChatCreateParams{
        Title: "Customer Support",
        Model: "gpt-4o-mini",
    })

    // Send a message
    response, err := chat.SendMessage("What are the key features?")
    fmt.Println(response.Content)
}

Integrations

Ragpie integrates seamlessly with popular AI frameworks and tools.

🦜

LangChain

Use Ragpie as a retriever in your LangChain applications

View integration guide
🦙

LlamaIndex

Integrate Ragpie with LlamaIndex for advanced RAG workflows

View integration guide
🤗

Hugging Face

Connect Ragpie with Hugging Face models and datasets

View integration guide

Zapier

Automate workflows with Ragpie and 5,000+ apps

View integration guide

Ready to build with Ragpie?

Start building intelligent applications with RAG-as-a-Service today.