Skip to Content
APIAPI Reference

API

BiVelio exposes its functionality through Edge Functions deployed on Supabase. All requests require authentication and operate within the context of the user’s workspace.

Authentication

All API requests require a token in the Authorization header:

Authorization: Bearer <token>

Token types

TypeUsageHow to obtain
User JWTRequests from the frontend or external integrationsLogin via Supabase Auth
Service Role KeyInternal calls between Edge FunctionsProject environment variable

The user JWT includes the workspace org_id, which is used to filter all data returned by the API.

The Service Role Key has full database access. It must never be exposed in the frontend or shared with third parties.

Base URL

https://<project-ref>.supabase.co/functions/v1/<function-name>

Main endpoints

AI Agents

EndpointMethodDescription
agent-structuredPOSTExecutes an invocable agent with structured input
agent-runtimePOSTAutonomous agent execution runtime
agent-knowledge-ingestPOSTIngests documents into the knowledge base
agent-test-generatorPOSTGenerates tests to validate an agent
agent-test-runnerPOSTRuns agent validation tests

Communications

EndpointMethodDescription
email-classifierPOSTClassifies an email by category and urgency
email-draft-generatorPOSTGenerates a response draft for an email
conversation-routerPOSTRoutes conversations to the appropriate agent or operator
telegram-webhookPOSTWebhook for incoming Telegram messages
whatsapp-webhookPOSTWebhook for incoming WhatsApp messages
whatsapp-sendPOSTSends a message via the WhatsApp Business API

AI Generation

EndpointMethodDescription
ai-generate-specPOSTGenerates specifications, prompts, or documents with AI
ai-generate-formPOSTGenerates dynamic forms from a description
ai-generate-workflowPOSTGenerates BPM workflows from a description
ai-generate-io-schemaPOSTGenerates input/output schemas for agents
ai-data-classificationPOSTClassifies data according to defined categories
ai-smart-attachmentsPOSTProcesses attachments intelligently

Calendar and sync

EndpointMethodDescription
calendar-syncPOSTSyncs Google Calendar events to the system
calendar-cronPOSTRuns batch sync for all active connections
gmail-syncPOSTSyncs emails from Gmail
gmail-cronPOSTRuns Gmail batch sync
google-oauthPOSTOAuth flow to connect Google accounts

Workflows and automations

EndpointMethodDescription
workflow-enginePOSTExecutes a BPM workflow step by step
automation-enginePOSTEvaluates and executes automation rules
event-dispatcherPOSTDispatches system events to subscribed agents

Billing and payments

EndpointMethodDescription
create-checkoutPOSTCreates a Stripe checkout session
stripe-webhookPOSTWebhook for Stripe events
credit-enginePOSTManages the AI credit ledger
billing-reminder-aiPOSTGenerates payment reminders with AI
payment-receipt-ocrPOSTExtracts data from payment receipts via OCR
invoice-schedulerPOSTSchedules automatic invoice generation

Documents and extraction

EndpointMethodDescription
deed-extractorPOSTExtracts structured data from deeds
docx-tag-extractorPOSTExtracts tags from DOCX templates
document-requirement-checkerPOSTVerifies document requirements for a case
generate-minutaPOSTGenerates minutes from templates

MCP (external integrations)

EndpointMethodDescription
mcp-tool-callPOSTExecutes an MCP action on an external provider

Fernando (executive assistant)

EndpointMethodDescription
fernando-bridgePOSTCommunication bridge with the Fernando VPS
fernando-memoryPOSTMemory operations (search, extract, summarize)

Request format

All requests use JSON:

{ "action": "action_name", "data": { "field1": "value1", "field2": "value2" } }

Response format

Successful responses:

{ "success": true, "data": { ... } }

Error responses:

{ "success": false, "error": "Error description" }

AI model

BiVelio uses Google Gemini (Gemini 2.5 Flash) as the primary model for AI operations. Requests to Gemini are made from the Edge Functions, never from the frontend.

Rate limiting

Edge Functions operate within Supabase limits:

  • Default timeout: 60 seconds (extendable per function)
  • Concurrency managed automatically by the runtime

Common errors

CodeMeaning
401Invalid or expired token
403Insufficient permissions for this operation, or agent inactive
404Resource not found
422Invalid input data
429Request rate limit exceeded
500Internal server error
Last updated on