{
  "openapi": "3.1.0",
  "info": {
    "title": "Joaquín Bravo · Public data",
    "version": "1.0.0",
    "description": "Portfolio snapshots and public official time series. Read-only. Check source, dates and units."
  },
  "servers": [
    {
      "url": "https://joacobravo.com"
    }
  ],
  "paths": {
    "/api/data": {
      "get": {
        "operationId": "queryPublicData",
        "parameters": [
          {
            "name": "action",
            "in": "query",
            "description": "catalog lists portfolio datasets; search discovers official series; series reads an official ID; table reads a portfolio dataset/table.",
            "schema": {
              "type": "string",
              "enum": [
                "catalog",
                "search",
                "series",
                "table"
              ],
              "default": "catalog"
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "scope",
            "in": "query",
            "description": "Search only. indec filters to the INDEC source in Datos Argentina.",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "indec"
              ]
            }
          },
          {
            "name": "id",
            "in": "query",
            "description": "Required for series.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_.-]{1,100}$"
            }
          },
          {
            "name": "dataset",
            "in": "query",
            "description": "Required for table. Get IDs from catalog.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "table",
            "in": "query",
            "description": "Required for table. Get IDs from catalog.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "region",
            "in": "query",
            "description": "Optional exact region for indec-ipc.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code",
            "in": "query",
            "description": "Optional exact classifier code for indec-ipc; 0 is headline.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "Inclusive lower bound for series and dated tables.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Inclusive upper bound for series and dated tables.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 250,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 2000000,
              "default": 0
            }
          },
          {
            "name": "format",
            "in": "query",
            "description": "CSV is available for series and table. X-Next-Offset contains the next page.",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "csv"
              ],
              "default": "json"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Catalog or paginated observations; data and source metadata. Use next_offset to read another page.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "next_offset": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "total": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  }
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Invalid filters or series ID."
          },
          "404": {
            "description": "Unknown portfolio dataset or table."
          },
          "502": {
            "description": "Official source did not respond as expected."
          }
        }
      }
    }
  }
}
