Open Government, Mexico API

Free to Use Varies (check documentation)

Overview

The Open Government Mexico (datos.gob.mx) API provides access to thousands of datasets published by Mexican federal government agencies, covering topics such as health, education, security, and infrastructure. No API key is needed — the portal uses a CKAN-compatible API that works with simple GET requests. It complements the INEGI statistical API by offering a broader catalog of raw government datasets.

💡

Beginner Tip

Search for datasets using https://datos.gob.mx/busca/api/3/action/package_search?q=salud to find health-related data. Each dataset entry includes a resources array with direct download links or sub-API endpoints you can query for the actual records.

Available Data

Use case: Integrate mexico government open data data into web and mobile applications
Open Government, Mexico data via REST API
JSON-formatted response data
Freely accessible without authentication

Example Response

JSON Response
{
  "status": "success",
  "data": {
    "result": "Data from Open Government, Mexico",
    "description": "Mexico Government Open Data",
    "timestamp": "2025-01-15T10:00:00Z"
  }
}

Field Reference

success Whether the API request was handled successfully
result.count Total number of datasets matching the search term
result.results[].title Display name of the dataset in Spanish
result.results[].organization Mexican government agency that published the dataset
result.results[].resources List of files and endpoints available for the dataset
result.results[].tags Classification keywords to help discover and filter the dataset

Implementation Example

const url = "https://datos.gob.mx/";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

result.results is an empty array The Spanish search keyword does not match any indexed dataset title or tag
Try common Spanish government terms like educacion, salud, or seguridad and browse portal categories to discover valid dataset names
Resource file returns CSV instead of JSON Most datos.gob.mx resources are distributed as CSV or Excel files, not JSON APIs
Download the CSV and parse it locally, or check if the dataset has a datastore-enabled JSON endpoint in the resource format field
Slow response or timeout Large datasets can take many seconds to return over government infrastructure
Add rows=10 to limit results per page and paginate using the start parameter rather than requesting all records at once

Matrix Score Breakdown

🌐 Reachability 0/30
⚡ Speed 5/20
🔒 Security 15/15
🛠 Developer XP 15/20
✓ Reliability 7/15
Response Time 2570ms

Fully tested on Apr 5, 2026

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS UNKNOWN
Category Government
Difficulty Beginner
Verified: 2026-04-07

Similar APIs

View All →