{
  "openapi": "3.1.0",
  "info": {
    "title": "Valpp Public API",
    "version": "1.0.0",
    "summary": "Read-only knowledge API for pet services in Spain.",
    "description": "Public, unauthenticated API exposing curated data on pet boarding, veterinarians and pet-friendly restaurants across Spain. Coverage: Spain only. Supported entity types: boarding, veterinarian, restaurant. Designed for use by AI agents, autonomous crawlers and third-party integrations. See also the MCP server at /mcp and the AI manifest at /llms.txt.",
    "contact": {
      "name": "VALPP DATA LABS",
      "url": "https://valpp.io/docs",
      "email": "hello@valpp.io"
    },
    "license": {
      "name": "CC BY 4.0",
      "url": "https://creativecommons.org/licenses/by/4.0/"
    }
  },
  "servers": [
    {
      "url": "https://valpp.io/api/public/v1",
      "description": "Public v1"
    }
  ],
  "security": [],
  "externalDocs": {
    "url": "https://valpp.io/llms.txt",
    "description": "AI discovery manifest"
  },
  "x-mcp-endpoint": "https://valpp.io/mcp",
  "x-llms-txt": "https://valpp.io/llms.txt",
  "x-agents-json": "https://valpp.io/.well-known/agents.json",
  "tags": [
    {
      "name": "meta",
      "description": "Service metadata and health."
    },
    {
      "name": "entities",
      "description": "Directory of pet services."
    },
    {
      "name": "search",
      "description": "Ranked search over the catalog."
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "operationId": "getHealth",
        "tags": [
          "meta"
        ],
        "summary": "Service health and dataset size.",
        "responses": {
          "200": {
            "description": "Service is healthy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          }
        }
      }
    },
    "/entities": {
      "get": {
        "operationId": "listEntities",
        "tags": [
          "entities"
        ],
        "summary": "List all entities.",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/EntityType"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of entities.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "total",
                    "items"
                  ],
                  "properties": {
                    "total": {
                      "type": "integer"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/EntitySummary"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/entities/{slug}": {
      "get": {
        "operationId": "getEntity",
        "tags": [
          "entities"
        ],
        "summary": "Get a single entity by slug, with reviews and schema.org JSON-LD.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Entity found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EntityDetail"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/search": {
      "get": {
        "operationId": "searchEntities",
        "tags": [
          "search"
        ],
        "summary": "Ranked search over the catalog.",
        "description": "Free-text + geo + filter search. Only covers Spain and the three supported entity types (boarding, veterinarian, restaurant). Does NOT cover grooming, training, shops or dog walkers.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Free-text query matched against name and description."
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated entity types (boarding, veterinarian, restaurant)."
          },
          {
            "name": "city",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "City name (partial match)."
          },
          {
            "name": "lat",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": -90,
              "maximum": 90
            }
          },
          {
            "name": "lng",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": -180,
              "maximum": 180
            }
          },
          {
            "name": "radius_km",
            "in": "query",
            "schema": {
              "type": "number",
              "default": 25,
              "minimum": 0
            }
          },
          {
            "name": "open_now",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "licensed",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "date_from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "date_to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked results.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          }
        }
      }
    },
    "/compare": {
      "get": {
        "operationId": "compareEntities",
        "tags": [
          "entities"
        ],
        "summary": "Compare 2–4 entities side by side.",
        "parameters": [
          {
            "name": "ids",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated entity UUIDs (2–4)."
          }
        ],
        "responses": {
          "200": {
            "description": "Side-by-side entity comparison.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "count",
                    "entities"
                  ],
                  "properties": {
                    "count": {
                      "type": "integer"
                    },
                    "entities": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/EntityDetail"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid ids.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "EntityType": {
        "type": "string",
        "enum": [
          "boarding",
          "veterinarian",
          "restaurant"
        ],
        "description": "The three entity types Valpp currently covers."
      },
      "Health": {
        "type": "object",
        "required": [
          "ok",
          "version",
          "entity_count",
          "timestamp"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "version": {
            "type": "string"
          },
          "entity_count": {
            "type": "integer"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EntitySummary": {
        "type": "object",
        "required": [
          "id",
          "slug",
          "type",
          "name",
          "url"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/EntityType"
          },
          "name": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "rating": {
            "type": [
              "number",
              "null"
            ]
          },
          "review_count": {
            "type": [
              "integer",
              "null"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "api_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "EntityDetail": {
        "type": "object",
        "description": "Full entity record. See /entities/{slug} response for the canonical shape.",
        "additionalProperties": true
      },
      "SearchResult": {
        "type": "object",
        "required": [
          "id",
          "slug",
          "type",
          "name",
          "score",
          "url"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/EntityType"
          },
          "name": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "rating": {
            "type": [
              "number",
              "null"
            ]
          },
          "score": {
            "type": "number"
          },
          "distance_km": {
            "type": [
              "number",
              "null"
            ]
          },
          "available": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "api_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "SearchResponse": {
        "type": "object",
        "required": [
          "total",
          "count",
          "results"
        ],
        "properties": {
          "total": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          },
          "filters": {
            "type": "object",
            "additionalProperties": true
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SearchResult"
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      }
    }
  }
}