⚠️ ImportantLibreCourseUY is an open source, independent and community-driven software project. The tools, features and resources available on this platform including "UruAPI" were created and maintained by members, contributors and collaborators of LibreCourseUY.
The "UruAPI" tool is not affiliated with, associated with, sponsored by, endorsed by, authorized by, or supported by datosuruguay.com or any institution or organization, including but not limited to the Central Bank of Uruguay (BCU), the National Statistics Institute (INE) and the Social Security Bank (BPS).
Any reference to names, acronyms, trademarks, sources or institutions is used solely for descriptive and informational purposes, and does not imply any institutional relationship, approval or official status.
The software and associated content are provided "AS IS", without warranties of any kind. The data may contain errors, delays or inaccuracies; it must not be used as an official source. Use of this project is at your own risk.
By continuing, you acknowledge and accept these terms, and that any interpretation of officiality is incorrect.
Welcome to UruAPI! An API that wraps datosuruguay.com, giving programmatic access to Uruguay's daily economic indicators.
UruAPI is a wrapper around datosuruguay.com and exposes Uruguay's daily-updated economic indicators in a clean, JSON-friendly format.
All data originates from official sources_ the Central Bank of Uruguay (BCU), the National Statistics Institute (INE), and the Social Security Bank (BPS). See the full list in the datosuruguay.com methodology.
- Exchange rates: USD, EUR, BRL, ARS
- Price indices: Inflation (IPC) and Unidad Indexada (UI)
- Fuel & transport: ANCAP fuel, Montevideo transit (STM), tolls
- Social security: BPS indices, pensions, family allowances
- Language: Python 3.11 or higher
- Framework: FastAPI
- Dependency Management: uv
-
Enter the project folder:
cd UruAPI -
Install dependencies with uv:
uv sync
-
Run the development server:
uv run uvicorn app.main:app --reload --port 8083
Once the server is running, you can view the automatic documentation at:
- Swagger UI:
http://localhost:8083/docs
-
Build and start the container:
docker compose up --build
-
Stop the container:
docker compose down
The API will be available at http://localhost:8083.
UruAPI/
├── app/ # Main application package
│ ├── main.py # FastAPI entry point
│ ├── config.py # Settings (cache backend, Redis URL, ...)
│ ├── threading.py # Async helpers for thread offloading
│ ├── cache/ # Cache backends (in-memory / Redis)
│ ├── routers/ # API route modules
│ ├── schemas/ # Request/response schemas
│ ├── services/ # Service layer package
│ ├── scrappers/ # Scraper package
│ └── utils/ # Shared utilities and scraping helpers
├── pyproject.toml # Project metadata & dependencies
├── README.md
└── uv.lock # Dependency lockfile
To avoid hammering the upstream source, endpoints should cache their results. A cache service is injected into any route via the CacheDep dependency, which exposes
two async methods:
get_from_cache(key)— returns the cached value, orNoneif missing/expired.add_to_cache(key, value, ttl)— storesvalueunderkeyforttlseconds.
A typical "check cache, otherwise fetch and store" flow looks like this:
from fastapi import APIRouter
from app.cache import CacheDep
router = APIRouter()
@router.get("/")
async def get_dolar(cache_store: CacheDep):
# 1. Try the cache first.
value = await cache_store.get_from_cache("dolar")
if value is not None:
return {"dolar": value}
# 2. Cache miss: fetch the fresh value (e.g. from a service).
value = await fetch_dolar_value()
# 3. Store it so the next request is served from cache (ttl in seconds).
await cache_store.add_to_cache("dolar", value, ttl=86400)
return {"dolar": value}Note: the
ttlis automatically capped so an entry never outlives the daily data reset (00:00 UTC-3), no matter how large a value you pass.
Want to add a new endpoint or improve an existing one? Great!
Check out our contribution guide in CONTRIBUTING.md for step-by-step instructions.
When committing, follow Conventional Commits.
MIT license - See LICENSE for details.
Never used FastAPI before? Don't worry, it's a very accessible framework, and one of the best documented. You can learn the basics in the official FastAPI documentation.