RagSphere API Docs
RagSphere is an Agent-to-Agent (A2A) compliant service that lets you ingest documents and query them using hybrid RAG — combining vector search, knowledge graphs, and optional live web intelligence.
Get Your API Key
Every request to RagSphere must include your personal API key. Sign in to your dashboard to generate one.
Sign in to get your free API key
Create a free account and generate your key in the dashboard.
Include key in every request header
x-a2a-key: YOUR_API_KEY
Ingest a Document
Send a URL pointing to a Website, PDF, Excel file, or YouTube video. RagSphere will download, parse, embed, and index it — then return a document_id you'll use for querying.
Request
curl -X POST https://ragsphere.vercel.app/api/a2a/tasks \
-H "x-a2a-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"skill": "ingest",
"input": {
"source_url": "https://example.com/report.pdf"
}
}'Success Response 200
{
"status": "success",
"output": {
"document_id": "64f3a1b2c9e77d001a4e5f21",
"chunks": 18,
"source": "report.pdf"
}
}document_id! You will need it in Step 3 to query this document. RagSphere does not expose a document listing endpoint.Query Your Knowledge
Ask any question about your ingested document. RagSphere runs a Triple-Query across vector embeddings, the Neo4j knowledge graph, and optionally the live web — then synthesises a single answer.
Request
curl -X POST https://ragsphere.vercel.app/api/a2a/tasks \
-H "x-a2a-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"skill": "query",
"input": {
"question": "What are the key findings in Q3?",
"document_id": "64f3a1b2c9e77d001a4e5f21",
"use_web_search": false
}
}'Success Response 200
{
"status": "success",
"output": {
"answer": "The Q3 report highlights a 23% YoY revenue increase...",
"document_id": "64f3a1b2c9e77d001a4e5f21"
}
}"use_web_search": true to augment the answer with live search results from the web. Useful for documents referencing recent events or external data.Handle Responses
All responses are JSON. Check the HTTP status code first, then read the body. Here are the patterns you should handle in your agent.
{ "status": "success", "output": { ... } }{ "error": "Bad Request", "message": "Invalid input parameters", "details": { ... } }{ "error": "Unauthorized", "message": "Missing x-a2a-key header" }{ "error": "Resource Not Found", "message": "No context found for the given document_id." }{ "error": "Rate limit exceeded", "retryAfter": 3600 }{ "error": "Internal Server Error", "message": "..." }API Reference
Complete parameter reference for all skills and endpoints.
HEADER Authentication
Required on every request to POST /api/a2a/tasks
| Header | Type | Description |
|---|---|---|
x-a2a-keyrequired | string | Your personal API key from the RagSphere dashboard. |
Content-Typerequired | string | Must be "application/json". |
POST Ingest Skill
Process a remote document and add it to your knowledge base.
| Parameter | Type | Description |
|---|---|---|
skillrequired | "ingest" | Literal string that selects the ingest skill. |
input.source_urlrequired | string (URL) | Public URL to a Website, PDF, Excel (.xlsx), or YouTube video. The resource must be publicly accessible. |
POST Query Skill
Ask a natural language question against an ingested document.
| Parameter | Type | Description |
|---|---|---|
skillrequired | "query" | Literal string that selects the query skill. |
input.questionrequired | string | The natural language question to answer. |
input.document_idrequired | string | The document_id returned from a previous ingest call. |
input.use_web_search | boolean= false | When true, augments the answer with live Tavily web search results. Useful for time-sensitive topics. |
Error Codes
| Status | Error | How to fix |
|---|---|---|
| 400 | Bad Request | Ensure all required fields are present and source_url is a valid URL. |
| 400 | Unsupported Source | Only PDF, Excel, and YouTube URLs are accepted. |
| 401 | Unauthorized | Include a valid x-a2a-key header. Generate one from the dashboard. |
| 404 | Resource Not Found | The document_id does not exist for your account. Re-ingest the document first. |
| 429 | Rate Limit Exceeded | You've hit the 100 req / 12h limit. Check the Retry-After header and wait. |
| 500 | Internal Server Error | Transient server error. Retry with exponential backoff. |
Rate Limits
| Endpoint | Limit | Window | Scope |
|---|---|---|---|
| POST /api/a2a/tasks | 100 requests | 12 hours | Per API key |
A sliding window algorithm is used. When limited, the response includes a Retry-After header (in seconds) and a retryAfter field in the body.
Code Examples
Copy-paste ready snippets in common agent languages.
Python — Ingest + Query
import requests
API_KEY = "your_api_key_here"
BASE = "https://ragsphere.vercel.app/api/a2a/tasks"
HEADERS = {"x-a2a-key": API_KEY, "Content-Type": "application/json"}
# Step 1: Ingest a document
ingest_res = requests.post(BASE, headers=HEADERS, json={
"skill": "ingest",
"input": {"source_url": "https://example.com/report.pdf"}
})
data = ingest_res.json()
document_id = data["output"]["document_id"]
print(f"Ingested! document_id = {document_id}")
# Step 2: Query the document
query_res = requests.post(BASE, headers=HEADERS, json={
"skill": "query",
"input": {
"question": "Summarise the key findings.",
"document_id": document_id,
"use_web_search": False
}
})
answer = query_res.json()["output"]["answer"]
print(f"Answer: {answer}")JavaScript / Node.js — Ingest + Query
const API_KEY = "your_api_key_here";
const BASE = "https://ragsphere.vercel.app/api/a2a/tasks";
const headers = { "x-a2a-key": API_KEY, "Content-Type": "application/json" };
// Step 1: Ingest
const ingestRes = await fetch(BASE, {
method: "POST",
headers,
body: JSON.stringify({
skill: "ingest",
input: { source_url: "https://example.com/report.pdf" },
}),
});
const { output: { document_id } } = await ingestRes.json();
console.log("document_id:", document_id);
// Step 2: Query
const queryRes = await fetch(BASE, {
method: "POST",
headers,
body: JSON.stringify({
skill: "query",
input: {
question: "What are the key findings?",
document_id,
use_web_search: false,
},
}),
});
const { output: { answer } } = await queryRes.json();
console.log("Answer:", answer);cURL — Quick test
# Ingest
curl -X POST https://ragsphere.vercel.app/api/a2a/tasks \
-H "x-a2a-key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"skill":"ingest","input":{"source_url":"https://example.com/report.pdf"}}'
# Query (replace DOCUMENT_ID with value from above)
curl -X POST https://ragsphere.vercel.app/api/a2a/tasks \
-H "x-a2a-key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"skill":"query","input":{"question":"Key findings?","document_id":"DOCUMENT_ID","use_web_search":false}}'