APIs
APIs (Application Programming Interfaces) let you retrieve data from a provider programmatically. The list of domains where APIs give you access to interesting data is essentially endless:
- Weather — OpenWeatherMap
- Finance — Alpha Vantage, Yahoo Finance
- Social media — Twitter/X, Facebook, Instagram, Strava
- Science — NASA's Open Data Portal (satellite imagery, astronomy)
- Health — CDC
- Commerce — Amazon, eBay
- Sports — ESPN, Sportradar
- Government — census, crime statistics, transportation
Advantages
- Structured data. APIs return data in a standardized, machine-readable format — no scraping HTML, no parsing PDFs.
- Programmatic retrieval. Pull data automatically on whatever schedule you need.
- Reliability and freshness. Reputable APIs are often reliable and up to date.
Limitations
- Usage limits and paywalls. Most APIs throttle free use and charge for premium tiers. Plan your queries carefully!
- Access limits. APIs only expose what the provider chose to expose. The data you want might simply not be available.
- Technical complexity. Every API has its own authentication scheme, its own quirks, and its own documentation quality. There is no shortcut — read the docs.
Current weather by city name. Free tier: 1,000 calls/day.
Key is appended as ?appid=…
import requests
params = {
"q": "Durham,NC,US",
"units": "imperial"
}
response = requests.get("https://api.openweathermap.org/data/2.5/weather", params=params)
data = response.json()API request builder showing authentication, endpoint construction, and response parsing.
Most Data Products Are API Pipelines
A flight-comparison site calls airline APIs. A weather app calls a weather API. A trading platform calls market data APIs. A logistics dashboard calls shipping APIs. As a data scientist, you will likely spend time architecting and/or writing code that talks to someone else's API and processing what comes back.
You're building a dataset of historical stock prices using a financial API. You notice the API returns data in JSON with fields you don't recognize. What should you do first?