# HeliosDB BaaS — AI Agent Integration Guide ## Overview HeliosDB Cloud provides a Backend-as-a-Service with instant database provisioning, branching, time-travel queries, vector search, and per-database API keys. All features are available on the free tier (with quotas). - **Base URL:** `https://cloud.heliosdb.com` - **OpenAPI 3.1 Spec:** `https://cloud.heliosdb.com/api/v1/openapi.json` - **MCP Endpoint:** `POST https://cloud.heliosdb.com/api/v1/mcp` - **Auth:** Bearer JWT token or `X-API-Key: hdb_...` header ## Quick Start (Single Request) ```bash POST /api/v1/quick-start Content-Type: application/json { "email": "agent@myapp.com", "password": "securepassword", "username": "agent", "org_name": "MyApp", "db_name": "main" } ``` **Response:** ```json { "success": true, "data": { "token": "eyJ...", "org_id": "uuid", "db_id": "uuid", "api_key": "hdb_...", "endpoints": { "execute": "/api/v1/organizations/{org_id}/databases/{db_id}/execute", "branches": "/api/v1/organizations/{org_id}/databases/{db_id}/branches", "query_at": "/api/v1/organizations/{org_id}/databases/{db_id}/query-at", "api_keys": "/api/v1/organizations/{org_id}/databases/{db_id}/api-keys" } } } ``` ## Execute SQL ```bash POST /api/v1/organizations/{org_id}/databases/{db_id}/execute X-API-Key: hdb_... Content-Type: application/json {"sql": "CREATE TABLE users (id SERIAL, name TEXT, embedding VECTOR(768))"} ``` ## Branching ### List Branches ``` GET .../databases/{db_id}/branches ``` ### Create Branch ```bash POST .../databases/{db_id}/branches {"name": "feature-1", "as_of": "now"} ``` Supported `as_of` values: `now`, `timestamp:`, `transaction:`, `scn:`. Optional `from` field specifies parent branch. ### Switch Branch ```bash POST .../databases/{db_id}/branches/switch {"name": "feature-1"} ``` ### Merge Branch ```bash POST .../databases/{db_id}/branches/merge {"source": "feature-1", "target": "main"} ``` ### Delete Branch ``` DELETE .../databases/{db_id}/branches/{name} ``` ## Time-Travel Queries ```bash POST .../databases/{db_id}/query-at {"sql": "SELECT * FROM users", "as_of": "2025-06-01T00:00:00Z"} ``` Free tier: 24-hour lookback. Starter: 7 days. Pro: 90 days. ## API Keys (Per-Database) ### Create ```bash POST .../databases/{db_id}/api-keys {"name": "frontend", "scopes": ["read", "write"]} ``` Returns raw key once (prefix `hdb_`). Store it securely. ### List ``` GET .../databases/{db_id}/api-keys ``` ### Revoke ``` DELETE .../databases/{db_id}/api-keys/{key_id} ``` ## MCP (Model Context Protocol) Discover all tools: ```bash POST /api/v1/mcp Content-Type: application/json {"jsonrpc": "2.0", "method": "tools/list", "id": 1} ``` Call a tool: ```bash POST /api/v1/mcp Authorization: Bearer {token} Content-Type: application/json { "jsonrpc": "2.0", "method": "tools/call", "params": { "name": "execute_sql", "arguments": { "org_id": "...", "db_id": "...", "sql": "SELECT * FROM users" } }, "id": 2 } ``` ### Available MCP Tools | Tool | Description | |------|-------------| | `quick_start` | Create account, database, and API key | | `execute_sql` | Run SQL on a database | | `create_database` | Create a new database | | `list_databases` | List databases in an org | | `create_branch` | Create a branch (with as_of, from) | | `switch_branch` | Switch active branch | | `merge_branch` | Merge branches | | `list_branches` | List all branches | | `query_at` | Time-travel query | | `create_api_key` | Create scoped API key | ## Free Tier Quotas ### Sub-Levels (all free, no credit card) | Resource | Unverified | Verified (email) | Trusted (feedback) | |----------|-----------|-------------------|-------------------| | Databases | 3 | 5 | 7 | | Storage | 5 MB | 50 MB | 200 MB | | Queries/hour | 200 | 500 | 2,000 | | Branches | 3 | 10 | 20 | | Time-travel | 24h | 3 days | 7 days | | Tables/DB | 10 | 50 | 200 | Upgrade path: signup → verify email → opt in for feedback + complete session with team. | Vector search | Included | | Graph traversal | Included | | BM25 hybrid search | Included | ## SQL Features HeliosDB is PostgreSQL wire-compatible and supports: - Standard SQL (DDL, DML, queries, joins, aggregations) - `VECTOR(n)` column type with HNSW indexing - `CREATE BRANCH`, `USE BRANCH`, `MERGE BRANCH`, `DROP BRANCH` - `SELECT ... AS OF TIMESTAMP '...'` for time-travel - Materialized views with incremental refresh - Stored procedures and triggers - Full-text search with BM25 scoring