Skip to content

API Reference

The Mako API is a RESTful API built with Hono. All endpoints are prefixed with /api.

MethodEndpointDescription
POST/api/auth/loginLogin with email/password
POST/api/auth/registerCreate a new account
GET/api/auth/meGet current user session
POST/api/auth/logoutEnd session
MethodEndpointDescription
GET/api/workspacesList user workspaces
POST/api/workspacesCreate a workspace
GET/api/workspaces/:idGet workspace details
MethodEndpointDescription
GET/api/workspaces/:wid/connectorsList configured data sources
POST/api/workspaces/:wid/connectorsAdd a new data source
POST/api/workspaces/:wid/flowsTrigger a flow
GET/api/workspaces/:wid/flows/:fidGet flow status
MethodEndpointDescription
POST/api/executeExecute a SQL/NoSQL query

The Chat API enables programmatic access to Mako’s AI agent. It supports both session-based and API key authentication.

MethodEndpointDescription
POST/api/agent/chatSend messages and receive streaming AI response
GET/api/agent/modelsList available AI models
GET/api/agent/agentsList available agent modes

Use an API key in the Authorization header:

Authorization: Bearer revops_YOUR_API_KEY

API keys are created in Settings → API Keys. Each key is scoped to a workspace. Chats created via API key are attributed to the key’s creator, so they appear in the creator’s chat history.

FieldTypeRequiredDescription
messagesUIMessage[]YesArray of messages. Each has id, role, and parts.
chatIdstringYes24-char MongoDB ObjectId. New ID for new chats; reuse for follow-ups.
workspaceIdstringYes24-char MongoDB ObjectId. Must match the API key’s workspace.
modelIdstringNoModel ID (e.g. gpt-5.2, gemini-2.5-flash). Default: gpt-5.2.
openConsolesobject[]NoConsole context for SQL tools.
consoleIdstringNoActive console ID.
agentIdstringNoAgent mode: console (default) or flow.
{
"id": "unique-id",
"role": "user",
"parts": [{ "type": "text", "text": "Your message here" }]
}
Terminal window
curl -X POST https://your-mako.com/api/agent/chat \
-H "Authorization: Bearer revops_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [{
"id": "1",
"role": "user",
"parts": [{ "type": "text", "text": "Show top 5 customers" }]
}],
"chatId": "507f1f77bcf86cd799439011",
"workspaceId": "YOUR_WORKSPACE_ID",
"modelId": "gemini-2.5-flash"
}'

The response is a streaming SSE (Server-Sent Events) stream. Key event types:

Event TypeDescription
startStream started. Contains messageId.
text-deltaIncremental text chunk from the assistant.
tool-input-availableTool call with full input (e.g. SQL query).
tool-resultTool execution result (e.g. query results).
finishStream finished. Contains finishReason.
StatusDescription
400Missing or invalid messages, chatId, or workspaceId.
401Unauthorized (missing or invalid API key).
403API key not authorized for the workspace.
404Agent not found (invalid agentId).

For full details, see CHAT_API_REFERENCE.md.

MethodEndpointDescription
GET/api/workspaces/:wid/chatsList chat sessions
POST/api/workspaces/:wid/chatsCreate a new chat
GET/api/workspaces/:wid/chats/:idGet chat details
PUT/api/workspaces/:wid/chats/:idUpdate chat title
DELETE/api/workspaces/:wid/chats/:idDelete a chat

For executing saved consoles programmatically, see CONSOLE_API_DOCUMENTATION.md.

MethodEndpointDescription
POST/api/inngestInngest webhook handler