Introduction
The Blnk API is a comprehensive REST API designed for managing ledgers, balances, transactions, and financial operations. Built with high performance and reliability in mind, it provides a complete double-entry accounting system with advanced features like real-time balance monitoring, reconciliation, and search capabilities.Base URL
The API runs on a configurable port (default: 5001):localhost with your server’s domain.
API Architecture
The Blnk API follows RESTful principles:- Resource-based URLs: Each endpoint represents a specific resource (ledgers, balances, transactions, etc.)
- HTTP methods: Standard methods (GET, POST, PUT, DELETE) for CRUD operations
- JSON format: All requests and responses use JSON
- Stateless: Each request contains all information needed for processing
Request Format
All API requests must include:Set to
application/json for all requests with body contentYour API key or master key for authentication (when secure mode is enabled)
Example Request
Response Format
All API responses are returned in JSON format with appropriate HTTP status codes.Success Response
Error Response
Errors return a JSON object with anerror field:
Rate Limiting
The Blnk API implements rate limiting to ensure fair usage and system stability.Maximum requests per second allowed
Maximum burst capacity for handling traffic spikes
Rate Limit Headers
When rate limiting is active, responses include:- Rate limit information is managed server-side
- Exceeded limits return HTTP 429 (Too Many Requests)
- The cleanup interval for rate limit data is 10800 seconds (3 hours) by default
Configuration
Rate limits can be configured via environment variables:Pagination
Endpoints that return lists support pagination using query parameters:Number of records to return (minimum: 1)
Number of records to skip (minimum: 0)
Example
Filtering
Many endpoints support advanced filtering through query parameters or request body.Query Parameter Filters
Use the formatfield_operator=value:
eq: Equal tone: Not equal togt: Greater thangte: Greater than or equal tolt: Less thanlte: Less than or equal toin: In list (comma-separated)ilike: Case-insensitive pattern match (use%as wildcard)
POST Filter Endpoints
For complex filters, use dedicated filter endpoints:API Resources
The Blnk API provides the following core resources:Ledgers
Manage top-level ledger containers for organizing balances.Balances
Track account balances with multi-currency support and real-time updates.Transactions
Record and process double-entry financial transactions.Identities
Store customer/entity information with tokenization support.Accounts
Manage account records linked to balances.API Keys
Manage authentication keys with granular permissions.Additional Features
- Search: Full-text search across resources using Typesense
- Reconciliation: Match and reconcile internal vs external data
- Webhooks: Configure event notifications
- Backup: Database backup to local storage or S3
Getting Started
1. Set Up Authentication
First, configure your master key or create an API key:2. Create a Ledger
3. Create a Balance
4. Record a Transaction
precision field (100) indicates the actual amount is $100.00.
Security
- Secure Mode: Enable authentication by setting
BLNK_SERVER_SECURE=true - TLS/SSL: Configure SSL for production deployments
- API Key Scopes: Limit access to specific resources and actions
- Master Key: Full access key for administrative operations
Observability
Blnk provides built-in observability features:Support
For issues and questions:- GitHub: github.com/blnkfinance/blnk
- Documentation: Explore the sidebar for detailed endpoint documentation