{
  "openapi": "3.1.0",
  "info": {
    "title": "VPI public data API",
    "version": "1.0.0",
    "summary": "The Venezuela Price Index and the weekly price of every product in the VPI price wiki. No key.",
    "description": "Public, read-only and keyless. The Venezuela Price Index (base 100 = 2026-07-03) in bolivares and US dollars with its category indices, and, per product, what its product page shows: the latest posted shelf price and the weekly median price line. Retail chains are named (Farmatodo, Locatel, Kromi and so on). Daily product rows, stock and promotions are not public. Limits: 60 requests a minute and 5,000 a day per IP address. Cite as: Morf Capital, Venezuela Price Index (VPI), vpindex.org. The same data is available to agents over MCP at /api/mcp (streamable HTTP, no key). Methodology: https://vpindex.org/data/METHODOLOGY.md",
    "contact": {
      "name": "Morf Capital",
      "email": "contact@vpindex.org",
      "url": "https://x.com/vpindex"
    },
    "license": {
      "name": "Free for citation with attribution: Morf Capital, Venezuela Price Index, vpindex.org.",
      "url": "https://vpindex.org/es/metodologia"
    }
  },
  "servers": [
    {
      "url": "https://vpindex.org"
    }
  ],
  "security": [],
  "tags": [
    {
      "name": "index",
      "description": "The Venezuela Price Index series."
    },
    {
      "name": "products",
      "description": "The price wiki: products, their latest price and weekly median line."
    },
    {
      "name": "agents",
      "description": "Model Context Protocol."
    }
  ],
  "paths": {
    "/api/v1/series": {
      "get": {
        "operationId": "listSeries",
        "tags": [
          "index"
        ],
        "summary": "The public series: VPI in bolivares and dollars and the category indices.",
        "parameters": [
          {
            "name": "group",
            "in": "query",
            "required": false,
            "description": "Only `index` is public.",
            "schema": {
              "type": "string",
              "enum": [
                "index"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Series list.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeriesList"
                }
              }
            }
          },
          "404": {
            "description": "not_public: that group is not in the public API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: too many requests from this address (60 a minute, 5,000 a day). Retry-After says when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal: something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/series/{id}": {
      "get": {
        "operationId": "getSeries",
        "tags": [
          "index"
        ],
        "summary": "One series as [date, value] points, full history.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Series id from /api/v1/series, e.g. vpi-ves, vpi-usd.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start",
            "in": "query",
            "required": false,
            "description": "First day, YYYY-MM-DD, or YYYY-MM for the first day of that month.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "end",
            "in": "query",
            "required": false,
            "description": "Last day, YYYY-MM-DD, or YYYY-MM for the last day of that month.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "csv returns text/csv instead of JSON. Any other value is 400 bad_format.",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "csv"
              ],
              "default": "json"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The series.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Series"
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "bad_request: start/end are not real dates or start is after end. bad_format: format is not json or csv.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "key_required: the series exists but needs an API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "not_found: no series with that id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: too many requests from this address (60 a minute, 5,000 a day). Retry-After says when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal: something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/categories": {
      "get": {
        "operationId": "listCategories",
        "tags": [
          "products"
        ],
        "summary": "Product categories and retail chains with product counts.",
        "responses": {
          "200": {
            "description": "Categories and chains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Categories"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: too many requests from this address (60 a minute, 5,000 a day). Retry-After says when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal: something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/products": {
      "get": {
        "operationId": "searchProducts",
        "tags": [
          "products"
        ],
        "summary": "Search the price wiki by product name or brand, category or chain.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Words in the product name or brand, e.g. harina pan.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Category id from /api/v1/categories.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "chain",
            "in": "query",
            "required": false,
            "description": "Chain id from /api/v1/categories, e.g. farmatodo.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Results per page, default 20, max 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "next_cursor from the previous page.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of products.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductPage"
                }
              }
            }
          },
          "400": {
            "description": "empty_query, unknown_category, unknown_chain, bad_cursor or stale_cursor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: too many requests from this address (60 a minute, 5,000 a day). Retry-After says when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal: something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/products/{id}": {
      "get": {
        "operationId": "getProduct",
        "tags": [
          "products"
        ],
        "summary": "One product: latest price, weekly median price line and its changes, as on its wiki page.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Public product id from /api/v1/products, e.g. a0000165771 (the id in the wiki URL).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "csv returns the weekly line as text/csv.",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "csv"
              ],
              "default": "json"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The product.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "bad_format: format is not json or csv.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "not_found: no product with that id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: too many requests from this address (60 a minute, 5,000 a day). Retry-After says when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal: something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/openapi.json": {
      "get": {
        "operationId": "getOpenApi",
        "tags": [
          "index"
        ],
        "summary": "This document.",
        "responses": {
          "200": {
            "description": "OpenAPI 3.1.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/mcp": {
      "post": {
        "operationId": "mcp",
        "tags": [
          "agents"
        ],
        "summary": "Remote MCP server, streamable HTTP, stateless, no key.",
        "description": "POST JSON-RPC 2.0 (initialize, tools/list, tools/call). Tools: list_series, get_series, list_categories, list_chains, search_products, get_product.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: too many requests from this address (60 a minute, 5,000 a day). Retry-After says when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal: something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "SeriesMeta": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "group": {
            "type": "string"
          },
          "unit": {
            "type": "string"
          },
          "frequency": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "first_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "last_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "observations": {
            "type": "integer"
          },
          "observations_visible": {
            "type": "integer"
          },
          "locked": {
            "type": "boolean"
          }
        }
      },
      "SeriesList": {
        "type": "object",
        "properties": {
          "as_of": {
            "type": "string",
            "format": "date"
          },
          "history_days_visible": {
            "type": "null"
          },
          "series": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SeriesMeta"
            }
          }
        }
      },
      "Series": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "group": {
            "type": "string"
          },
          "unit": {
            "type": "string"
          },
          "frequency": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "plan_window": {
            "type": "object",
            "properties": {
              "history_days": {
                "type": "null"
              },
              "truncated": {
                "type": "boolean"
              },
              "total_observations": {
                "type": "integer"
              }
            }
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "date",
                "value"
              ]
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "array",
              "prefixItems": [
                {
                  "type": "string",
                  "format": "date"
                },
                {
                  "type": [
                    "number",
                    "null"
                  ]
                }
              ]
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Categories": {
        "type": "object",
        "properties": {
          "as_of": {
            "type": "string",
            "format": "date"
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "slug": {
                  "type": "string"
                },
                "name_es": {
                  "type": "string"
                },
                "name_en": {
                  "type": "string"
                },
                "skus": {
                  "type": "integer"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "chains": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "examples": [
                    "farmatodo"
                  ]
                },
                "name": {
                  "type": "string",
                  "examples": [
                    "Farmatodo"
                  ]
                },
                "skus": {
                  "type": "integer"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          }
        }
      },
      "ProductSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "a0000165771"
            ]
          },
          "name": {
            "type": "string"
          },
          "brand": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "type": "string"
          },
          "chain": {
            "type": "string",
            "examples": [
              "Farmatodo"
            ]
          },
          "price": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "currency": {
                "type": "string",
                "enum": [
                  "USD",
                  "VES"
                ]
              },
              "value": {
                "type": "number"
              },
              "chg_30d": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          },
          "first_seen": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "last_seen": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "The product page, opened in the currency of `price`."
          },
          "url_usd": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "The product page on dollars."
          },
          "url_ves": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "The product page on bolivares."
          },
          "api": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "ProductPage": {
        "type": "object",
        "properties": {
          "as_of": {
            "type": "string",
            "format": "date"
          },
          "total": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductSummary"
            }
          }
        }
      },
      "Product": {
        "type": "object",
        "properties": {
          "as_of": {
            "type": "string",
            "format": "date"
          },
          "product": {
            "$ref": "#/components/schemas/ProductSummary"
          },
          "category_name": {
            "type": "object",
            "properties": {
              "es": {
                "type": "string"
              },
              "en": {
                "type": "string"
              }
            }
          },
          "weekly": {
            "type": "object",
            "properties": {
              "unit": {
                "type": "string",
                "enum": [
                  "USD",
                  "VES"
                ]
              },
              "note": {
                "type": "string"
              },
              "columns": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "data": {
                "type": "array",
                "items": {
                  "type": "array",
                  "prefixItems": [
                    {
                      "type": "string",
                      "format": "date"
                    },
                    {
                      "type": "number"
                    }
                  ]
                }
              }
            }
          },
          "facts": {
            "type": "object",
            "properties": {
              "first_date": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "last_date": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "first_value": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "last_value": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "span_days": {
                "type": "integer"
              },
              "chg_30d": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "chg_90d": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "chg_since_first_seen": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          },
          "source": {
            "type": "string"
          }
        }
      }
    }
  }
}