Open Government, Spain API

Free to Use Varies (check documentation)
90 A+
Measured Score 0 50 100 Reachability 30/30 Speed 10/20 Security 15/15 Developer XP 20/20 Reliability 15/15 TESTED 2026-07-23

Overview

The Spain Open Government Data API (datos.gob.es) exposes thousands of datasets from Spanish public institutions including statistics, geography, and public services. It follows the DCAT-AP standard and requires no authentication, making it easy to query with a simple HTTP request. Perfect for exploring Spanish civic data or building data journalism tools.

Beginner Tip

Use the /api/action/package_search endpoint with the q parameter to search by keyword, or browse datos.gob.es to find specific dataset IDs before fetching them via the API.

Available Data

Use case: Integrate spain government open data data into web and mobile applications
Open Government, Spain data via REST API

Example Response

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

Field Reference

result List of dataset entries matching the search or browse query
result[].title Human-readable title of the dataset in Spanish
result[].identifier Unique identifier for the dataset used in API lookups
result[].distribution Download links and format info for the dataset files
result[].publisher The government entity that published the dataset

Implementation Example

Request
const url = "https://datos.gob.es/en";
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

SSL handshake error Some older client libraries have trouble with the certificate chain on datos.gob.es
Update your HTTP client library or add the --cacert flag to curl pointing to an updated CA bundle
Unexpected encoding in response text Some dataset fields contain special Spanish characters and are UTF-8 encoded
Always decode responses with UTF-8 in Python or set Accept-Charset utf-8 in your header
No datasets returned for keyword Search terms are matched against Spanish-language metadata
Use Spanish keywords (e.g., presupuesto instead of budget) for better search results

Measured Score Breakdown

Live HTTP request to the API endpoint

Reachability 30/30
Speed 10/20
Security 15/15
Developer XP 20/20
Reliability 15/15
Endpoint Response Time 821ms

Fully tested on Jul 23, 2026

Technical Specifications

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

Similar APIs

View All →