The RAG Agent data plane API handles business requests and data operations on your RDS Supabase instance — managing datasets, uploading documents, querying knowledge bases, and searching the knowledge graph.
Control plane vs. data plane
The RAG Agent API is split into two planes:
| Plane | Purpose | Call frequency |
|---|---|---|
| Control plane | Manages resource lifecycle: creating, modifying, viewing, and deleting instances | Low |
| Data plane | Handles business requests: datasets, documents, queries, search, and graph operations | High |
This reference covers the data plane API only.
Authentication
All data plane API requests require authentication. Two methods are available.
Authenticate with a ServiceKey
Use this method for administrative access. A ServiceKey grants full access to all datasets.
-
On the RDS Supabase instance details page, click Get API key in the upper-right corner and copy the ServiceKey.
-
On the same page, go to Basic Information > Network Information and copy the Public Endpoint.
-
Pass the ServiceKey in the
apikeyheader:curl -X GET "http://<public_endpoint>/rag/v1/datasets" \ -H "apikey: <Supabase_ServiceKey>" \ -H "Content-Type: application/json"
Authenticate with an AnonKey and access token
Use this method to authenticate as a specific Supabase auth user. Requests can only access datasets that the authenticated user has permission to view or modify.
-
On the RDS Supabase instance details page, click Get API key in the upper-right corner and copy the AnonKey.
-
On the same page, go to Basic Information > Network Information and copy the Public Endpoint.
-
Call the login API to get an access token. The access token is returned in the response body.
curl -X POST "http://<public_endpoint>/login" \ -H "apikey: <AnonKey>" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "username=<auth_user_email>&password=<auth_user_password>" -
Pass both the AnonKey and access token in subsequent requests:
curl -X POST "http://<public_endpoint>/rag/v1/datasets" \ -H "apikey: <AnonKey>" \ -H "Authorization: Bearer <RAG_Agent_access_token>" \ -H "Content-Type: application/json" \ -d '{ "name": "xxxx", "description": "xxxx", "rag_type": "rag", "storage_type": "local", "visibility": "private" }'
API
Dataset management
Create a dataset
List datasets
Get a dataset
Update a dataset
Delete a dataset
Document management
Upload a document
Insert text
Get document processing status
List documents
List documents with pagination
Delete documents
Clear all documents
Get document statistics
Query features
All query endpoints share a common set of parameters for controlling retrieval behavior.
Query modes
| Mode | Description | Best for |
|---|---|---|
local |
Retrieves based on local context | Specific questions requiring precise answers |
global |
Queries the global knowledge graph | General or conceptual questions requiring deep understanding |
hybrid |
Combines local and global knowledge | Balancing accuracy and coverage |
naive |
Vector retrieval only | — |
mix (default) |
Combines vector and graph search | General use (equivalent to naive + hybrid) |
bypass |
Skips RAG and queries the large language model (LLM) directly | — |
Query a dataset
Streaming query
Cross-dataset query
Cross-dataset contextual query
Cross-dataset streaming query
Search features
Search a dataset
Graph features
Get graph statistics
Get graph labels
Query graph data
Get dataset health status
Cache management
Clear dataset cache
Pipeline management
Get pipeline status
Clear pipeline cache
Get pipeline overview
System features
Get authentication status
Log on
Health check
Response schemas
Dataset (DatasetInfo)
Document (DocStatusResponse)
Pagination (PaginationInfo)
Error response
All errors follow this structure:
{
"error": "Error type",
"message": "Detailed error description",
"dataset_id": "ID of the related dataset (optional)"
}
HTTP status codes
| Status code | Meaning | Common causes |
|---|---|---|
| 200 | Success | Request processed successfully. |
| 400 | Bad request | Invalid parameters or configuration. |
| 401 | Unauthorized | Missing or invalid authentication credentials. |
| 404 | Not found | The dataset or document does not exist. |
| 422 | Authentication fault | Request parameter validation failed. |
| 500 | Server error | An internal server error occurred. |