Base URL
All API requests are sent to a single endpoint on your Supabase project:POST method with a JSON body that specifies the resource, action, and any required parameters.
Authentication
Include a Supabase session access token in theAuthorization header of every request.
401 UNAUTHORIZED error.
Request format
All requests share the same shape:The API resource to operate on. One of
genies, documents, document-folders, or genie-groups.The action to perform on the resource (for example
list, get, create, update, delete).The resource identifier, required for actions that target a specific record such as
get, update, and delete.Action-specific parameters such as filters, pagination options, or field values.
Response envelope
Every response follows a consistent envelope. Success (2xx):Error codes
| Code | Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Missing or invalid Authorization header |
INVALID_TOKEN | 401 | Token is invalid or expired |
FORBIDDEN | 403 | User lacks permission for the resource |
NOT_FOUND | 404 | Resource not found |
AGENT_NOT_FOUND | 404 | Genie not found or access denied |
VALIDATION_ERROR | 400 | Invalid request format or data |
INVALID_ACTION | 400 | Action not supported for the resource |
RATE_LIMIT_EXCEEDED | 429 | Too many requests |
INTERNAL_ERROR | 500 | Server error |
Access control
User roles determine what data is accessible:- internal_admin — Full access to all resources across all users.
- standard_user — Access only to their own genies, documents, and related data.
- consumer — Limited read-only access to assigned genies.
adminMode: true or a userId parameter to operate on resources owned by other users.

