Rainbow a2b0db8f3f feat: tiered API plans (Free/Bronze/Gold/Platinum)
- Free: $0, 30 req/min, market data only
- Bronze: $29/mo, 100 req/min, + companies & search
- Gold: $99/mo, 500 req/min, + filings & historical
- Platinum: $299/mo, 2000 req/min, all features + priority
- Plan-aware rate limiting per API key (or per IP for free)
- Usage tracking with daily aggregation
- GET /api/v1/plans — plan listing
- POST /api/v1/plans/register — instant free API key
- GET /api/v1/plans/usage — usage stats
- /pricing — dark-themed HTML pricing page
- X-RateLimit-* and X-Plan headers on every response
- Restricted endpoints return upgrade prompt
- Updated OpenAPI spec with security scheme
- 53 handlers, compiles clean
2026-02-10 12:55:45 -03:00

Sentinela 🇧🇷

Brazilian Financial Data API — serves market data from BCB and CVM public sources.

Quick Start

# Build and run (seeds data automatically on first run)
make run

# Or directly
go run ./cmd/sentinela

The API starts on http://localhost:3333. On first run, it automatically fetches:

  • BCB: Selic, CDI, IPCA, USD/BRL, EUR/BRL (last ~3 years)
  • CVM: Company registry + IPE filings (current + previous year)

API Documentation

Visit /docs for interactive Swagger UI with full endpoint documentation.

The OpenAPI 3.0 spec is also available at /docs/openapi.yaml.

Endpoints

Endpoint Description
GET /health Health check
GET /api/v1/companies List companies
GET /api/v1/companies/search?q=petrobras Search companies
GET /api/v1/companies/:id Get company
GET /api/v1/companies/:id/filings Company filings
GET /api/v1/filings List filings
GET /api/v1/filings/recent Recent filings
GET /api/v1/filings/search?q=dividendo Search filings
GET /api/v1/market/selic Selic history
GET /api/v1/market/selic/current Current Selic
GET /api/v1/market/cdi CDI history
GET /api/v1/market/cdi/current Current CDI
GET /api/v1/market/ipca IPCA history
GET /api/v1/market/ipca/current Current IPCA
GET /api/v1/market/fx FX rates
GET /api/v1/market/fx/current Current FX
GET /api/v1/market/overview Market dashboard
GET /api/v1/search?q=vale Global search

Configuration

Set via environment variables (see .env.example):

  • PORT — HTTP port (default: 3333)
  • DATABASE_PATH — SQLite path (default: data/sentinela.db)
  • RATE_LIMIT — Requests per minute per IP (default: 100)
  • API_KEY — Optional API key (if set, all requests need it via X-API-Key header)
  • SYNC_INTERVAL — Auto-refresh interval (default: 30m)
  • LOG_LEVEL — info or debug

Tech Stack

  • Go 1.22+
  • Fiber v2 (HTTP)
  • SQLite via modernc.org/sqlite (pure Go, no CGO)
  • FTS5 full-text search
Description
Brazilian Financial Data API — Go + SQLite + FTS5
Readme 40 MiB
Languages
Go 99.7%
Makefile 0.3%