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.
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.
# Set your API key as an environment variable
export RAGPIE_API_KEY="your_api_key_here"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.
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']}")Create a chat session
Start a chat session to interact with your documents.
Create a chat session and start asking questions about your documents.
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']}")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.
/auth/registerCreate a new account
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"
}'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);/auth/loginLogin and receive an access token
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.
/documentsUpload a new document
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"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()/documentsList all documents
const response = await fetch('https://api.ragpie.com/documents', {
headers: {
'Authorization': `Bearer ${apiKey}`,
},
});
const documents = await response.json();
console.log('Documents:', documents);/documents/{document_id}Get a specific document
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']}")/documents/{document_id}Delete a document
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.
/chatsCreate a new chat session
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']}")/chats/{chat_id}/messagesSend a message to a chat session
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);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'))/chats/{chat_id}/messagesGet all messages in a chat
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.
/rag/documents/{document_id}/reindexRe-index a document with new embeddings
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']}")/rag/embedding-statusCheck embedding processing status
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
Installation
pip install ragpie-sdkQuick Example
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
Installation
npm install @ragpie/sdkQuick Example
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
Installation
go get github.com/ragpie/ragpie-goQuick Example
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.
Additional Resources
Interactive API Docs
Try out API endpoints directly in your browser with Swagger UI
ReDoc Documentation
Clean, responsive API documentation with search and navigation
Use Cases
Explore real-world examples and industry-specific implementations
GitHub Repository
Browse code examples, report issues, and contribute
Ready to build with Ragpie?
Start building intelligent applications with RAG-as-a-Service today.