BYTETOOLS

datos.gob.es API

Free Spanish government open data API with no key: a Linked Data API over the national catalogue, with EU frequency vocabularies and multi-value description arrays. Tested example.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 2026-08-21

What is the datos.gob.es API?

datos.gob.es exposes Spain's national open data catalogue through apidata, a Linked Data API rather than CKAN or Socrata. It needs no key, returns each dataset as an RDF resource with an `_about` URI, and records update frequency using EU Publications Office vocabulary URIs.

Spain took the semantic-web route where most countries took the portal-software route, and the response shape reflects that. Everything is an addressable resource: the result envelope has an `_about` URI, a `definition` URI pointing at the metadata schema, and `isPartOf` describing the list endpoint itself as a `ListEndpoint`. Individual datasets are identified by their catalogue URI rather than a UUID, so `_about` is your stable key.

The practical consequence is that literal values are wrapped. A description is not a string — it is an array of objects each with `_value` and usually a language tag, because a dataset can carry Spanish, Catalan, Basque and Galician descriptions side by side. Code that reads `description` directly gets an array. `accrualPeriodicity` is likewise a URI into the EU frequency authority list, not a word, and values such as `OP_DATPRO` mean provisional rather than a real cadence. Pagination uses `_page` and `_pageSize` rather than offset arithmetic.

Quick facts

Base URL
https://datos.gob.es/apidata
Authentication
No API key. Content negotiation is supported — append `.json`, `.xml`, `.rdf` or `.ttl` to change format.
Rate limit
No published limit. Page sizes are capped, so paginate rather than requesting huge pages.
Pricing
Free. Datasets are typically under the Spanish reuse licence, which permits commercial use with attribution.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the datos.gob.es API

Every request below was executed against the live API on 2026-08-21, and the response shown is the real body it returned — not an illustration.

1. List datasets in the Spanish national catalogue

GET https://datos.gob.es/apidata/catalog/dataset?_pageSize=1&_page=0

curl
curl 'https://datos.gob.es/apidata/catalog/dataset?_pageSize=1&_page=0'
JavaScript (fetch)
const res = await fetch("https://datos.gob.es/apidata/catalog/dataset?_pageSize=1&_page=0");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://datos.gob.es/apidata/catalog/dataset?_pageSize=1&_page=0", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200 (truncated)
{
  "format": "linked-data-api",
  "version": "0.2",
  "result": {
    "_about": "http://datos.gob.es/apidata/catalog/dataset.json?_pageSize=1&_page=0",
    "definition": "http://datos.gob.es/apidata/catalog/meta/dataset.json",
    "extendedMetadataVersion": "http://datos.gob.es/apidata/catalog/dataset.json?_pageSize=1&_page=0&_metadata=all",
    "first": "http://datos.gob.es/apidata/catalog/dataset.json?_page=0",
    "isPartOf": {
      "_about": "http://datos.gob.es/apidata/catalog/dataset.json",
      "definition": "http://datos.gob.es/apidata/catalog/meta/dataset.json",
      "hasPart": "http://datos.gob.es/apidata/catalog/dataset.json?_pageSize=1&_page=0",
      "type": "http://purl.org/linked-data/api/vocab#ListEndpoint"
    },
    "items": [
      {
        "_about": "https://datos.gob.es/catalogo/e05068001-mapas-estrategicos-de-ruido",
        "accrualPeriodicity": "http://publications.europa.eu/resource/authority/frequency/OP_DATPRO",
        "description": [
          {
            "_value": "Mapas estratégicos de ruido (MER) de la tercera fase de implementación de la Directiva 2002/49/CE del Parlamento Europeo y del Consejo, de 25 de junio de 2002, sobre evaluación y gestión del ruido ambiental (END, por sus siglas en inglés).",
            "_lang": "es"
          },
          {
            "_value": "Strategic Noise Maps for the third phase of implementation of Directive 2002/49/EC of the European Parliament and of the Council, of 25 June 2002, relating to the assessment and management of environmental noise (END).",
            "_lang": "en"
          }

Parameters

ParameterTypeRequiredDescription
_pageSizequeryOptionalResults per page. Capped by the server; keep it modest. 1
_pagequeryOptionalZero-based page number. This API pages, it does not offset. 0
_sortqueryOptionalSort field, prefixed with `-` for descending. -modified
_metadataqueryOptionalSet to `all` to include the extended metadata block. all
titlequeryOptionalFilter by title substring on the dataset list endpoint. presupuesto

Response fields

format / versionstring
Declares `linked-data-api` and its version — a signal that literals are wrapped, not plain.
result._aboutstring
URI identifying this result page.
result.itemsarray
The datasets themselves, each an RDF resource.
items[]._aboutstring
The dataset's canonical catalogue URI. Use this as the identifier.
items[].descriptionarray
Array of `{_value, _lang}` objects — Spain publishes in several official languages, so pick by language tag.
items[].accrualPeriodicitystring
EU frequency vocabulary URI. `OP_DATPRO` means provisional data, not a schedule.
result.first / result.isPartOfstring
Navigation URIs for the list endpoint, used instead of numeric offsets.

What you can build with the datos.gob.es API

  • Harvest the Spanish national catalogue into a multi-country index
  • Filter datasets by EU frequency vocabulary across member states
  • Serve dataset titles in Catalan, Basque or Galician as well as Spanish
  • Resolve a dataset's canonical URI for linked-data citation

Common errors and how to fix them

description.substring is not a function

Literals are arrays of `{_value, _lang}` objects.

Fix: Read `description[0]._value`, or select the entry whose `_lang` matches the user's locale.

Pagination skips or repeats records

`_page` is zero-based and page-oriented, not an offset.

Fix: Increment `_page` by one per request; do not multiply by `_pageSize`.

accrualPeriodicity is unreadable

It is an EU authority URI, not a word.

Fix: Map the final path segment against the Publications Office frequency vocabulary; `OP_DATPRO` is a provisional-data placeholder.

406 or unexpected format

Content negotiation picked a serialisation you did not want.

Fix: Append an explicit extension such as `.json` to the path rather than relying on Accept headers.

datos.gob.es API — frequently asked questions

Is the datos.gob.es API free?

Yes. No key and no registration for reads, and the same endpoints serve JSON, XML, RDF and Turtle by content negotiation.

Why is this not a CKAN API?

Spain implemented its catalogue as a Linked Data API over RDF rather than adopting portal software. The trade-off is heavier response shapes in exchange for stable URIs and native multilingual literals.

How do I get a plain string description?

Take the first element of the `description` array and read its `_value`, or filter the array by `_lang` to match your user's language. Spain publishes descriptions in several co-official languages on the same record.

What does OP_DATPRO mean?

It is the EU Publications Office code for provisional data — a placeholder used where the publisher has not committed to an update cadence. Treat it as unknown rather than as a schedule.

Tools that pair with this API

datos.gob.es is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.