Overview
DataBridge provides a RESTful API for document operations. While most users will interact through our Python SDK, you can use the API directly from any language.
Base URL
For local development:
Authentication
Note: If you're running DataBridge in development mode (
dev_mode=true
indatabridge.toml
), authentication is not required and you can skip this section.
In production mode, all requests require a JWT token in the Authorization header:
To get your authentication token:
Visit the API documentation at http://localhost:8000/docs
Find the
/local/generate_uri
endpointUse the endpoint to generate a URI containing your token
Extract the token portion from the URI (the part between
:
and@
)
The generated URI will be in the format: databridge://owner_id:token@host:port
Core Operations
Document Management
POST /ingest/text
- Ingest text documentsPOST /ingest/file
- Ingest file documentsGET /documents
- List documents with pagination and filteringQuery Parameters:
skip
(optional): Number of documents to skip (default: 0)limit
(optional): Maximum number of documents to return (default: 100)filters
(optional): Metadata filters in JSON format
GET /documents/{id}
- Get document details
Search & Retrieval
POST /query
- Generate AI completions using relevant document contextParameters:
query
: The question or promptfilters
(optional): Metadata filtersk
(optional): Number of chunks to use as context (default: 4)min_score
(optional): Minimum similarity score (default: 0.0)max_tokens
(optional): Maximum tokens in completiontemperature
(optional): Sampling temperature for completion
POST /retrieve/chunks
- Search for relevant document chunksParameters:
query
: The search queryfilters
(optional): Metadata filtersk
(optional): Number of chunks to return (default: 4)min_score
(optional): Minimum similarity score (default: 0.0)
POST /retrieve/docs
- Search for relevant documentsParameters:
Same as
/retrieve/chunks
Usage & Telemetry
GET /usage/stats
- Get usage statistics for the authenticated userGET /usage/recent
- Get recent usage recordsQuery Parameters:
operation_type
(optional): Filter by operation typesince
(optional): Filter by timestampstatus
(optional): Filter by operation status
Request/Response Format
All requests and responses use JSON, except for file uploads which use multipart/form-data.
Example Text Ingestion Request
Example Query Request
Example Query Response
Example Retrieve Chunks Request
Example Retrieve Chunks Response
Example Usage Stats Response
Example Recent Usage Response
Common Response Codes
200
Success
400
Bad Request - Check request parameters
401
Unauthorized - Invalid/missing token
403
Forbidden - Insufficient permissions
404
Not Found
422
Validation Error
500
Internal Server Error
Available SDKs
Python SDK - Official Python client with both sync and async support
Last updated