Opendata.cat Datasets API

Cerca i consulta de datasets de dades obertes

GitHub OpenAPI

Operations 4

GET /all-datasets.php Llista tots els datasets #
GET /datasets.php Cerca datasets #
GET /dataset.php Detall d'un dataset #
GET /categories.php Categories i portals #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/opendata-cat:opendata-cat-datasets-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

opendata-cat-datasets-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Opendata.cat Datasets API
  description: API publica per accedir al cataleg de +2.800 datasets de dades obertes de Catalunya. 9 portals (Generalitat, Barcelona, Diba, AOC, Reus, Girona, FGC, Idescat, Renfe) + dades de +1.000 municipis. Queryable via Socrata, CKAN, Opendatasoft, Idescat API, GTFS-RT i Renfe GTFS-RT JSON.
  version: 1.0.0
  contact:
    name: opendata.cat
    url: https://opendata.cat
    email: xavi.vinaixa@gmail.com
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
- url: https://opendata.cat/api
  description: Produccio
tags:
- name: Datasets
  description: Cerca i consulta de datasets de dades obertes
paths:
  /all-datasets.php:
    get:
      tags:
      - Datasets
      summary: Llista tots els datasets
      description: Llista TOTS els datasets indexats al MCP amb paginacio. Permet filtrar per portal i categoria, i ordenar per nom, data d'actualitzacio o portal.
      operationId: listAllDatasets
      parameters:
      - name: portal
        in: query
        description: Filtrar per portal d'origen.
        schema:
          type: string
          enum:
          - generalitat
          - barcelona
          - diba
          - aoc
          - reus
          - girona
          - fgc
          - idescat
          - renfe
      - name: category
        in: query
        description: Filtrar per categoria tematica (coincidencia parcial).
        schema:
          type: string
      - name: limit
        in: query
        description: Nombre maxim de resultats per pagina.
        schema:
          type: integer
          default: 100
          minimum: 1
          maximum: 500
      - name: offset
        in: query
        description: Desplacament per paginacio.
        schema:
          type: integer
          default: 0
          minimum: 0
      - name: sort
        in: query
        description: 'Ordenacio: ''name'' (per defecte), ''updated'' (data actualitzacio), ''portal''.'
        schema:
          type: string
          enum:
          - name
          - updated
          - portal
          default: name
      responses:
        '200':
          description: Llista paginada de tots els datasets
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/DatasetSummary'
                  total:
                    type: integer
                    description: Nombre total de datasets
                  limit:
                    type: integer
                  offset:
                    type: integer
  /datasets.php:
    get:
      tags:
      - Datasets
      summary: Cerca datasets
      description: Cerca datasets de dades obertes per text lliure (FULLTEXT), amb filtres per portal i categoria. Retorna resultats paginats.
      operationId: searchDatasets
      parameters:
      - name: q
        in: query
        description: 'Text de cerca (FULLTEXT en nom, descripcio i sinonims). Exemples: ''qualitat aire'', ''embassament'', ''pressupost''.'
        schema:
          type: string
      - name: portal
        in: query
        description: Filtrar per portal d'origen.
        schema:
          type: string
          enum:
          - generalitat
          - barcelona
          - diba
          - aoc
          - reus
          - girona
          - fgc
          - idescat
          - renfe
      - name: category
        in: query
        description: Filtrar per categoria tematica (coincidencia parcial).
        schema:
          type: string
      - name: limit
        in: query
        description: Nombre maxim de resultats per pagina.
        schema:
          type: integer
          default: 20
          minimum: 1
          maximum: 100
      - name: offset
        in: query
        description: Desplacament per paginacio.
        schema:
          type: integer
          default: 0
          minimum: 0
      responses:
        '200':
          description: Llista de datasets
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/DatasetSummary'
                  total:
                    type: integer
                    description: Nombre total de resultats
                  limit:
                    type: integer
                  offset:
                    type: integer
              example:
                items:
                - dataset_id: generalitat:gn9e-3qhr
                  portal_id: generalitat
                  name: Quantitat d'aigua als embassaments de les Conques Internes de Catalunya
                  description: Dades setmanals del volum d'aigua embassat...
                  category: Medi Ambient
                  formats:
                  - json
                  - csv
                  api_type: socrata
                total: 199
                limit: 20
                offset: 0
  /dataset.php:
    get:
      tags:
      - Datasets
      summary: Detall d'un dataset
      description: 'Retorna totes les metadades d''un dataset: camps amb tipus, endpoint API, llicencia, formats, tags, sinonims de cerca i datasets relacionats.'
      operationId: getDataset
      parameters:
      - name: id
        in: query
        required: true
        description: 'ID del dataset (format: portal:resource_id).'
        schema:
          type: string
        example: generalitat:gn9e-3qhr
      responses:
        '200':
          description: Detall complet del dataset
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DatasetFull'
        '404':
          description: Dataset no trobat
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /categories.php:
    get:
      tags:
      - Datasets
      summary: Categories i portals
      description: Retorna el nombre total de datasets, la llista de portals amb comptadors, i totes les categories agrupades per portal.
      operationId: getCategories
      responses:
        '200':
          description: Categories i estadistiques per portal
          content:
            application/json:
              schema:
                type: object
                properties:
                  total_datasets:
                    type: integer
                  portals:
                    type: array
                    items:
                      type: object
                      properties:
                        portal_id:
                          type: string
                        total:
                          type: integer
                  categories:
                    type: array
                    items:
                      type: object
                      properties:
                        portal_id:
                          type: string
                        category:
                          type: string
                        total:
                          type: integer
components:
  schemas:
    DatasetSummary:
      type: object
      properties:
        dataset_id:
          type: string
          description: 'ID unic (format: portal:resource_id)'
          example: generalitat:gn9e-3qhr
        portal_id:
          type: string
          description: Portal d'origen
          example: generalitat
        name:
          type: string
          description: Nom del dataset
          example: Quantitat d'aigua als embassaments
        description:
          type: string
          description: Descripcio del dataset
        category:
          type: string
          description: Categoria tematica
          example: Medi Ambient
        formats:
          type: array
          items:
            type: string
          example:
          - json
          - csv
        api_type:
          type: string
          enum:
          - socrata
          - ckan
          - diba
          - diba_cido
          - opendatasoft
          - idescat
          - renfe_gtfsrt_json
          - file_download
          - restricted
          description: Tipus d'API del portal origen
    Error:
      type: object
      properties:
        error:
          type: string
          description: Missatge d'error
    DatasetFull:
      type: object
      allOf:
      - $ref: '#/components/schemas/DatasetSummary'
      properties:
        tags:
          type: array
          items:
            type: string
        api_endpoint:
          type: string
          description: URL de l'API per consultar dades
        fields:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              type:
                type: string
              description:
                type: string
        row_count:
          type: integer
          nullable: true
        last_updated:
          type: string
        license:
          type: string
        search_text:
          type: string
          description: Sinonims i termes de cerca expandits
        related:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              score:
                type: number
          description: Datasets relacionats amb puntuacio de similitud