# OWID API — Our World in Data Indicators (`galih_rakasiwi/owid-api`) Actor

Stateless FastAPI proxy for Our World In Data. Query global indicators (population, GDP, CO2, life expectancy) as clean JSON or CSV. Backed by the Pipeworx OWID MCP Gateway. No database, no caching, no persistence.

- **URL**: https://apify.com/galih_rakasiwi/owid-api.md
- **Developed by:** [RD.Galih Rakasiwi](https://apify.com/galih_rakasiwi) (community)
- **Categories:** Developer tools, Open source
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.20 / 1,000 api requests

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Our World In Data (OWID) Global Indicators & Insights API

High-performance, stateless REST API proxy for **Our World In Data** — query global indicators across demographics, climate, economy, public health, energy, and education as clean JSON or CSV. Ready for data scientists, academic researchers, journalists, and **AI/LLM agents** needing factual macro-environmental and socio-economic data.

Backed by the [Pipeworx OWID MCP Gateway](https://gateway.pipeworx.io/owid/mcp) — no database, no caching, no persistence.

### Why use OWID API?

- **37 curated popular indicators** across 10 categories — population, GDP, CO₂ emissions, life expectancy, and more
- **Time-series data for 200+ countries and regions** with parameters for entity, year range, and format
- **JSON and CSV output** — stream large datasets directly as CSV without memory pressure
- **Full Data Insights from OWID's feed** — chart images, body text, CTA links, related chart references
- **No API key required** — the upstream OWID data is public and open
- **Apify-native** — deploy in one click, auto-scaling, with scheduling, API access, and webhook integrations
- **LLM & RAG ready** — clean structured payloads for AI agent tools, function calling, and RAG pipelines

### What data can OWID API provide?

| Category       | Example indicators                                    | Data points |
|----------------|-------------------------------------------------------|-------------|
| Climate        | CO₂ emissions, methane, temperature anomalies         | ~60+ years  |
| Demographics   | Population, fertility rate, median age                 | Centuries   |
| Economy        | GDP per capita, inflation, government debt             | ~60+ years  |
| Energy         | Electricity mix, fossil fuel consumption, renewables   | ~60+ years  |
| Health         | Life expectancy, child mortality, COVID vaccinations   | ~60+ years  |
| Education      | Literacy rate, years of schooling                      | Decades     |
| Food           | Cereal yields, fertilizer use, food supply              | ~60+ years  |
| Environment    | Forest area, biodiversity, protected areas              | Decades     |
| Politics       | Women in parliament, trust in government               | Decades     |
| Tech           | Internet users, mobile phones                           | Decades     |

#### Sample output

`GET /api/v1/indicators/gdp-per-capita-worldbank/data?entity=Indonesia&since_year=2015`

```json
{
  "data": [
    { "entity": "Indonesia", "year": 2015, "value": 10992.73 },
    { "entity": "Indonesia", "year": 2016, "value": 11382.53 },
    { "entity": "Indonesia", "year": 2017, "value": 11819.33 }
  ],
  "pagination": { "cursor": null, "limit": 100, "has_more": false }
}
```

CSV output (`?format=csv`):

```
entity,year,value
Indonesia,2015,10992.73
Indonesia,2016,11382.53
Indonesia,2017,11819.33
```

### How to use OWID API

#### 1. Run the Actor

Click **Start** in Apify Console. The Actor starts a FastAPI server on the configured port.

#### 2. Access the API

Once running, the API is available at the Actor's container URL:

```
https://<container-id>.runs.apify.net/api/v1/
```

#### 3. Browse available indicators

```bash
## List all curated indicators
curl https://<container-id>.runs.apify.net/api/v1/indicators/popular

## Search for an indicator
curl "https://<container-id>.runs.apify.net/api/v1/indicators/search?q=gdp"

## Browse by topic
curl https://<container-id>.runs.apify.net/api/v1/topics
```

#### 4. Fetch data

```bash
## Get indicator metadata and data
curl "https://<container-id>.runs.apify.net/api/v1/indicators/population?include_data=true"

## Filter by country and year range
curl "https://<container-id>.runs.apify.net/api/v1/indicators/co2-emissions/data?entity=World&since_year=2000&format=csv"

## Get data insights
curl "https://<container-id>.runs.apify.net/api/v1/insights?limit=5"
```

#### 5. Explore with OpenAPI docs

Open `/docs` in your browser for interactive Swagger UI — try every endpoint without writing code.

### How much does it cost to use OWID API?

The Actor runs as a lightweight web server. **Compute unit consumption** is proportional to how long the server stays running and how many requests it handles.

- **Minimal memory**: 256 MB
- **Small footprint**: single Python process, ~70 MB RAM idle
- **No storage costs**: stateless proxy — zero disk, zero database
- **Rate limited upstream**: the Pipeworx MCP Gateway allows ~50 requests/hour; budget your API calls accordingly

For long-running API access, schedule the Actor to run continuously. For ad-hoc queries, run on demand.

### Input

The Actor starts a configurable HTTP API server. Full input schema is available in the **Input** tab in Apify Console.

| Field               | Type    | Default | Description                                             |
|---------------------|---------|---------|---------------------------------------------------------|
| `apiPort`           | integer | 8000    | Port the API server listens on (1024–65535)             |
| `docsEnabled`       | boolean | true    | Whether to expose `/docs` (Swagger UI) and `/redoc`     |

### Output

The Actor provides a **live REST API** at the container URL. Every response carries:

- `X-Request-ID` — unique request identifier (UUIDv4)
- `X-Response-Time-Ms` — server-side latency in milliseconds

The full API contract — all routes, parameters, response schemas, and error codes — is in [docs/api-contract.md](docs/api-contract.md).

#### Output schema

The Actor's output is the API itself, accessible at:

```
https://<container-id>.runs.apify.net/
```

| Output      | Description                              |
|-------------|------------------------------------------|
| **API**     | Live REST API at `{{run.containerUrl}}`  |

Interactive **OpenAPI docs** are at `/docs` and `/redoc` when `docsEnabled` is set to `true`.

### API endpoints summary

| Endpoint                                | Description                                      |
|-----------------------------------------|--------------------------------------------------|
| `GET /api/v1/health`                    | Health check — MCP gateway + search API probes    |
| `GET /api/v1/meta`                      | API metadata and timestamp                        |
| `GET /api/v1/stats`                     | Available endpoints listing                       |
| `GET /api/v1/topics`                    | List 10 indicator categories                      |
| `GET /api/v1/topics/{slug}`             | Single category with indicator count              |
| `GET /api/v1/topics/{slug}/indicators`  | Indicators under a category                       |
| `GET /api/v1/indicators/popular`        | 37 curated popular indicators                     |
| `GET /api/v1/indicators/search?q=`      | Search OWID indicator catalog                     |
| `GET /api/v1/indicators/{slug}`         | Indicator metadata + optional time-series data     |
| `GET /api/v1/indicators/{slug}/data`    | Time-series data — JSON or CSV                     |
| `GET /api/v1/indicators/{slug}/entities`| Distinct countries/regions for an indicator        |
| `GET /api/v1/indicators/{slug}/years`   | Year range for an indicator                        |
| `GET /api/v1/insights`                  | Data insights with charts, text, related links     |
| `GET /api/v1/insights/{slug}`           | Single insight by URL slug                         |
| `GET /api/v1/search?q=`                 | Global indicator search                            |

Full contract with request/response schemas, field types, and examples: [docs/api-contract.md](docs/api-contract.md).

### Tips

- **Use `include_data=false`** on `/indicators/{slug}` when you only need metadata — saves a second upstream MCP call
- **Prefer CSV for large datasets** — `?format=csv` streams directly without holding all rows in memory
- **Use entity filters** — narrow `/indicators/{slug}/data` with `?entity=Indonesia` to avoid fetching unnecessary rows
- **Rate-limit awareness** — the upstream MCP gateway is capped at ~50 req/hour; plan your request volume accordingly
- **Watch `X-Response-Time-Ms`** — MCP calls typically take 300–800ms; OWID search API ~90ms

### FAQ

#### Do I need an API key?

No. The upstream OWID data is public. The Pipeworx MCP Gateway does not require authentication.

#### What's the difference between `/indicators/search` and `/search`?

`/indicators/search` returns Pydantic-validated schema objects with `indicator_id`, `title`, `catalog_path`, and `score`. `/search` mirrors the raw OWID search API response shape. Use either — same underlying data.

#### Why does the API return 502 sometimes?

502 means the upstream MCP gateway returned an error or the indicator slug wasn't found. This can also happen when the MCP rate limit (50 req/hour) is exceeded.

#### Can I use this API with LLM function calling?

Yes. The `/stats` endpoint lists all available routes, and `/openapi.json` provides a full OpenAPI 3.1 spec suitable for tool registration in frameworks like LangChain, CrewAI, or custom function-calling agents.

#### Where is the full API documentation?

See [docs/api-contract.md](docs/api-contract.md) for every endpoint, query parameter, response field, error code, and schema reference.

### Source and acknowledgements

All data originates from **[Our World In Data](https://ourworldindata.org)** — a scientific online publication making research and data on global problems accessible to everyone. Data is proxied via the [Pipeworx OWID MCP Gateway](https://gateway.pipeworx.io/owid/mcp).

This Actor does **not** scrape, cache, or store any OWID data. It is a stateless proxy — every request fetches fresh data from upstream.

***

*Feedback? Open an issue in the Issues tab. For programmatic access, see the API tab.*

### Related searches

owid api, our world in data api, global indicators api, co2 emissions data, life expectancy data, population data api, world statistics

# Actor input Schema

## `apiPort` (type: `integer`):

Port the API server listens on.

## `docsEnabled` (type: `boolean`):

Whether to expose /docs (Swagger UI) and /redoc. Disable in production to reduce attack surface.

## Actor input object example

```json
{
  "apiPort": 8000,
  "docsEnabled": true
}
```

# Actor output Schema

## `api` (type: `string`):

Base URL of the running OWID API proxy. Append /api/v1/... to call endpoints.

## `openapi` (type: `string`):

Full OpenAPI 3.1 specification — use this to register the API as an LLM tool.

## `swagger` (type: `string`):

Interactive API documentation — try every endpoint directly in the browser.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("galih_rakasiwi/owid-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("galih_rakasiwi/owid-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call galih_rakasiwi/owid-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,galih_rakasiwi/owid-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/M0JX297B0zuUk3Hu5/builds/MOMrEMXt5AhxOlDcX/openapi.json
