# Open Data Madrid

> Read Madrid City Council's open-data catalogue: search its datasets by words, category, tag or file format, open any one of them with every file it publishes, and follow the categories, tags, licences and changes behind them.

App · Misc References · 21 actions. Web page: https://docs.lodol.com/docs/integrations/open-data-madrid

## Actions

### Get a category

Read one category's own record: its title, what it covers and how many datasets are filed under it. Takes the category's name or a link to its page.

**Inputs**

- Category (`category`, text, required): Which category to read. Pick one, or type its name.

**Outputs**

- `category` (object)

**Example output**

```json
{
  "category": {
    "category_url": "https://datos.madrid.es/group/ods-11",
    "dataset_count": 12,
    "description": null,
    "id": "7c8d9e0f-1a2b-4c3d-9e8f-7a6b5c4d3e2f",
    "image_url": null,
    "name": "ods-11",
    "state": "active",
    "title": "Ciudades y Comunidades Sostenibles"
  }
}
```

### Get a category's datasets

Read the datasets filed under one category, each in full with its files and licence. Use 'Search datasets' with a category filter instead when you also want to search within it or to page through a large category.

**Inputs**

- Category (`category`, text, required): Which category to read. Pick one, or type its name.
- Number of results (`limit`, number): How many results to return (1–100). Defaults to 20. Use 'Skip' alongside it to read further down the list. From 1 to 100. Default: `20`.

**Outputs**

- `category` (text)
- `result_count` (number)
- `results` (list)

**Example output**

```json
{
  "category": "ods-11",
  "result_count": 1,
  "results": [
    {
      "author": "Ayuntamiento de Madrid",
      "author_email": null,
      "categories": [
        {
          "description": null,
          "name": "ods-11",
          "title": "Ciudades y Comunidades Sostenibles"
        }
      ],
      "created": "2026-01-14T09:12:33.123456",
      "created_utc": "2026-01-14T09:12:33.123456+00:00",
      "dataset_url": "https://datos.madrid.es/dataset/212411-0-madrid-avisa",
      "description": "Avisos comunicados por la ciudadan\u00eda a trav\u00e9s de Madrid Avisa, con su tipo, su localizaci\u00f3n y el estado en que se encuentra cada uno.",
      "extras": {
        "frecuencia_actualizacion": "Mensual"
      },
      "formats": [
        "CSV",
        "JSON",
        "PDF",
        "XML"
      ],
      "id": "9e2c1f83-4a6d-4b19-8c77-1d2e3f4a5b6c",
      "is_open": true,
      "is_private": false,
      "license_id": "cc-by",
      "license_title": "Creative Commons Attribution",
      "license_url": "https://creativecommons.org/licenses/by/4.0/",
      "maintainer": "\u00c1rea de Gobierno de Obras, Urbanismo y Equipamientos",
      "maintainer_email": null,
      "modified": "2026-09-15T06:30:00.000000",
      "modified_utc": "2026-09-15T06:30:00+00:00",
      "name": "212411-0-madrid-avisa",
      "organization": {
        "description": null,
        "id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
        "image_url": null,
        "name": "ayuntamiento-de-madrid",
        "title": "Ayuntamiento de Madrid"
      },
      "resource_count": 1,
      "resources": [
        {
          "created": "2026-01-14T09:12:33.123456",
          "created_utc": "2026-01-14T09:12:33.123456+00:00",
          "dataset_id": "9e2c1f83-4a6d-4b19-8c77-1d2e3f4a5b6c",
          "description": "Avisos comunicados por la ciudadan\u00eda a trav\u00e9s de Madrid Avisa.",
          "download_url": "https://datos.madrid.es/egob/catalogo/212411-0-madrid-avisa.csv",
          "format": "CSV",
          "id": "3b1f2c40-9a77-4e51-8f1a-2c9d0e5b7a10",
          "is_queryable": true,
          "is_uploaded": false,
          "mimetype": "text/csv",
          "name": "Avisos ciudadanos 2026 (CSV)",
          "position": 0,
          "resource_url": "https://datos.madrid.es/dataset/212411-0-madrid-avisa/resource/3b1f2c40-9a77-4e51-8f1a-2c9d0e5b7a10",
          "size_bytes": 2516582,
          "size_label": "2.4 MB",
          "state": "active",
          "updated_at": "2026-09-15T06:30:00.000000",
          "updated_at_utc": "2026-09-15T06:30:00+00:00"
        }
      ],
      "source_url": null,
      "state": "active",
      "tags": [
        "avisos",
        "madrid-avisa",
        "servicios-urbanos"
      ],
      "title": "Avisos ciudadanos",
      "version": null
    }
  ]
}
```

### Get a change

Read one entry from a change history by its id, as returned by 'Get a dataset's history' or 'List recently updated datasets': what kind of change it was, which dataset it touched and exactly when.

**Inputs**

- Change (`activity`, text, required): The change's id, as returned by one of the history actions.

**Outputs**

- `activity` (object)

**Example output**

```json
{
  "activity": {
    "activity_type": "changed package",
    "dataset_name": "212411-0-madrid-avisa",
    "dataset_title": "Avisos ciudadanos",
    "id": "0a1b2c3d-4e5f-4061-8273-8495a6b7c8d9",
    "object_id": "9e2c1f83-4a6d-4b19-8c77-1d2e3f4a5b6c",
    "timestamp": "2026-09-15T06:30:00.000000",
    "timestamp_utc": "2026-09-15T06:30:00+00:00",
    "user_id": "2b3c4d5e-6f70-4812-9354-a6b7c8d9e0f1"
  }
}
```

### Get a dataset

Read one dataset in full: what it covers, who publishes it, the licence it is released under, when it was last updated, and every file it offers with that file's format, size and download link. Takes the dataset's name, its id, or a link to its page copied from a browser.

**Inputs**

- Dataset (`dataset`, text, required): The dataset's name as it appears in its web address, its id, or a link to its page.

**Outputs**

- `dataset` (object)

**Example output**

```json
{
  "dataset": {
    "author": "Ayuntamiento de Madrid",
    "author_email": null,
    "categories": [
      {
        "description": null,
        "name": "ods-11",
        "title": "Ciudades y Comunidades Sostenibles"
      }
    ],
    "created": "2026-01-14T09:12:33.123456",
    "created_utc": "2026-01-14T09:12:33.123456+00:00",
    "dataset_url": "https://datos.madrid.es/dataset/212411-0-madrid-avisa",
    "description": "Avisos comunicados por la ciudadan\u00eda a trav\u00e9s de Madrid Avisa, con su tipo, su localizaci\u00f3n y el estado en que se encuentra cada uno.",
    "extras": {
      "frecuencia_actualizacion": "Mensual"
    },
    "formats": [
      "CSV",
      "JSON",
      "PDF",
      "XML"
    ],
    "id": "9e2c1f83-4a6d-4b19-8c77-1d2e3f4a5b6c",
    "is_open": true,
    "is_private": false,
    "license_id": "cc-by",
    "license_title": "Creative Commons Attribution",
    "license_url": "https://creativecommons.org/licenses/by/4.0/",
    "maintainer": "\u00c1rea de Gobierno de Obras, Urbanismo y Equipamientos",
    "maintainer_email": null,
    "modified": "2026-09-15T06:30:00.000000",
    "modified_utc": "2026-09-15T06:30:00+00:00",
    "name": "212411-0-madrid-avisa",
    "organization": {
      "description": null,
      "id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
      "image_url": null,
      "name": "ayuntamiento-de-madrid",
      "title": "Ayuntamiento de Madrid"
    },
    "resource_count": 1,
    "resources": [
      {
        "created": "2026-01-14T09:12:33.123456",
        "created_utc": "2026-01-14T09:12:33.123456+00:00",
        "dataset_id": "9e2c1f83-4a6d-4b19-8c77-1d2e3f4a5b6c",
        "description": "Avisos comunicados por la ciudadan\u00eda a trav\u00e9s de Madrid Avisa.",
        "download_url": "https://datos.madrid.es/egob/catalogo/212411-0-madrid-avisa.csv",
        "format": "CSV",
        "id": "3b1f2c40-9a77-4e51-8f1a-2c9d0e5b7a10",
        "is_queryable": true,
        "is_uploaded": false,
        "mimetype": "text/csv",
        "name": "Avisos ciudadanos 2026 (CSV)",
        "position": 0,
        "resource_url": "https://datos.madrid.es/dataset/212411-0-madrid-avisa/resource/3b1f2c40-9a77-4e51-8f1a-2c9d0e5b7a10",
        "size_bytes": 2516582,
        "size_label": "2.4 MB",
        "state": "active",
        "updated_at": "2026-09-15T06:30:00.000000",
        "updated_at_utc": "2026-09-15T06:30:00+00:00"
      }
    ],
    "source_url": null,
    "state": "active",
    "tags": [
      "avisos",
      "madrid-avisa",
      "servicios-urbanos"
    ],
    "title": "Avisos ciudadanos",
    "version": null
  }
}
```

### Get a dataset's history

Read one dataset's change history, most recent first: when it was created and each time it has been updated since. This is what a workflow watches to notice that a dataset it depends on has new data.

**Inputs**

- Dataset (`dataset`, text, required): The dataset's name as it appears in its web address, its id, or a link to its page.
- Number of results (`limit`, number): How many results to return (1–100). Defaults to 20. Use 'Skip' alongside it to read further down the list. From 1 to 100. Default: `20`.
- Skip (`offset`, number): How many results to skip before returning any. Defaults to 0. Set it to the number already read to fetch the next page. From 0 to 10000. Default: `0`.

**Outputs**

- `activities` (list)
- `dataset` (text)
- `offset` (number)
- `result_count` (number)

**Example output**

```json
{
  "activities": [
    {
      "activity_type": "changed package",
      "dataset_name": "212411-0-madrid-avisa",
      "dataset_title": "Avisos ciudadanos",
      "id": "0a1b2c3d-4e5f-4061-8273-8495a6b7c8d9",
      "object_id": "9e2c1f83-4a6d-4b19-8c77-1d2e3f4a5b6c",
      "timestamp": "2026-09-15T06:30:00.000000",
      "timestamp_utc": "2026-09-15T06:30:00+00:00",
      "user_id": "2b3c4d5e-6f70-4812-9354-a6b7c8d9e0f1"
    }
  ],
  "dataset": "212411-0-madrid-avisa",
  "offset": 0,
  "result_count": 1
}
```

### Get a file

Read one file's details: its format, its size, whether the portal hosts it or links out to it, and the link to download it. Takes the id 'Get a dataset' returns for each of a dataset's files, or a link to the file's page.

**Inputs**

- File (`file`, text, required): The file's id, or a link to it. A file is identified by an id rather than a name, and 'Get a dataset' returns one for every file it publishes.

**Outputs**

- `file` (object)

**Example output**

```json
{
  "file": {
    "created": "2026-01-14T09:12:33.123456",
    "created_utc": "2026-01-14T09:12:33.123456+00:00",
    "dataset_id": "9e2c1f83-4a6d-4b19-8c77-1d2e3f4a5b6c",
    "description": "Avisos comunicados por la ciudadan\u00eda a trav\u00e9s de Madrid Avisa.",
    "download_url": "https://datos.madrid.es/egob/catalogo/212411-0-madrid-avisa.csv",
    "format": "CSV",
    "id": "3b1f2c40-9a77-4e51-8f1a-2c9d0e5b7a10",
    "is_queryable": true,
    "is_uploaded": false,
    "mimetype": "text/csv",
    "name": "Avisos ciudadanos 2026 (CSV)",
    "position": 0,
    "resource_url": "https://datos.madrid.es/dataset/212411-0-madrid-avisa/resource/3b1f2c40-9a77-4e51-8f1a-2c9d0e5b7a10",
    "size_bytes": 2516582,
    "size_label": "2.4 MB",
    "state": "active",
    "updated_at": "2026-09-15T06:30:00.000000",
    "updated_at_utc": "2026-09-15T06:30:00+00:00"
  }
}
```

### Get a preview

Read one preview on its own by its id, as returned by 'List a file's previews': its title, its description and which kind of viewer it is.

**Inputs**

- Preview (`view`, text, required): The preview's id, as returned by 'List a file's previews'.

**Outputs**

- `view` (object)

**Example output**

```json
{
  "view": {
    "description": null,
    "id": "8d7c6b5a-4930-4218-9f6e-5d4c3b2a1908",
    "resource_id": "3b1f2c40-9a77-4e51-8f1a-2c9d0e5b7a10",
    "title": "Tabla de datos",
    "view_type": "datatables_view"
  }
}
```

### Get a tag

Read one tag by name, with how many datasets carry it. Use it to check that a tag a workflow filters on still exists before searching with it.

**Inputs**

- Tag (`tag`, text, required): The tag's name, exactly as the portal spells it.

**Outputs**

- `tag` (object)

**Example output**

```json
{
  "tag": {
    "dataset_count": 37,
    "display_name": "avisos",
    "id": "5f4e3d2c-1b0a-4938-8271-6a5b4c3d2e1f",
    "name": "avisos",
    "tag_url": "https://datos.madrid.es/dataset?tags=avisos"
  }
}
```

### Get follower count

Count the people following one dataset or one category on the portal: a rough measure of how much interest it attracts, which is how a workflow picks the datasets worth reporting on.

**Inputs**

- Count followers of (`record_type`, text): Whether the name below is a dataset or a category. Defaults to dataset. One of: `dataset`, `category`. Default: `dataset`.
- Dataset or category (`record`, text, required): The name, id or link of the dataset or category to count followers for.

**Outputs**

- `follower_count` (number)
- `record` (text)
- `record_type` (text)

**Example output**

```json
{
  "follower_count": 12,
  "record": "212411-0-madrid-avisa",
  "record_type": "dataset"
}
```

### Get related datasets

Read the datasets the portal records as related to one dataset (a parent it derives from, a version it supersedes, or one it links to) together with the kind of relationship and any note the publisher left on it.

**Inputs**

- Dataset (`dataset`, text, required): The dataset's name as it appears in its web address, its id, or a link to its page.

**Outputs**

- `dataset` (text)
- `relationships` (list)
- `result_count` (number)

**Example output**

```json
{
  "dataset": "212411-0-madrid-avisa",
  "relationships": [
    {
      "comment": null,
      "object": "212411-1-madrid-avisa-historico",
      "subject": "212411-0-madrid-avisa",
      "type": "links_to"
    }
  ],
  "result_count": 1
}
```

### Get the category tree

Read the categories as a tree rather than a flat list, each one carrying the categories nested beneath it. Use it to show the catalogue's own structure, or to walk from a broad heading down to the narrower ones inside it.

**Inputs**: None.

**Outputs**

- `categories` (list)
- `result_count` (number)

**Example output**

```json
{
  "categories": [
    {
      "category_url": "https://datos.madrid.es/group/ods-11",
      "children": [],
      "dataset_count": 12,
      "description": null,
      "id": "7c8d9e0f-1a2b-4c3d-9e8f-7a6b5c4d3e2f",
      "image_url": null,
      "name": "ods-11",
      "state": "active",
      "title": "Ciudades y Comunidades Sostenibles"
    }
  ],
  "result_count": 1
}
```

### List a file's previews

List the previews the portal has configured on one file (a data table, a chart, a map or an embedded viewer) each with its own id and kind. A file with no preview is not an error: it simply comes back empty.

**Inputs**

- File (`file`, text, required): The file's id, or a link to it. A file is identified by an id rather than a name, and 'Get a dataset' returns one for every file it publishes.

**Outputs**

- `file` (text)
- `result_count` (number)
- `views` (list)

**Example output**

```json
{
  "file": "3b1f2c40-9a77-4e51-8f1a-2c9d0e5b7a10",
  "result_count": 1,
  "views": [
    {
      "description": null,
      "id": "8d7c6b5a-4930-4218-9f6e-5d4c3b2a1908",
      "resource_id": "3b1f2c40-9a77-4e51-8f1a-2c9d0e5b7a10",
      "title": "Tabla de datos",
      "view_type": "datatables_view"
    }
  ]
}
```

### List categories

Read every category the portal files its datasets under (transport, environment, population, urban planning and the rest) each with its title, its description and how many datasets it holds. This is the vocabulary the search filter runs on, so it is what a workflow reads to decide which category to follow.

**Inputs**: None.

**Outputs**

- `categories` (list)
- `result_count` (number)

**Example output**

```json
{
  "categories": [
    {
      "category_url": "https://datos.madrid.es/group/ods-11",
      "dataset_count": 12,
      "description": null,
      "id": "7c8d9e0f-1a2b-4c3d-9e8f-7a6b5c4d3e2f",
      "image_url": null,
      "name": "ods-11",
      "state": "active",
      "title": "Ciudades y Comunidades Sostenibles"
    }
  ],
  "result_count": 1
}
```

### List datasets

List the names of the datasets in the catalogue, in the portal's own order. Names only, which is the cheap way to see everything the portal holds; each one goes straight into 'Get a dataset'. Use 'Search datasets' instead when you want the records themselves.

**Inputs**

- Number of names (`limit`, number): How many dataset names to return (1–1000). Defaults to 100. From 1 to 1000. Default: `100`.
- Skip (`offset`, number): How many results to skip before returning any. Defaults to 0. Set it to the number already read to fetch the next page. From 0 to 10000. Default: `0`.

**Outputs**

- `names` (list)
- `offset` (number)
- `result_count` (number)

**Example output**

```json
{
  "names": [
    "212411-0-madrid-avisa"
  ],
  "offset": 0,
  "result_count": 1
}
```

### List licences

Read the licences datasets in the catalogue are published under, each with its name, its full text online and whether it is an open licence. This is what a workflow checks against a dataset's licence before reusing its data.

**Inputs**: None.

**Outputs**

- `licenses` (list)
- `result_count` (number)

**Example output**

```json
{
  "licenses": [
    {
      "id": "cc-by",
      "is_open": true,
      "title": "Creative Commons Attribution",
      "url": "https://creativecommons.org/licenses/by/4.0/"
    }
  ],
  "result_count": 1
}
```

### List recently updated datasets

Read what has changed across the whole catalogue lately, most recent first, each entry naming the dataset it touched and when. Run it on a schedule to find out what Madrid has published or refreshed since the last time you looked.

**Inputs**

- Number of results (`limit`, number): How many results to return (1–100). Defaults to 20. Use 'Skip' alongside it to read further down the list. From 1 to 100. Default: `20`.
- Skip (`offset`, number): How many results to skip before returning any. Defaults to 0. Set it to the number already read to fetch the next page. From 0 to 10000. Default: `0`.

**Outputs**

- `activities` (list)
- `offset` (number)
- `result_count` (number)

**Example output**

```json
{
  "activities": [
    {
      "activity_type": "changed package",
      "dataset_name": "212411-0-madrid-avisa",
      "dataset_title": "Avisos ciudadanos",
      "id": "0a1b2c3d-4e5f-4061-8273-8495a6b7c8d9",
      "object_id": "9e2c1f83-4a6d-4b19-8c77-1d2e3f4a5b6c",
      "timestamp": "2026-09-15T06:30:00.000000",
      "timestamp_utc": "2026-09-15T06:30:00+00:00",
      "user_id": "2b3c4d5e-6f70-4812-9354-a6b7c8d9e0f1"
    }
  ],
  "offset": 0,
  "result_count": 1
}
```

### List tags

Read every tag used across the catalogue, alphabetically. Tags are finer-grained than categories and are what the search filter matches on, so this is how a workflow finds the exact word the portal files something under.

**Inputs**: None.

**Outputs**

- `result_count` (number)
- `tags` (list)

**Example output**

```json
{
  "result_count": 1,
  "tags": [
    {
      "dataset_count": 37,
      "display_name": "avisos",
      "id": "5f4e3d2c-1b0a-4938-8271-6a5b4c3d2e1f",
      "name": "avisos",
      "tag_url": "https://datos.madrid.es/dataset?tags=avisos"
    }
  ]
}
```

### Search datasets

Search the whole Madrid catalogue by words in a dataset's title, description or tags, and narrow it by category, tag, file format or publishing body. Picking several values for one filter widens the result (any of them matches); filling in different filters narrows it (all of them must match). Leave the words blank to browse a filter on its own: every dataset tagged 'movilidad', say. Each result comes back with its files, formats, licence and when it was last updated.

**Inputs**

- Words to search for (`query`, text): Words to match against titles, descriptions and tags. Leave blank to return everything the filters allow.
- Categories (`categories`, list): Only datasets in these categories. A dataset in any one of them is included.
- Tags (`tags`, list): Only datasets carrying these tags. A dataset with any one of them is included. Use 'List tags' or 'Suggest' to find the ones the portal uses.
- File formats (`formats`, list): Only datasets publishing a file in these formats, such as CSV, JSON, XML or GeoJSON.
- Publishing body (`organization`, text): Only datasets published by this body, named as it appears in its web address.
- Order by (`sort`, text): How to order the results. Defaults to best match, which falls back to the most recently updated when no words were given. One of: `relevance` (Best match), `recently_updated` (Recently updated), `recently_added` (Recently added), `oldest` (Oldest first), `title_asc` (Title A–Z), `title_desc` (Title Z–A). Default: `relevance`.
- Number of results (`limit`, number): How many results to return (1–100). Defaults to 20. Use 'Skip' alongside it to read further down the list. From 1 to 100. Default: `20`.
- Skip (`offset`, number): How many results to skip before returning any. Defaults to 0. Set it to the number already read to fetch the next page. From 0 to 10000. Default: `0`.

**Outputs**

- `offset` (number)
- `query` (text)
- `result_count` (number)
- `results` (list)
- `total_count` (number)

**Example output**

```json
{
  "offset": 0,
  "query": "avisos",
  "result_count": 1,
  "results": [
    {
      "author": "Ayuntamiento de Madrid",
      "author_email": null,
      "categories": [
        {
          "description": null,
          "name": "ods-11",
          "title": "Ciudades y Comunidades Sostenibles"
        }
      ],
      "created": "2026-01-14T09:12:33.123456",
      "created_utc": "2026-01-14T09:12:33.123456+00:00",
      "dataset_url": "https://datos.madrid.es/dataset/212411-0-madrid-avisa",
      "description": "Avisos comunicados por la ciudadan\u00eda a trav\u00e9s de Madrid Avisa, con su tipo, su localizaci\u00f3n y el estado en que se encuentra cada uno.",
      "extras": {
        "frecuencia_actualizacion": "Mensual"
      },
      "formats": [
        "CSV",
        "JSON",
        "PDF",
        "XML"
      ],
      "id": "9e2c1f83-4a6d-4b19-8c77-1d2e3f4a5b6c",
      "is_open": true,
      "is_private": false,
      "license_id": "cc-by",
      "license_title": "Creative Commons Attribution",
      "license_url": "https://creativecommons.org/licenses/by/4.0/",
      "maintainer": "\u00c1rea de Gobierno de Obras, Urbanismo y Equipamientos",
      "maintainer_email": null,
      "modified": "2026-09-15T06:30:00.000000",
      "modified_utc": "2026-09-15T06:30:00+00:00",
      "name": "212411-0-madrid-avisa",
      "organization": {
        "description": null,
        "id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
        "image_url": null,
        "name": "ayuntamiento-de-madrid",
        "title": "Ayuntamiento de Madrid"
      },
      "resource_count": 1,
      "resources": [
        {
          "created": "2026-01-14T09:12:33.123456",
          "created_utc": "2026-01-14T09:12:33.123456+00:00",
          "dataset_id": "9e2c1f83-4a6d-4b19-8c77-1d2e3f4a5b6c",
          "description": "Avisos comunicados por la ciudadan\u00eda a trav\u00e9s de Madrid Avisa.",
          "download_url": "https://datos.madrid.es/egob/catalogo/212411-0-madrid-avisa.csv",
          "format": "CSV",
          "id": "3b1f2c40-9a77-4e51-8f1a-2c9d0e5b7a10",
          "is_queryable": true,
          "is_uploaded": false,
          "mimetype": "text/csv",
          "name": "Avisos ciudadanos 2026 (CSV)",
          "position": 0,
          "resource_url": "https://datos.madrid.es/dataset/212411-0-madrid-avisa/resource/3b1f2c40-9a77-4e51-8f1a-2c9d0e5b7a10",
          "size_bytes": 2516582,
          "size_label": "2.4 MB",
          "state": "active",
          "updated_at": "2026-09-15T06:30:00.000000",
          "updated_at_utc": "2026-09-15T06:30:00+00:00"
        }
      ],
      "source_url": null,
      "state": "active",
      "tags": [
        "avisos",
        "madrid-avisa",
        "servicios-urbanos"
      ],
      "title": "Avisos ciudadanos",
      "version": null
    }
  ],
  "total_count": 1
}
```

### Search files

Find files across the whole catalogue by one of their own fields rather than by their dataset: every file whose name mentions 'padrón', or every GeoJSON the portal publishes. Pick the field to look in and give the term to look for; one field is matched at a time, which is all the portal offers here.

**Inputs**

- Look in (`field`, text): Which of the file's fields to match the term against. Defaults to the file name. One of: `name` (File name), `description`, `format` (Format (CSV, JSON, XML…)), `url` (Download link), `mimetype` (MIME type). Default: `name`.
- Term (`term`, text, required): What to look for in the chosen field. Cannot contain a colon.
- Number of results (`limit`, number): How many results to return (1–100). Defaults to 20. Use 'Skip' alongside it to read further down the list. From 1 to 100. Default: `20`.
- Skip (`offset`, number): How many results to skip before returning any. Defaults to 0. Set it to the number already read to fetch the next page. From 0 to 10000. Default: `0`.

**Outputs**

- `field` (text)
- `offset` (number)
- `result_count` (number)
- `results` (list)
- `term` (text)
- `total_count` (number)

**Example output**

```json
{
  "field": "name",
  "offset": 0,
  "result_count": 1,
  "results": [
    {
      "created": "2026-01-14T09:12:33.123456",
      "created_utc": "2026-01-14T09:12:33.123456+00:00",
      "dataset_id": "9e2c1f83-4a6d-4b19-8c77-1d2e3f4a5b6c",
      "description": "Avisos comunicados por la ciudadan\u00eda a trav\u00e9s de Madrid Avisa.",
      "download_url": "https://datos.madrid.es/egob/catalogo/212411-0-madrid-avisa.csv",
      "format": "CSV",
      "id": "3b1f2c40-9a77-4e51-8f1a-2c9d0e5b7a10",
      "is_queryable": true,
      "is_uploaded": false,
      "mimetype": "text/csv",
      "name": "Avisos ciudadanos 2026 (CSV)",
      "position": 0,
      "resource_url": "https://datos.madrid.es/dataset/212411-0-madrid-avisa/resource/3b1f2c40-9a77-4e51-8f1a-2c9d0e5b7a10",
      "size_bytes": 2516582,
      "size_label": "2.4 MB",
      "state": "active",
      "updated_at": "2026-09-15T06:30:00.000000",
      "updated_at_utc": "2026-09-15T06:30:00+00:00"
    }
  ],
  "term": "avisos",
  "total_count": 1
}
```

### Search tags

Find the tags whose names contain a word, rather than reading the whole list. Useful when you know roughly what the portal calls something ('bici', 'aire') but not the exact tag.

**Inputs**

- Term (`term`, text, required): The word to look for in tag names.
- Number of results (`limit`, number): How many results to return (1–100). Defaults to 20. Use 'Skip' alongside it to read further down the list. From 1 to 100. Default: `20`.
- Skip (`offset`, number): How many results to skip before returning any. Defaults to 0. Set it to the number already read to fetch the next page. From 0 to 10000. Default: `0`.

**Outputs**

- `offset` (number)
- `result_count` (number)
- `tags` (list)
- `term` (text)
- `total_count` (number)

**Example output**

```json
{
  "offset": 0,
  "result_count": 1,
  "tags": [
    {
      "dataset_count": 37,
      "display_name": "avisos",
      "id": "5f4e3d2c-1b0a-4938-8271-6a5b4c3d2e1f",
      "name": "avisos",
      "tag_url": "https://datos.madrid.es/dataset?tags=avisos"
    }
  ],
  "term": "movil",
  "total_count": 1
}
```

### Suggest names

Complete a partly-typed name against the portal's own vocabulary: dataset names, categories, tags or file formats. Every kind comes back as the same value-and-label pair, so this is what a workflow uses to turn something a person typed into a name the other actions will accept.

**Inputs**

- Complete (`target`, text): What kind of name to complete. Defaults to dataset. One of: `dataset`, `category`, `tag`, `format` (File format). Default: `dataset`.
- Partial name (`term`, text, required): What has been typed so far.
- Number of suggestions (`limit`, number): How many suggestions to return (1–50). Defaults to 10. From 1 to 50. Default: `10`.

**Outputs**

- `result_count` (number)
- `suggestions` (list)
- `target` (text)
- `term` (text)

**Example output**

```json
{
  "result_count": 1,
  "suggestions": [
    {
      "label": "Avisos ciudadanos",
      "value": "212411-0-madrid-avisa"
    }
  ],
  "target": "dataset",
  "term": "avis"
}
```
