# Aurabase REST API Reference (PostgREST Compatible) > Database Endpoint: `https://.aurabase.dev/v1/db` > Required Headers: > - `apikey: ` (or service_role key) > - `Authorization: Bearer ` (user session token) > - `Content-Type: application/json` ## 1. Table Queries (PostgREST Syntax) ### SELECT (Read) ```http GET /v1/db/posts?select=id,title,author:users(name)&published=eq.true&order=created_at.desc&limit=10 HTTP/1.1 Host: .aurabase.dev apikey: aura_anon_xxx ``` Supported Filter Operators (`col=op.value`): - `eq`: Equals (`age=eq.25`) - `neq`: Not equals (`status=neq.archived`) - `gt` / `gte`: Greater than / Greater or equal (`price=gte.100`) - `lt` / `lte`: Less than / Less or equal (`stock=lt.5`) - `like` / `ilike`: Case-sensitive / insensitive pattern search (`name=ilike.%rust%`) - `is`: Special values (`deleted_at=is.null`) - `in`: Array inclusion (`role=in.(admin,moderator)`) - `cs` / `cd`: Contains / Contained by (JSONB and arrays) ### INSERT (Create) ```http POST /v1/db/posts HTTP/1.1 Host: .aurabase.dev apikey: aura_anon_xxx Content-Type: application/json Prefer: return=representation { "title": "Rust in Production", "content": "Zero garbage collector pauses with predictable latencies.", "published": true } ``` ### UPDATE (Modify) ```http PATCH /v1/db/posts?id=eq.uuid-123 HTTP/1.1 Host: .aurabase.dev apikey: aura_anon_xxx Content-Type: application/json { "published": false } ``` ### DELETE (Remove) ```http DELETE /v1/db/posts?id=eq.uuid-123 HTTP/1.1 Host: .aurabase.dev apikey: aura_anon_xxx ``` ### RPC (Stored Procedure Execution) ```http POST /v1/db/rpc/calculate_user_balance HTTP/1.1 Host: .aurabase.dev apikey: aura_anon_xxx Content-Type: application/json { "user_id": "usr_98765" } ``` ## 2. NoSQL MongoDB Endpoints - `POST /v1/db/:collection/aggregate`: Execute BSON/JSON aggregation pipeline (`$match`, `$group`, `$sort`). - `POST /v1/db/:collection/search`: Full-text search across indexed collection fields. ## 3. Auth Endpoints (`/v1/auth`) - `POST /v1/auth/signup`: User registration with email/password. - `POST /v1/auth/signin`: Login and session token issuance. - `POST /v1/auth/refresh`: Refresh expired access token. - `GET /v1/auth/sessions`: List active user sessions. - `POST /v1/auth/mfa/enroll`: Initialize TOTP MFA enrollment. - `POST /v1/auth/mfa/verify`: Verify 6-digit TOTP challenge. ## 4. S3 Storage Endpoints (`/v1/storage`) - `POST /v1/storage/upload/:bucket/:path`: Binary file upload. - `POST /v1/storage/signed-url/:bucket/:path`: Generate temporary pre-signed URL. - `GET /v1/storage/download/:bucket/:path`: Direct object download. ## 5. Edge Functions Endpoints (`/v1/functions`) - `POST /v1/functions/:name/invoke`: Synchronous function execution. - `PUT /v1/functions/:name/env`: Manage AES-256-GCM encrypted secrets. ## 6. AI Gateway Endpoints (`/v1/ai`) - `POST /v1/ai/{project_id}/chat`: Synchronous multi-provider LLM chat completion. - `POST /v1/ai/{project_id}/chat/stream`: Live Server-Sent Events (SSE) token stream (`event: delta`, `done`). - `POST /v1/ai/{project_id}/session`: Mint an ephemeral capability token (300s TTL) with bounded token budget. - `POST /v1/ai/{project_id}/session/chat`: Chat completion under ephemeral capability (`Authorization: Bearer ` ONLY). - `POST /v1/ai/{project_id}/session/chat/stream`: Live streaming under ephemeral capability ticket. - `POST /v1/ai/{project_id}/session/embed`: Raw vector calculation under ephemeral capability ticket. - `POST /v1/ai/{project_id}/embed`: Calculate and persist embedding vector into PostgreSQL `embeddings` (pgvector 768, 1536, 3072). - `GET /v1/ai/{project_id}/search`: Vector semantic search (`?query=...&namespace=...&threshold=0.8&top_k=5`). - `POST /v1/ai/{project_id}/rag/query`: Context-augmented generation with relevant chunks synthesis. - `POST /v1/ai/{project_id}/rag/ingest`: Chunk and embed full documents (up to 5 MB payload limit). - `GET /v1/ai/{project_id}/rag/namespaces`: List all project RAG namespaces. - `DELETE /v1/ai/{project_id}/rag/{namespace}`: Purge all documents and embeddings of a namespace. - `POST /v1/ai/{project_id}/rag/{namespace}/reindex`: Recompute embeddings for a namespace on model change. - `POST /v1/ai/{project_id}/nl2sql`: Natural language to PostgreSQL (AST-checked, read-only SELECT, enforced LIMIT 100). - `GET /v1/ai/{project_id}/logs`: AI execution logs, latency profiling and token consumption audit. - `GET/PUT /v1/ai/{project_id}/settings`: Inspect or update project-wide default LLM provider and fallback policies. - `GET/POST/PATCH/DELETE /v1/ai/{project_id}/providers/{provider}`: Manage upstream credentials (Vault Transit encrypted). - `POST /v1/ai/{project_id}/providers/{provider}/validate`: Upstream credentials and model health check.