This guide will help you get Mi API BCV running locally in just a few minutes.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/MiguelNavas19/miapibcv/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, ensure you have the following installed:- PHP 8.2 or higher - Download PHP
- Composer - Install Composer
- SQLite extension enabled (or MySQL 5.7+ if preferred)
- Git - Install Git
The default configuration uses SQLite for simplicity. You can switch to MySQL or PostgreSQL later if needed.
Installation
Install dependencies
- Symfony DomCrawler for web scraping
- Laravel Sanctum for API authentication (optional)
Create the database
If you prefer MySQL or PostgreSQL, update the
DB_CONNECTION and related variables in your .env file before running migrations.Run migrations
reference_records- Stores exchange rate datacache- Stores cached API responsesjobs- Handles queue jobs if needed
Fetch initial exchange rates
Test Your Installation
Get all current rates
Get rates for a specific date and bank
Set Up Automatic Updates
To keep exchange rates updated automatically, set up the Laravel scheduler:- Linux/macOS
- Windows
Edit your crontab:Add this line:
The scheduler is configured to run the
rates:update command 11 times daily at specific hours (00:00, 00:30, 02:00, 03:00, 03:30, 04:00, 05:00, 05:30, 06:30, 07:00, 07:30) when bank websites typically update their rates.API Endpoints
The API provides two main endpoints:GET /
Returns current exchange rates from all banks for today. Parameters: None Response: JSON object with rates from all sourcesGET /info/{date}/{source?}
Returns exchange rates for a specific date, optionally filtered by bank. Parameters:date(required) - Date in YYYY-MM-DD formatsource(optional) - Bank identifier:bcv,banplus,bnc, orbdv
Next Steps
How It Works
Learn about the scraping architecture
Configuration
Customize environment variables
Deployment
Deploy to production
Data Sources
Understand the bank data sources
Troubleshooting
No rates returned (404 error)
No rates returned (404 error)
This means no exchange rates have been fetched yet. Run:
Scraping fails for a specific bank
Scraping fails for a specific bank
Some banks may temporarily block requests or change their website structure. Check the logs:The system is designed to continue working even if one bank fails.
Cache not working
Cache not working
Ensure your cache configuration is correct in Clear the cache if needed:
.env: