Back to Home|
Developer Documentation
Architecture Overview

FinLedger Developer Platform & Integration Guide

Connect external applications, LLM agents, Claude Desktop, Cursor IDE, or custom webhooks to your hosted FinLedger Financial OS (finledger.co.in). All client connections use secure versioned API keys (`sk_live_...`) with zero database credentials exposed.

Hosted MCP Endpoint
/api/v1/mcp/sse
REST API Base
/api/v1
Webhook Signatures
HMAC SHA-256

2. Hosted Model Context Protocol (MCP) Server

Expose your financial tools (`get_spending_by_category`, `get_net_worth`, `check_budget_status`, `get_rest_money`, `add_transaction`, `compare_monthly_performance`) to Claude Desktop, Cursor, or any MCP client via Server-Sent Events (SSE).

Claude Desktop Config (`claude_desktop_config.json`)
{
  "mcpServers": {
    "finledger": {
      "url": "https://api.finledger.co.in/api/v1/mcp/sse",
      "headers": {
        "Authorization": "Bearer sk_live_your_api_key_here"
      }
    }
  }
}
Direct JSON-RPC Request (`POST /api/v1/mcp`)
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_rest_money",
    "arguments": {}
  }
}

3. API Keys & Authentication

Generate versioned API keys under Settings > Developer API & Webhooks in the web dashboard. Pass your key in the `Authorization` HTTP header:

Create an Account to Generate API Keys

API keys (sk_live_...) are tied to your account. Sign up free to get your first key and start integrating.

Create Free Account →

4. HMAC SHA-256 Webhook Verification

Ledger dispatches real-time webhooks for `transaction.created`, `budget.exceeded`, and `goal.completed`. Each HTTP POST contains an `X-Ledger-Signature` header signed with your webhook secret.

Python Webhook Signature Verification
import hmac
import hashlib

def verify_ledger_webhook(payload_bytes: bytes, signature_header: str, secret: str) -> bool:
    expected_sig = hmac.new(
        secret.encode('utf-8'),
        payload_bytes,
        hashlib.sha256
    ).hexdigest()
    return hmac.compare_digest(f"sha256={expected_sig}", signature_header)

5. Telegram Bot Webhook & Code Linking

Connect a user's whole application account in 1 step — no account selection. Generate a 6-character linking code via `POST /api/integrations/telegram/connect` and send `/link YOURCODE` in Telegram.

Webhook Setup Endpoint:
POST https://api.finledger.co.in/webhooks/telegram/setup-bot

Registers 11 native commands (`/start`, `/report`, `/compare`, `/networth`, `/restmoney`, `/budgets`, `/bills`), bot name, and bio metadata.

6. LangGraph Multi-Agent Architecture & Benchmark Evals

FinLedger uses the Orchestra pattern (`GuardrailNode` > `CategorizerAgent` > `QueryResolutionAgent` > `InsightAdvisorAgent`) with automatic multi-provider failover (Groq, Ollama, NVIDIA, Gemini, Rule Engine).

Agent Benchmark Verification Metrics
Overall Accuracy
100.0%
Injection Defense
100.0%